X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=hl.pl;h=97a80af38e7a4b922a76c69721d47b26d67e13eb;hb=304986c32ddd8652698a79b909da39e8656c2f8b;hp=1af2f58d2e683d7363cb4a18a443903c5da4233d;hpb=c121cd3291c152431e30f27a7fcd754ec07aaceb;p=perl%2Fscripts%2Fxchat.git diff --git a/hl.pl b/hl.pl index 1af2f58..97a80af 100755 --- a/hl.pl +++ b/hl.pl @@ -18,9 +18,13 @@ sub guihl { command 'GUI COLOR 3'; } +sub guiclear { + command 'GUI COLOR 0'; +} + hook_print 'Private Message to Dialog', sub { guihl; return EAT_NONE }; -my %words = ( +my %hl = ( '#cpantesters' => [ qw/ Acme-CPANAuthors-You-re_using B-RecDeparse @@ -44,14 +48,14 @@ my %words = ( / ], ); -for (keys %words) { - my $rx = '(?:' . (join '|', @{$words{$_}}) . ')'; - $words{$_} = qr/$rx/; +for (keys %hl) { + my $rx = '(?:' . join('|', @{$hl{$_}}) . ')'; + $hl{$_} = qr/$rx/; } filter 'Channel Action' => sub { my $chan = lc get_info 'channel'; - if ($words{$chan} and $_[1] =~ /$words{$chan}/) { + if ($hl{$chan} and $_[1] =~ /$hl{$chan}/) { guihl; 1; } else { @@ -59,6 +63,27 @@ filter 'Channel Action' => sub { } } => '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',