package Xchat::VPIT::Highlight; use strict; use warnings; use Xchat qw/:all/; use lib get_info 'xchatdir'; use Xchat::XPI; use Xchat::XPI::Events qw/filter/; our $VERSION = '0.02'; my $ph; sub guihl { command 'GUI FLASH'; command 'GUI COLOR 3'; } hook_print 'Private Message to Dialog', sub { guihl; return EAT_NONE }; my %words = ( '#cpantesters' => [ qw/ Acme-CPANAuthors-You-re_using B-RecDeparse CPANPLUS-Dist-Gentoo Lexical-Types Linux-SysInfo MorseSignals Perl-Critic-Policy-Dynamic-NoIndirect Regexp-Wildcards Scalar-Vec-Util Scope-Upper Sub-Nary Sub-Prototype-Util Test-Valgrind Thread-Cleanup Variable-Magic indirect- rgit- subs-auto with- / ], ); for (keys %words) { my $rx = '(?:' . (join '|', @{$words{$_}}) . ')'; $words{$_} = qr/$rx/; } filter 'Channel Action' => sub { my $chan = lc get_info 'channel'; if ($words{$chan} and $_[1] =~ /$words{$chan}/) { guihl; 1; } else { 0; } } => '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'; 1;