Commit 9df20e145cf1e9ad135bea7cf1159ab38729c1f0

Authored by sniker
2 parents 088b0e35 dbf2eceb

Merge branch '0.5' into 'master'

0.5

Version 0.5 after 4 years without any development.

Changelog:

Added: Network tag and channel to notification so you know where someone said what.

Added: Network ignore, a whitespace separated list of network tags to ignore and NOT send notifications from(such as bitlbee...)

Fix: Set so normal notifications are NOT sent out when general highlight is enabled. Before you got double notifications if someone highlighted your nick because both pubmsg and general_highlight sent out notifications, now only general_highlight does.
Showing 1 changed file with 17 additions and 11 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
... ... @@ -42,16 +46,16 @@ use vars qw($VERSION %IRSSI);
42 46  
43 47 use LWP::UserAgent;
44 48  
45   -$VERSION = "0.4";
  49 +$VERSION = "0.5";
46 50  
47 51 %IRSSI = (
48 52 authors => "Caesar 'sniker' Ahlenhed",
49   - contact => "sniker\@se.linux.org",
  53 + contact => "sniker\@codebase.nu",
50 54 name => "prowl",
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,6 +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);
  67 +Irssi::settings_add_str("prowl", "prowl_ignore_nettag", "");
63 68  
64 69 # The whole "send_noti" function is pretty much taken from the prowl example script.
65 70 sub send_noti {
... ... @@ -110,17 +115,18 @@ sub send_noti {
110 115 }
111 116  
112 117 sub pubmsg {
113   - my ($server, $data, $nick) = @_;
114   -
115   - if($server->{usermode_away} == 1 && $data =~ /$server->{nick}/i){
116   - 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 + }
117 123 }
118 124 }
119 125  
120 126 sub privmsg {
121 127 my ($server, $data, $nick) = @_;
122   - if($server->{usermode_away} == 1){
123   - 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"));
124 130 }
125 131 }
126 132  
... ... @@ -129,9 +135,9 @@ sub genhilight {
129 135 my $server = $dest->{server};
130 136  
131 137 if($dest->{level} & MSGLEVEL_HILIGHT) {
132   - if($server->{usermode_away} == 1){
  138 + if($server->{usermode_away} == 1 && index(Irssi::settings_get_str("prowl_ignore_nettag"), $server->{tag}) == -1){
133 139 if(Irssi::settings_get_bool("prowl_general_hilight")){
134   - 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"));
135 141 }
136 142 }
137 143 }
... ...