And here's my new-and-improved version:
#!/usr/bin/perl
# *********************************************** #
# Xchat Font Stripper for Chats USA #
# Coded by Haggis #
# 3rd April '05 #
# http://www.haggistech.co.uk #
# Version 1.1-Zg #
# *********************************************** #
# Modified by Ziggy <[email protected]>
############################
# Bugs Fixed:
# - Messages with "CUSA" in them but not at the beginning would not parse properly
# - Missing tab in the "whisper" output stuff (so now the bar that lets you move the nicks over works)
# - the script shouldn't run on servers that aren't CUSA
# - added the #!/usr/bin/perl for distros that won't run the file without it
# - formatted the code
# - added a * before the launch info
# - changed the script name to CUSA Font Stripper, and the 0. version to 1.1-Zg
Xchat::register("CUSA Font Stripper","1.1-Zg");
Xchat::print("* ChatsUSA Font Stripper Loaded\n");
Xchat::print("* http://www.haggistech.co.uk\n");
IRC::add_message_handler("PRIVMSG", "say");
sub say
{
my ( $Nick ) = Xchat::get_info ( 'nick' );
my ( $Server ) = Xchat::get_info ( 'server' );
my $line = shift;
# Verify they're on ChatsUSA (really, not that important,
# but could prevent possible "hidden messages" on other networks,
# which may or may not be a breach of security [i.e. if you're a
# sysop, it probably would be bad if two skiddies were fighting
# in a hidden CUSA font code thing and you didn't know it])
# Also increases script efficiency by 0.0000059%. -Zg
if($Server =~ m/^CUSA.Server/)
{
# remember, the "whole line" is returned here. need to parse it some so
# messages can't be hidden by throwing "CUSA" in there somewhere.
# parse this ahead of time.
my $namehost, $prvmsg, $to, $font, $msg, $msg2, $font2;
($namehost, $prvmsg, $to, $font, $msg) = split(/ /, $line, 5);
if($font =~ m/^:CUSA/)
{
($name, $host) = split(/!/, $namehost);
($font2, $msg2) = split(/:/,$msg,2);
$name =~ s/://;
$msg =~ s/://;
if($to =~ $Nick)
{
IRC::command("/query $name"); #make a tab
Xchat::print("<$name\cC>\t$msg2", $name, $serv);
return Xchat::EAT_XCHAT;
}else{
Xchat::emit_print("Private Message to Dialog", $name, $msg2);
return Xchat::EAT_XCHAT;
}
}
return Xchat::EAT_NONE;
}
}
Edited Apr 9, 2005 3:44 AM by Ziggy
The Ignition Project | http://www.ignition-project.com/
Registered Linux User Number 368435
Hardware: AMD Athlon 64 3500+, DFI nF4 SLI Infinity, 1GB Dual Channel DDR400, 250GB Western Digital 2500 SE16 SATA II @7200rpm, 200GB Seagate 3200A UATA-133 @7200rpm, NVIDIA GeForce 6800GS OC'ed, 20" Apple Cinema Display