X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=hl.pl;h=7e76ba2c6cfb0e654a0a4aff635c8fca84e9e6d3;hb=dd329bf05f9a50bd10d79e522334761f9785d7ab;hp=ce53996a0d76f09eee1ff40c8d6b0221dbd2a501;hpb=ffe36ae4fd26ac981a28f5e776d8424f1d56da2a;p=perl%2Fscripts%2Fxchat.git diff --git a/hl.pl b/hl.pl index ce53996..7e76ba2 100755 --- a/hl.pl +++ b/hl.pl @@ -3,13 +3,13 @@ package Xchat::VPIT::Highlight; use strict; use warnings; -use Xchat qw/:all/; +use Xchat qw<:all>; use lib get_info 'xchatdir'; use Xchat::XPI; -use Xchat::XPI::Events qw/filter/; +use Xchat::XPI::Events qw; -our $VERSION = '0.02'; +our $VERSION = '0.04'; my $ph; @@ -18,30 +18,37 @@ sub guihl { command 'GUI COLOR 3'; } +sub guiclear { + command 'GUI COLOR 0'; +} + hook_print 'Private Message to Dialog', sub { guihl; return EAT_NONE }; my %hl = ( - '#cpantesters' => [ qw/ + '#cpantesters' => [ qw< Acme-CPANAuthors-You-re_using B-RecDeparse + Bit-MorseSignals CPANPLUS-Dist-Gentoo + IPC-MorseSignals Lexical-Types Linux-SysInfo - MorseSignals Perl-Critic-Policy-Dynamic-NoIndirect Regexp-Wildcards Scalar-Vec-Util Scope-Upper Sub-Nary + Sub-Op Sub-Prototype-Util Test-Valgrind Thread-Cleanup Variable-Magic + autovivification- indirect- rgit- subs-auto - with- - / ], + \bwith- + > ], ); for (keys %hl) { @@ -59,12 +66,35 @@ filter 'Channel Action' => sub { } } => 'Channel Action Hilight'; -$ph = new Xchat::XPI name => 'Smart highlighting', - tag => 'HL', - desc => 'Highlight on private messages', - author => 'Vincent Pit (VPIT)', - email => 'perl@profvince.com', - url => 'http://www.profvince.com'; - +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 = Xchat::XPI->new( + name => 'Smart highlighting', + tag => 'HL', + desc => 'Highlight on private messages', + author => 'Vincent Pit (VPIT)', + email => 'perl@profvince.com', + url => 'http://www.profvince.com', +); + 1;