#!/usr/bin/perl -w # # Script made for ircu based servers to make use of some extra comands and functions # (I wanted to have these when im on ARCNet and Undernet :) # # Made by SmallOne usually found in #opers on se1.arcnet.vapor.com # (Thanks to Llarian for the help with the sno_mask_handler :) # Register the script IRC::register("ARCNet script", "0.2", "", ""); #Print the ascii logo IRC::command("/clear"); IRC::print "\002\0031 Loading ............. \003\n"; IRC::print "\0031,0 *** \003\n"; IRC::print "\0031,0 ** ************ ********* ******* ****** ** \003\n"; IRC::print "\0031,0 *** *** ***** **** *** ****** *** ** \003\n"; IRC::print "\0031,0 **** *** **** *** ** ****** * *** \003\n"; IRC::print "\0031,0 ** *** *** ******** ** * *** * ** \003\n"; IRC::print "\0031,0 * *** *** ******* *** *** ** ****** ********\003\n"; IRC::print "\0031,0 ** ** ** ******** *** **** ** *** *********** \003\n"; IRC::print "\0031,0 * ** ** **** *** ** *** ** *** *** *** \003\n"; IRC::print "\0031,0 * *** ********** **** * **** * *** *** **** \003\n"; IRC::print "\0031,0 ********** ********* **** * **** * *** **** *** \003\n"; IRC::print "\0031,0 ********** *** **** **** ** *** ************ *** \003\n"; IRC::print "\0031,0 ** ** *** **** **** ** ********* *** \003\n"; IRC::print "\0031,0 * *** ** **** **** ** ******** *** \003\n"; IRC::print "\0031,0 ** *** ** **** **** ** **** *** *** \003\n"; IRC::print "\0031,0 *** *** *** **** *** ** ** **** *** ******* * \003\n"; IRC::print "\0031,0 ***** ********** ***** **** ******* *** **** *** ******** \003\n"; IRC::print "\0031,0****** ************ **** ******* ****** *** ***** ***** \003\n"; IRC::print "\002\0031 Written by SmallOne .... V0.2\003\n"; IRC::print "\002\0031 Script loaded and added /umode /search and /snomask \003\n"; # Add the script messages handlers IRC::add_message_handler("354", "IRC::Xchat::ARCNet::ircu_who_handler"); #ircu /whox #IRC::add_message_handler("315", "IRC::Xchat::ARCNet::who_end_handler"); #/who end unused atm IRC::add_message_handler("008", "IRC::Xchat::ARCNet::sno_mask_handler"); #ircu server notice mask handler # Add the script command handlers IRC::add_command_handler("umode", "IRC::Xchat::ARCNet::umode_cmd"); #user mode changes IRC::add_command_handler("search", "IRC::Xchat::ARCNet::ircu_who_cmd"); #arcnet/undernet based command IRC::add_command_handler("snomask", "IRC::Xchat::ARCNet::sno_mask_cmd"); #ircu server notice mask package IRC::Xchat::ARCNet; # The /umode command used instead of /mode nick +-mode sub umode_cmd { $nick=IRC::get_info(1); #get the current nickname local($cmds) = @_; $cmds =~ m/(.*)/; IRC::send_raw("mode $nick $cmds\r\n"); return 1; } #The Server notice mask command changes the current +s mask on undernet servers sub sno_mask_cmd { $nick=IRC::get_info(1); #get current nickname local($cmds) = @_; @command=split(/ /, $cmds); #split the commands foreach $command (@command){ SWITCH: { if ($command eq "+OLDSNO"){ IRC::send_raw("mode $nick +s +1\r\n"); last SWITCH; } if ($command eq "-OLDSNO"){ IRC::send_raw("mode $nick +s -1\r\n"); last SWITCH; } if ($command eq "+SERVKILL"){ IRC::send_raw("mode $nick +s +2\r\n"); last SWITCH; } if ($command eq "-SERVKILL"){ IRC::send_raw("mode $nick +s -2\r\n"); last SWITCH; } if ($command eq "+OPERKILL"){ IRC::send_raw("mode $nick +s +4\r\n"); last SWITCH; } if ($command eq "-OPERKILL"){ IRC::send_raw("mode $nick +s -4\r\n"); last SWITCH; } if ($command eq "+HACK2"){ IRC::send_raw("mode $nick +s +8\r\n"); last SWITCH; } if ($command eq "-HACK2"){ IRC::send_raw("mode $nick +s -8\r\n"); last SWITCH; } if ($command eq "+HACK3"){ IRC::send_raw("mode $nick +s +16\r\n"); last SWITCH; } if ($command eq "-HACK3"){ IRC::send_raw("mode $nick +s -16\r\n"); last SWITCH; } if ($command eq "+UNAUTH"){ IRC::send_raw("mode $nick +s +32\r\n"); last SWITCH; } if ($command eq "-UNAUTH"){ IRC::send_raw("mode $nick +s -32\r\n"); last SWITCH; } if ($command eq "+TCPCOMMON"){ IRC::send_raw("mode $nick +s +64\r\n"); last SWITCH; } if ($command eq "-TCPCOMMON"){ IRC::send_raw("mode $nick +s -64\r\n"); last SWITCH; } if ($command eq "+TOOMANY"){ IRC::send_raw("mode $nick +s +128\r\n"); last SWITCH; } if ($command eq "-TOOMANY"){ IRC::send_raw("mode $nick +s -128\r\n"); last SWITCH; } if ($command eq "+HACK4"){ IRC::send_raw("mode $nick +s +256\r\n"); last SWITCH; } if ($command eq "-HACK4"){ IRC::send_raw("mode $nick +s -256\r\n"); last SWITCH; } if ($command eq "+GLINE"){ IRC::send_raw("mode $nick +s +512\r\n"); last SWITCH; } if ($command eq "-GLINE"){ IRC::send_raw("mode $nick +s -512\r\n"); last SWITCH; } if ($command eq "+NETWORK"){ IRC::send_raw("mode $nick +s +1024\r\n"); last SWITCH; } if ($command eq "-NETWORK"){ IRC::send_raw("mode $nick +s -1024\r\n"); last SWITCH; } if ($command eq "+IPMISMATCH"){ IRC::send_raw("mode $nick +s +2048\r\n"); last SWITCH; } if ($command eq "-IPMISMATCH"){ IRC::send_raw("mode $nick +s -2048\r\n"); last SWITCH; } if ($command eq "+THROTTLE"){ IRC::send_raw("mode $nick +s +4096\r\n"); last SWITCH; } if ($command eq "-THROTTLE"){ IRC::send_raw("mode $nick +s -4096\r\n"); last SWITCH; } if ($command eq "+OLDREALOP"){ IRC::send_raw("mode $nick +s +8192\r\n"); last SWITCH; } if ($command eq "-OLDREALOP"){ IRC::send_raw("mode $nick +s -8192\r\n"); last SWITCH; } if ($command eq "+CONNEXIT"){ IRC::send_raw("mode $nick +s +16384\r\n"); last SWITCH; } if ($command eq "-CONNEXIT"){ IRC::send_raw("mode $nick +s -16384\r\n"); last SWITCH; } IRC::print "Usage: /snomask +-\n"; } } return 1; } # The server numerics for sno_mask to report it in a human readable form :) sub sno_mask_handler { local($line) = @_; #:se1.arcnet.vapor.com 008 SmallBBL 4 :: Server notice mask (0x4) #This is the line we want to parse and get the notice mask id $line =~ m/:(.*) 008 (.+?) (.+?) :: (.*)/; $myserver=$1; #The server we are connected to $mynick=$2; #The current nickname $id=$3; #SNO_MASK id $servercrap=$4; #We dont need the rest of the line undef $string_literal; # undefine some stuff that might cause trouble if previously defined undef @string_array; # the list of all the elements we're searching for @id_mask = (16384 , 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1); # Declare a hash for the values $attribute_hash = {}; # Now put each value into the attribute hash $attribute_hash->{1} = "SNO_OLDSNO"; $attribute_hash->{2} = "SNO_SERVKILL"; $attribute_hash->{4} = "SNO_OPERKILL"; $attribute_hash->{8} = "SNO_HACK2"; $attribute_hash->{16} = "SNO_HACK3"; $attribute_hash->{32} = "SNO_UNAUTH"; $attribute_hash->{64} = "SNO_TCPCOMMON"; $attribute_hash->{128} = "SNO_TOOMANY"; $attribute_hash->{256} = "SNO_HACK4"; $attribute_hash->{512} = "SNO_GLINE"; $attribute_hash->{1024} = "SNO_NETWORK"; $attribute_hash->{2048} = "SNO_IPMISMATCH"; $attribute_hash->{4096} = "SNO_THROTTLE"; $attribute_hash->{8192} = "SNO_OLDREALOP"; $attribute_hash->{16384} = "SNO_CONNEXIT"; foreach $mask_element (@id_mask) { $tested_id = $id - $mask_element; if ( $tested_id >= 0 ) { push ( @string_array , $attribute_hash->{$mask_element} ); $id = $id - $mask_element; } } # @string_array will now hold a list of all the text elements present $string_literal = join( "|" , @string_array ); # This leave $string_literal defined as a '|' delimited list of all the notice strings IRC::print "*** Server notice mask is now $string_literal\n"; # Here we print the stuff :) return 1; } # The /search command based on ircu's extended /who stuff sub ircu_who_cmd { local($cmds) = @_; $cmds =~ m/(.+?) (.*)/; # Get command and search string $search=$1; # Our search string $cmd=$2; # What should we do with the string SWITCH: { if ($cmd eq "oper"){ IRC::print "*** \002Starting oper search\003\n"; IRC::send_raw("WHO $search o%nuchisrfdt,100\r\n"); last SWITCH; } if ($cmd eq "all"){ IRC::print "*** \002Starting all search\003\n"; IRC::send_raw("WHO $search x%nuchisrfdt,200\r\n"); last SWITCH; } if ($cmd eq "nick"){ IRC::print "*** \002Starting nickname search\003\n"; IRC::send_raw("WHO $search n%nuchisrfdt,300\r\n"); last SWITCH; } if ($cmd eq "user"){ IRC::print "*** \002Starting username search\003\n"; IRC::send_raw("WHO $search u%nuchisrfdt,400\r\n"); last SWITCH; } if ($cmd eq "host"){ IRC::print "*** \002Starting hostname search\003\n"; IRC::send_raw("WHO $search h%nuchisrfdt,500\r\n"); last SWITCH; } if ($cmd eq "ip"){ IRC::print "*** \002Starting ip search\003\n"; IRC::send_raw("WHO $search i%nuchisrfdt,600\r\n"); last SWITCH; } if ($cmd eq "server"){ IRC::print "*** \002Starting server search\003\n"; IRC::send_raw("WHO $search s%nuchisrfdt,700\r\n"); last SWITCH; } if ($cmd eq "info"){ IRC::print "*** \002Starting realname search\003\n"; IRC::send_raw("WHO $search r%nuchisrfdt,800\r\n"); last SWITCH; } IRC::print "Usage: /search \n"; } return 1; } #/who end numeric not used atm as it breaks stuff when joining new channels sub who_end_handler { local($line) = @_; IRC::print "*** \002End of search\003\n"; return 1; } # We dont want to have the standard output from the server numeric so we reformat stuff our own way :) sub ircu_who_handler { local($line) = @_; # :server 352 me chan user addr serv2 nick flag1 flag2: realname # The stuff we want to look for $line =~ m/:(.*) 354 (.+?) (.+?) (.+?) (.+?) (.+?) (.+?) (.+?) (.+?) (.+?) (.+?):(.*)/; $local = $1; # Server we are using $me = $2; # my nick name $id = $3; # search id number $chan = $4; # which chan nick is on $user = $5; # username $ip = $7; # user adress $addr = $7; # user ip $remote = $8; # server person is using $nick = $9; # nickname $flags = $10; # flags $hops = $11; # hops $real = $12; # realname # If you want to change the output format then change it here SWITCH: { if ($id eq "100"){ $idtext="Oper"; $result = sprintf("%-15s : %-15s : %-15s : %s", $nick, $chan, $flags ,$addr); last SWITCH; } if ($id eq "200"){ $idtext="All"; $result = sprintf("%-15s : %-15s : %s", $nick, $chan, $addr); last SWITCH; } if ($id eq "300"){ $idtext="Nick"; $result = sprintf("%-15s : %-15s : %s", $nick, $chan, $addr); last SWITCH; } if ($id eq "400"){ $idtext="User"; $result = sprintf("%-15s : %-15s : %-15s : %s", $nick, $user ,$chan, $addr); last SWITCH; } if ($id eq "500"){ $idtext="Host"; $result = sprintf("%-15s : %-15s : %s", $nick, $chan, $addr); last SWITCH; } if ($id eq "600"){ $idtext="Ip"; $result = sprintf("%-15s : %-15s : %s", $nick, $chan, $ip); last SWITCH; } if ($id eq "700"){ $idtext="Server"; $result = sprintf("%-15s : %-15s : %-15s : %s", $nick, $chan, $addr, $remote); last SWITCH; } if ($id eq "800"){ $idtext="Info"; $result = sprintf("%-15s : %-15s : %-15s : %s", $nick, $chan, $addr, $real); last SWITCH; } } IRC::print "-$idtext search- $result\n"; # Here we print the final stuff :) return 1; } 1; _END_