]>
jfr.im git - irc/evilnet/x3.git/blob - tools/mrsnoopy.pl
3 # Author: rubin@afternet.org irc.afternet.org/#afternet
5 $script_version = "0.3" ;
6 $script_name = "MrSnoopy's magic color kit v $script_version " ;
7 $version = IRC
:: get_info
( 0 );
8 # get a string of the form 1.2.0 or 1.3.3
10 if ( $version >= 120 ) {
11 IRC
:: register
( "MrSnoopy's magic color kit" , $script_version , "" , "" );
14 IRC
:: add_message_handler
( "PRIVMSG" , "IRC::Xchat::MrSnoopy::privmsg_handler" ); # msgs
16 package IRC
:: Xchat
:: MrSnoopy
;
18 IRC
:: print " \003 2SNOOPY: \003\t Loading $script_name ... \n " ;
20 $color_darkgreen = '03' ;
21 $color_darkblue = '02' ;
25 $color_darkred = '05' ;
26 $color_darkmajenta = '06' ;
27 $color_darkyellow = '07' ;
30 $color_darkcyan = '10' ;
33 $color_majenta = '13' ;
34 $color_darkgrey = '14' ;
37 $dronename_file = $ENV { 'HOME' }. "/.xchat2/drones.txt" ;
40 #----------------------
43 open PENFILE
, "< $dronename_file " or IRC
:: print " \003 2SNOOPY: \003\t Error opening $dronename_file \n " ;
49 @lines = split /\n/ , $line ;
50 foreach $line ( @lines )
52 $DroneNames { " $line " } = 1 ;
53 # IRC::print "Adding penDrone name '$line'\n";
55 #----------------------
56 $count = 0 + %DroneNames ;
57 IRC
:: print " \003 2SNOOPY: \003\t Added $count names from drone file $dronename_file \n " ;
62 $cmds =~ /\:(\S+)\s+PRIVMSG\s+(\S+)\s+\:(.*)/ ;
67 if ( $target =~ /\#MrSnoopy/ )
69 $source =~ /(\S+)\!(\S+)\@(\S+)/ ;
74 # [15:14:10] QUIT efggv (KIM666@82-35-112-226.cable.ubr07.dals.blueyonder.co.uk, on Gamesleague.NL.Afternet.Org) (Quit)
75 if ( $msg =~ /(\[[^]]+\])\W+(\w+)\W+ (.+)/ )
81 if ( $note_type =~ /(JOIN)/ )
83 $message =~ /(\S+)\sby\s(\S+)/ ;
86 IRC
:: print " $time \003 " . $color_darkyellow . " JOIN \t $nick joined \003 $color_darkyellow$chan \003\n " ;
88 elsif ( $note_type =~ /(CREATE)/ )
90 $message =~ /(\S+)\sby\s(\S+)/ ;
93 IRC
:: print " $time \003 " . $color_darkyellow . " CREATE \t $nick joined $chan \003\n " ;
95 elsif ( $note_type =~ /PART/ )
97 $message =~ /(\S+)\sby\s(\S+)/ ;
100 IRC
:: print " $time \003 " . $color_darkmajenta . " PART \t $nick left $chan \003\n " ;
102 elsif ( $note_type =~ /NICK/ )
104 # Armagedon|RoA-afk Armagedon_@c56-151.icpnet.pl () [62.21.56.151] on Airspace.US.AfterNET.Org
105 if ( $message =~ /(\S+)\s([^@]+)\@(\S+)\s\(([^)]*)\)\s\[([^]]+)\]\son\s(\S+)/ )
107 $nick = sprintf ( "%-15s" , $1 );
108 #$user = sprintf("%10s", $2);
112 $ip = sprintf ( " %15s " , $5 );
114 #IRC::print "$time \003".$color_green."CONNECT\t[\003$color_blue$ip\003$color_green] as $nick \003$color_darkcyan$user\003$color_grey@\003$color_darkcyan$host \003$color_green(\003$color_yellow$account\003$color_green) on $server\n";
115 IRC
:: print " $time \003 " . $color_green . "CONNECT \t $nick ( \003 $color_darkcyan$user \003 $color_grey@ \003 $color_darkcyan$host \003 $color_green ) \003 $color_yellow*$account \003 $color_green [ \003 $color_blue$ip \003 $color_green ] on $server \003\n " ;
116 #if(exists $DroneNames{$1})
117 if ( exists $DroneNames { $1 } && exists $DroneNames { $2 } && !( $1 eq $2 ))
119 IRC
:: print " \003 2SNOOPY: \003\t $time \003 " . $color_red . "!!!!! ' $1 ' is a drone! \n " ;
120 IRC
:: command
"/MSG #Operations .drone $1 AUTO" ;
124 #IRC::print "\003".$color_green." \t '$1' Not a drone\n";
127 #[21:32:45] NICK change Lil_JJ -> [-BDC-]J_Word
128 elsif ( $message =~ /change (\S+)\s\-\>\s(\S+)/ )
132 IRC
:: print " $time \003 " . $color_darkgreen . " NICK \t $old is now known as $new \003\n " ;
140 elsif ( $note_type =~ /QUIT/ )
142 # InvaderC1 (Chadwick@adsl-67-125-1-144.dsl.scrm01.pacbell.net, on Gamesleague.NL.Afternet.Org) (Ping timeout)
143 #OR - QUIT Nader (supybot@CPE-72-131-73-97.mn.res.rr.com, on Pyro.US.AfterNET.Org) (Killed (Rubin (testing snoop)))
144 #OR - no "killed" at all? WTF is up with snoop and kills.
145 $message =~ /(\S+)\s\(([^@]+)\@([^,]+)\,\son\s(\S+)\)\s\((Killed|)(.+)\)/ ;
146 $nick = sprintf ( "%-15s" , $1 );
152 IRC
:: print " $time \003 " . $color_darkred . " QUIT \t $nick ( \003 $color_darkgrey$user \003 $color_grey@ \003 $color_darkgrey$host \003 $color_darkred ) on $server ( \003 $color_white$quitmsg \003 $color_darkred ) \003 [ $killed ] \n " ;
155 elsif ( $note_type =~ /UMODE/ )
158 if ( $message =~ /(\S+)\s+(.+)\s*(\S*)/ )
163 IRC
:: print " $time \003 " . $color_darkgrey . " UMODE \t $nick \002 $mode \002 $nick \003\n " ;
170 elsif ( $note_type =~ /MODE/ )
172 # afternet +l 12 by X3
173 if ( $message =~ /\s*(\S+)\s+(.+)\sby\s(\S+)/ )
178 IRC
:: print " $time \003 $color_grey MODE \t $nick set \002 $mode \002 on $channel \003\n " ;
185 elsif ( $note_type =~ /AUTH/ )
188 $message =~ /(\S+)\sas\s(\S+)/ ;
191 IRC
:: print " $time \003 $color_darkgreen AUTH \t $nick as \003 $color_yellow*$account \003\n " ;
193 elsif ( $note_type =~ /KILL/ )
195 #Sore (mem0ry@Toronto-HSE-ppp3667456.sympatico.ca, on Pyro.US.AfterNET.Org) by AuthServ (Ghost kill on account Sorea (requested by Eros).)
196 if ( $message =~ /(\S+)\s\(([^@]+)\@([^,]+)\,\son\s(\S+)\)\sby\s(\S+)\s(.*)\)/ )
204 IRC
:: print " $time \003 " . $color_darkred . " KILL \t $nick ( \003 $color_darkgrey$user \003 $color_grey@ \003 $color_darkgrey$host \003 $color_darkred ) on $server by $killer ( \003 $color_white$quitmsg \003 $color_darkred ) \003\n " ;
214 #didnt understand it, just let xchat print it
217 # Successfully handled it, return handled
222 #IRC::print "'$msg' didnt match\n";
229 IRC
:: print " \003 2SNOOPY: \003\t ...Done \n " ;