From 0ba60fe6a4639fe17dee9f2eb73590d3410ce0e1 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 24 Oct 2014 11:11:26 +0200 Subject: notifyudp.pl: do not ping for every public msg Send a notification only if a highlight is found (e.g. when you are mentioned). --- notifyudp.pl | 13 ++++++++++--- 1 file 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'); } -- cgit v1.2.1