From 56616c5798cee1960682b93883376f0e0657f62e Mon Sep 17 00:00:00 2001 From: Tyler Abair Date: Wed, 15 Jul 2015 09:55:53 -0400 Subject: fnotify.pl: added support for ignoring hilights of a given priority --- scripts/fnotify.pl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/fnotify.pl b/scripts/fnotify.pl index 5321ee8..88bf935 100644 --- a/scripts/fnotify.pl +++ b/scripts/fnotify.pl @@ -3,10 +3,11 @@ use warnings; use vars qw($VERSION %IRSSI); use Irssi; -$VERSION = '0.0.5'; +$VERSION = '0.0.6'; %IRSSI = ( name => 'fnotify', - authors => 'Thorsten Leemhuis, James Shubin, Serge van Ginderachter', + authors => 'Tyler Abair, Thorsten Leemhuis, James Shubin' . + ', Serge van Ginderachter', contact => 'fedora@leemhuis.info, serge@vanginderachter.be', description => 'Write notifications to a file in a consistent format.', license => 'GNU General Public License', @@ -20,11 +21,16 @@ $VERSION = '0.0.5'; # $ cp fnotify.pl ~/.irssi/scripts/fnotify.pl # irssi> /load perl # irssi> /script load fnotify +# irssi> /set fnotify_ignore_hilight 0 # ignore hilights of priority 0 # # # AUTHORS # +# Ignore hilighted messages with priority = fnotify_ignore_hilight +# version: 0.0.6 +# Tyler Abair +# # Strip non-parsed left over codes (Bitlbee otr messages) # version: 0.0.5 # Serge van Ginderachter @@ -48,6 +54,11 @@ $VERSION = '0.0.5'; # http://fedora.feedjack.org/user/918/ # +my %config; + +Irssi::settings_add_int('fnotify', 'fnotify_ignore_hilight' => -1); +$config{'ignore_hilight'} = Irssi::settings_get_int('fnotify_ignore_hilight'); + # # catch private messages # @@ -63,7 +74,8 @@ sub priv_msg { # sub hilight { my ($dest, $text, $stripped) = @_; - if ($dest->{level} & MSGLEVEL_HILIGHT) { + my $ihl = $config{'ignore_hilight'}; + if ($dest->{level} & MSGLEVEL_HILIGHT && $dest->{hilight_priority} > $ihl) { my $server = $dest->{server}; my $network = $server->{tag}; filewrite($network . ' ' . $dest->{target} . ' ' . $stripped); -- cgit v1.2.3 From 68cff155f150b1286b11f43e5267d19a524a0b7c Mon Sep 17 00:00:00 2001 From: Tyler Abair Date: Tue, 26 Jan 2016 17:14:23 -0500 Subject: let fnotify reconfig on the fly --- scripts/fnotify.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/fnotify.pl b/scripts/fnotify.pl index 88bf935..83cc858 100644 --- a/scripts/fnotify.pl +++ b/scripts/fnotify.pl @@ -59,6 +59,12 @@ my %config; Irssi::settings_add_int('fnotify', 'fnotify_ignore_hilight' => -1); $config{'ignore_hilight'} = Irssi::settings_get_int('fnotify_ignore_hilight'); +Irssi::signal_add( + 'setup changed' => sub { + $config{'ignore_hilight'} = Irssi::settings_get_int('fnotify_ignore_hilight'); + } +); + # # catch private messages # @@ -75,7 +81,7 @@ sub priv_msg { sub hilight { my ($dest, $text, $stripped) = @_; my $ihl = $config{'ignore_hilight'}; - if ($dest->{level} & MSGLEVEL_HILIGHT && $dest->{hilight_priority} > $ihl) { + if ($dest->{level} & MSGLEVEL_HILIGHT && $dest->{hilight_priority} != $ihl) { my $server = $dest->{server}; my $network = $server->{tag}; filewrite($network . ' ' . $dest->{target} . ' ' . $stripped); -- cgit v1.2.3