summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTyler Abair2015-07-15 09:55:53 -0400
committerTyler Abair2015-07-15 09:55:53 -0400
commit56616c5798cee1960682b93883376f0e0657f62e (patch)
tree96f6202d76c6a304bc0213ba2c9160d9b7564c24 /scripts
parent932b8b56aed93ad6145a8e04cf849fb2a01dcbab (diff)
downloadscripts.irssi.org-56616c5798cee1960682b93883376f0e0657f62e.tar.bz2
fnotify.pl: added support for ignoring hilights of a given priority
Diffstat (limited to 'scripts')
-rw-r--r--scripts/fnotify.pl18
1 files changed, 15 insertions, 3 deletions
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 <tyler.abair@gmail.com>
+#
# Strip non-parsed left over codes (Bitlbee otr messages)
# version: 0.0.5
# Serge van Ginderachter <serge@vanginderachter.be>
@@ -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);