#!/usr/bin/perl -w { package debug; use strict; my $c = "\017"; my $r = "\00304,01"; my $g = "\00303,01"; my $b = "\00302,01"; my $crlf = "\015\012"; IRC::register('debug.pl', '0.01', '', ''); and IRC::add_message_handler(INBOUND => 'debug::catchall'); my @states = ("$r*** $c", "$g*** $c"); sub catchall { push @states, (my $pre = shift @states); IRC::print($pre . join(' ', map {"${b}[$c" . IRC::get_info($_) . "$b]$c"} 1..3, 5..8) . $crlf); my ($head, $mesg) = (local $_ = join '', @_) =~ /^:([^:]*):(.*)$/s; IRC::print("$pre$b<$c$_$b>$c$crlf"); IRC::print($pre . join('', map {"${b}[$c$_$b]$c "} split /\s+/, $head) ."$b<$c$mesg$b>$c$crlf"); return 0; } }