Commit ab959500632d1272161801282ae9b38c6f8f2ebf

Authored by Caesar Ahlenhed
1 parent 707aea7d

v0.2

Showing 1 changed file with 17 additions and 11 deletions   Show diff stats
boxcarirssi.pl
... ... @@ -13,6 +13,10 @@ use warnings;
13 13 # /set boxcar_email something@example.com
14 14 # /set boxcar_password password
15 15 # /set boxcar_general_hilight on/off
  16 +# /set boxcar_ignore_nettag NETWORKS # Networks in this case is a
  17 +# comma separated list of
  18 +# network tags that should
  19 +# be ignored.
16 20 #
17 21 # "General hilight" basically referrs to ALL the hilights you have
18 22 # added manually in irssi, if many, it can get really bloated if
... ... @@ -37,22 +41,23 @@ use vars qw($VERSION %IRSSI);
37 41 use LWP::UserAgent;
38 42 use HTTP::Request::Common;
39 43  
40   -$VERSION = "0.1";
  44 +$VERSION = "0.2";
41 45  
42 46 %IRSSI = (
43 47 authors => "Caesar 'sniker' Ahlenhed",
44   - contact => "sniker\@se.linux.org",
  48 + contact => "sniker\@codebase.nu",
45 49 name => "boxcarirssi",
46 50 description => "Sends notifcations when away",
47 51 license => "GPLv2",
48 52 url => "http://sniker.codebase.nu",
49   - changed => "Sat Feb 12 23:56:32 CET 2011",
  53 + changed => "Sat Jun 23 18:06:26 CESTT 2014",
50 54 );
51 55  
52 56 # Configuration settings and default values.
53 57 Irssi::settings_add_str("boxcarirssi", "boxcarirssi_email", "");
54 58 Irssi::settings_add_str("boxcarirssi", "boxcarirssi_password", "");
55 59 Irssi::settings_add_bool("boxcarirssi", "boxcarirssi_general_hilight", 0);
  60 +Irssi::settings_add_str("boxcarirssi", "boxcarirssi_ignore_nettag", "");
56 61  
57 62 sub send_noti {
58 63 my ($text) = @_;
... ... @@ -80,17 +85,18 @@ sub send_noti {
80 85 }
81 86  
82 87 sub pubmsg {
83   - my ($server, $data, $nick) = @_;
84   -
85   - if($server->{usermode_away} == 1 && $data =~ /$server->{nick}/i){
86   - send_noti("Hilighted - " . $nick . ': ' . $data);
  88 + my ($server, $data, $nick, $nick_addr, $target) = @_;
  89 + if(!Irssi::settings_get_bool("boxcarirssi_general_hilight")){
  90 + if($server->{usermode_away} == 1 && $data =~ /$server->{nick}/i && index(Irssi::settings_get_str("boxcarirssi_ignore_nettag"), $server->{tag}) == -1){
  91 + send_noti("Hilighted " . $server->{tag} . "/" . $target ." - " . $nick . ': ' . $data);
  92 + }
87 93 }
88 94 }
89 95  
90 96 sub privmsg {
91 97 my ($server, $data, $nick) = @_;
92   - if($server->{usermode_away} == 1){
93   - send_noti("PM - " . $nick . ': ' . $data);
  98 + if($server->{usermode_away} == 1 && index(Irssi::settings_get_str("boxcarirssi_ignore_nettag"), $server->{tag}) == -1){
  99 + send_noti("PM @ " . $server->{tag} . " - " . $nick . ': ' . $data);
94 100 }
95 101 }
96 102  
... ... @@ -99,9 +105,9 @@ sub genhilight {
99 105 my $server = $dest->{server};
100 106  
101 107 if($dest->{level} & MSGLEVEL_HILIGHT) {
102   - if($server->{usermode_away} == 1){
  108 + if($server->{usermode_away} == 1 && index(Irssi::settings_get_str("boxcarirssi_ignore_nettag"), $server->{tag}) == -1){
103 109 if(Irssi::settings_get_bool("boxcarirssi_general_hilight")){
104   - send_noti("General Hilight - " . $stripped);
  110 + send_noti("General Hilight " . $server->{tag} . "/" . $dest->{target} ." - " . $stripped);
105 111 }
106 112 }
107 113 }
... ...