diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-10-24 11:11:26 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-10-24 11:11:26 +0200 |
commit | 0ba60fe6a4639fe17dee9f2eb73590d3410ce0e1 (patch) | |
tree | b4bdac14565ec8955c4ec6ad232f01dd33bbca9b /notifyudp.pl | |
parent | 606d04b3752f599839d32d7b0841cf878fad0978 (diff) | |
download | scripts-0ba60fe6a4639fe17dee9f2eb73590d3410ce0e1.tar.gz |
notifyudp.pl: do not ping for every public msg
Send a notification only if a highlight is found (e.g. when you are
mentioned).
Diffstat (limited to 'notifyudp.pl')
-rw-r--r-- | notifyudp.pl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/notifyudp.pl b/notifyudp.pl index 9f878aa..6124b88 100644 --- a/notifyudp.pl +++ b/notifyudp.pl @@ -11,7 +11,7 @@ use IO::Socket; use vars qw($VERSION %IRSSI); use Time::HiRes qw(time); -$VERSION = "0.2.20130614"; +$VERSION = "0.3.20140930"; %IRSSI = ( authors => 'Lekensteyn', contact => 'lekensteyn@gmail.com', @@ -63,6 +63,12 @@ sub notify { } } } +sub notify_if_hilighted { + my ($dest, $text, $stripped) = @_; + if ($dest->{level} & MSGLEVEL_HILIGHT) { + notify(); + } +} sub notify_stop { if ($sock) { @@ -90,8 +96,8 @@ sub cmd_notifyudp { Irssi::command_bind('notifyudp', 'cmd_notifyudp'); my @signals = ( -#'print text', # too verbose? -'message public', +# Uncomment the following to get notifs for every (channel) message +#'message public', 'message private', 'dcc request', @@ -108,6 +114,7 @@ my @signals = ( 'ctcp msg', 'ctcp reply', ); +Irssi::signal_add('print text', 'notify_if_hilighted'); foreach (@signals) { Irssi::signal_add($_, 'notify'); } |