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/Linux-SysInfo MorseSignals Regexp-Wildcards Scalar-Vec-Util Sub-Prototype-Util Test-Valgrind Variable-Magic with- B-RecDeparse Sub-Nary indirect- subs-auto/ ] ); 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;