usestrict;usewarnings;useXchatqw( :all );my$name='Regex stalkwords';my$version='1.1';my$description='Regex stalkwords';Xchat::register($name,$version,$description);Xchat::print("Loading $name $version: $description");foreach('Channel Message','Channel Action'){hook_print($_,\&channel_highlight,{priority=>PRI_HIGHEST,data=>$_});}my$highlight=qr/\b(?:one|two|three)\b/i;# These are normal-ish stalkwordsmy$stalkwords=qr/!(four|five|six)\b/i;# For !admin@mywiki or whateversubchannel_highlight{if(definedget_info('away')){returnEAT_NONE;}# Don't highlight if we're awaymy$event=$_[1];my$nick=$_[0][0];my$msg=($_[0][1]?strip_code($_[0][1]):'');# We override colours etc because it's a highlight (and that can mess up matching)# If $_[0][1] is undefined, use a zero-length string for safety$_[0][1]=($_[0][1]?strip_code($_[0][1]):'');# We also want to strip it from the value in the array, for display purposesif(get_prefs('irc_no_hilight')ne''){my$ignored='(?:'.get_prefs('irc_no_hilight').')';# Grabs your pref for who not to highlight, and excludes them$ignored=~s/,/\|/g;$ignored=qr/$ignored/;if(($nick!~m/$ignored/)and(($msg=~$highlight)||($msg=~$stalkwords))){if($eventeq'Channel Message'){$event='Channel Msg Hilight';}else{$event='Channel Action Hilight';}emit_print($event,@{$_[0]});command('gui color 3');# Change the tab colourreturnEAT_XCHAT;}returnEAT_NONE;}else{if(($msg=~$highlight)||($msg=~$stalkwords)){if($eventeq'Channel Message'){$event='Channel Msg Hilight';}else{$event='Channel Action Hilight';}emit_print($event,@{$_[0]});command('gui color 3');# Change the tab colourreturnEAT_XCHAT;}returnEAT_NONE;}}