Commit dbf2eceb8aed3c7432d19fb0e6f95f24ad366cf3

Authored by sniker
Committed by sniker
1 parent 5390f33c

Added network ignore, fixed general highlight issue, added servertag and channel to notification

Showing 1 changed file with 15 additions and 10 deletions   Show diff stats
prowl.pl
... ... @@ -18,6 +18,10 @@ use warnings;
18 18 # /set prowl_priority_channel -2 up to 2
19 19 # /set prowl_priority_pm -2 up to 2
20 20 # /set prowl_priority_general -2 up to 2
  21 +# /set prowl_ignore_nettag NETWORKS # Networks in this case is a
  22 +# comma separated list of
  23 +# network tags that should
  24 +# be ignored.
21 25 #
22 26 # "General hilight" basically referrs to ALL the hilights you have
23 27 # added manually in irssi, if many, it can get really bloated if
... ... @@ -51,7 +55,7 @@ $VERSION = "0.5";
51 55 description => "Sends prowlnotifcations when away",
52 56 license => "GPLv2",
53 57 url => "http://sniker.codebase.nu",
54   - changed => "Mon Mar 15 18:53:32 CET 2010",
  58 + changed => "Mon Jun 23 17:14:23 CEST 2014",
55 59 );
56 60  
57 61 # Configuration settings and default values.
... ... @@ -60,7 +64,7 @@ Irssi::settings_add_bool("prowl", "prowl_general_hilight", 0);
60 64 Irssi::settings_add_str("prowl", "prowl_priority_channel", 0);
61 65 Irssi::settings_add_str("prowl", "prowl_priority_pm", 0);
62 66 Irssi::settings_add_str("prowl", "prowl_priority_general", 0);
63   -Irssi::settings_add_str("prowl", "prowl_ignore_net", "");
  67 +Irssi::settings_add_str("prowl", "prowl_ignore_nettag", "");
64 68  
65 69 # The whole "send_noti" function is pretty much taken from the prowl example script.
66 70 sub send_noti {
... ... @@ -111,17 +115,18 @@ sub send_noti {
111 115 }
112 116  
113 117 sub pubmsg {
114   - my ($server, $data, $nick) = @_;
115   -
116   - if($server->{usermode_away} == 1 && $data =~ /$server->{nick}/i){
117   - send_noti("Hilighted", $nick . ': ' . $data, Irssi::settings_get_str("prowl_priority_channel"));
  118 + my ($server, $data, $nick, $nick_addr, $target) = @_;
  119 + if(!Irssi::settings_get_bool("prowl_general_hilight")){
  120 + if($server->{usermode_away} == 1 && $data =~ /$server->{nick}/i && index(Irssi::settings_get_str("prowl_ignore_nettag"), $server->{tag}) == -1){
  121 + send_noti("Hilighted " . $server->{tag} . "/" . $target, $nick . ': ' . $data, Irssi::settings_get_str("prowl_priority_channel"));
  122 + }
118 123 }
119 124 }
120 125  
121 126 sub privmsg {
122 127 my ($server, $data, $nick) = @_;
123   - if($server->{usermode_away} == 1){
124   - send_noti("PM", $nick . ': ' . $data, Irssi::settings_get_str("prowl_priority_pm"));
  128 + if($server->{usermode_away} == 1 && index(Irssi::settings_get_str("prowl_ignore_nettag"), $server->{tag}) == -1){
  129 + send_noti("PM @ " . $server->{tag}, $nick . ': ' . $data, Irssi::settings_get_str("prowl_priority_pm"));
125 130 }
126 131 }
127 132  
... ... @@ -130,9 +135,9 @@ sub genhilight {
130 135 my $server = $dest->{server};
131 136  
132 137 if($dest->{level} & MSGLEVEL_HILIGHT) {
133   - if($server->{usermode_away} == 1){
  138 + if($server->{usermode_away} == 1 && index(Irssi::settings_get_str("prowl_ignore_nettag"), $server->{tag}) == -1){
134 139 if(Irssi::settings_get_bool("prowl_general_hilight")){
135   - send_noti("General Hilight", $stripped, Irssi::settings_get_str("prowl_priority_general"));
  140 + send_noti("General Hilight " . $server->{tag} . "/" . $dest->{target}, $stripped, Irssi::settings_get_str("prowl_priority_general"));
136 141 }
137 142 }
138 143 }
... ...