]> git.vpit.fr Git - perl/scripts/xchat.git/commitdiff
Add an ignore highlight filter
authorVincent Pit <vince@profvince.com>
Thu, 30 Jul 2009 09:43:50 +0000 (11:43 +0200)
committerVincent Pit <vince@profvince.com>
Thu, 30 Jul 2009 09:43:50 +0000 (11:43 +0200)
hl.pl

diff --git a/hl.pl b/hl.pl
index ce53996a0d76f09eee1ff40c8d6b0221dbd2a501..97a80af38e7a4b922a76c69721d47b26d67e13eb 100755 (executable)
--- a/hl.pl
+++ b/hl.pl
@@ -18,6 +18,10 @@ sub guihl {
  command 'GUI COLOR 3';
 }
 
  command 'GUI COLOR 3';
 }
 
+sub guiclear {
+ command 'GUI COLOR 0';
+}
+
 hook_print 'Private Message to Dialog', sub { guihl; return EAT_NONE };
 
 my %hl = (
 hook_print 'Private Message to Dialog', sub { guihl; return EAT_NONE };
 
 my %hl = (
@@ -59,6 +63,27 @@ filter 'Channel Action' => sub {
  }
 } => 'Channel Action Hilight';
 
  }
 } => 'Channel Action Hilight';
 
+my %skip = (
+ '#p5p' => [
+   '(?i:jesse.vincent)',
+ ],
+);
+
+for (keys %skip) {
+ my $rx = '(?:' . join('|', @{$skip{$_}}) . ')';
+ $skip{$_} =  qr/$rx/;
+}
+
+filter 'Channel Action Hilight' => sub {
+ my $chan = lc get_info 'channel';
+ if ($skip{$chan} and $_[1] =~ /$skip{$chan}/) {
+  guiclear;
+  1;
+ } else {
+  0;
+ }
+} => 'Channel Action';
+
 $ph = new Xchat::XPI name   => 'Smart highlighting',
                      tag    => 'HL',
                      desc   => 'Highlight on private messages',
 $ph = new Xchat::XPI name   => 'Smart highlighting',
                      tag    => 'HL',
                      desc   => 'Highlight on private messages',