create a new file called onge_init.pl and place it in .xchat2/
PLEASE NOTE YOU NEED TO BE A IRC Operator for this script to work otherwise it's useless!!!!
*Note .xchat2 is the UNIX/Linux directory hosted in your home directory.Code:#/#############################################################################\ ## Ongeboren's script collection # ## Copyright (C) 2002 - 2005 ongeboren <ongeboren@gmail.com> # ## Version: 2.1 # ## Requires: XChat 2.0.8+ # ## Distributed under the GPL license # #\#############################################################################/ Xchat::register( "Ongeboren's script collection" , "2.1" , "Set of scripts for better messages filtering" ); Xchat::print( "\0033Loading ongeboren's script collection..\003\n" ); my $onge_path = Xchat::get_info("xchatdir") . "/onge/"; require("$onge_path/onge_settings.pl"); require("$onge_path/onge_hooks.pl"); require("$onge_path/onge_single.pl"); require("$onge_path/onge_misc.pl"); require("$onge_path/onge_wallops.pl"); require("$onge_path/onge_basic_operator.pl"); require("$onge_path/onge_advanced_operator.pl"); Xchat::print( "\0033Script collection : loaded\003\n" );
Now make a directory in .xchat2 called onge and add this file to the directory, call this ong_basic_operator.pl
now add this into the .xchat2/onge directory and call this one onge_hooks.plCode:#/#############################################################################\ ## Ongeboren's script collection # ## Copyright (C) 2002 - 2005 ongeboren <ongeboren@gmail.com> # ## Version: 2.1 # ## Requires: XChat 2.0.8+ # ## Distributed under the GPL license # #\#############################################################################/ sub onge_oper_connected { my $me = Xchat::get_info ( "nick" ); my $serv = lc( Xchat::get_info ( "server" ) ); Xchat::command("MODE $me +w"); foreach $oserv (@onge_oper_serv) { if (lc($oserv) eq $serv) { Xchat::command("OPER $onge_oper_nick $onge_oper_pass"); last; } } return Xchat::EAT_NONE; } sub onge_oper_opered { my $me = Xchat::get_info ( "nick" ); Xchat::command("MODE $me $onge_oper_mode"); return Xchat::EAT_NONE; } Xchat::print( "\0033 Basic IRC-operator : loaded\003\n" ); 1;
add this one to .xchat2/onge as well and name this one onge_single.plCode:#/#############################################################################\ ## Ongeboren's script collection - Hooks # ## Copyright (C) 2002 - 2005 ongeboren <ongeboren@gmail.com> # ## Version: 2.1 # ## Requires: XChat 2.0.8+ # ## Distributed under the GPL license # #\#############################################################################/ if ( $onge_set_single ) { Xchat::hook_server( "NOTICE" , onge_single_window ); Xchat::hook_server( "PRIVMSG" , onge_single_window ); } if ( $onge_set_wallops ) { Xchat::hook_server( "WALLOPS", onge_parse_wallops_output ); Xchat::hook_command( "", onge_parse_wallops_input ); Xchat::hook_command( "o", onge_comm_o ); Xchat::hook_command( "l", onge_comm_l ); } if ( $onge_set_oper ) { Xchat::hook_server( "001", onge_oper_connected ); Xchat::hook_server( "381", onge_oper_opered ); } if ( $onge_set_snotice ) { Xchat::hook_server( "NOTICE", onge_filter_server_notices ); } Xchat::print( "\0033 Hooks : loaded\003\n" ); 1;
same go's with this one you need to put it in .xchat2/onge and name this one onge_misc.plCode:#/#############################################################################\ ## Ongeboren's script collection - Single Window # ## Copyright (C) 2002 - 2005 ongeboren <ongeboren@gmail.com> # ## Version: 2.1 # ## Requires: XChat 2.0.8+ # ## Distributed under the GPL license # #\#############################################################################/ sub onge_single_window { my $me = Xchat::get_info ( "nick" ); my $serv = Xchat::get_info ( "server" ); my $dest = $_[0][2]; my $srce = $_[0][0]; $srce =~ /:(\S+)!/; my $vict = $1; return Xchat::EAT_NONE if ( lc($dest) ne lc($me) ); return Xchat::EAT_NONE if ( $srce !~ /!/ ); return Xchat::EAT_NONE if ( substr($_[1][3], 0, 5) eq ":\001DCC" ); if ( !Xchat::find_context($vict, $serv) ) { foreach my $nick (@onge_single_bypass) { if (lc($nick) eq lc($vict)) { if ( $onge_query_on_bypass ) { Xchat::command( "QUERY $nick" , undef, $serv); } return Xchat::EAT_NONE; } } onge_misc_emit_print( $onge_tabs_all, $serv, $vict, substr($_[1][3], 1) ); if ( $onge_whois_on_private > 1) { onge_misc_try_whois ( $vict, $me, $serv, 1 ); } elsif ( $onge_whois_on_private > 0) { onge_misc_try_whois ( $vict, $me, $serv, 0 ); } return Xchat::EAT_ALL; } return Xchat::EAT_NONE; } Xchat::print( "\0033 Single Window : loaded\003\n" ); 1;
also put this one in .xchat2/onge and call this one onge_wallops.plCode:#/#############################################################################\ ## Ongeboren's script collection - Miscelaneous functions # ## Copyright (C) 2002 - 2005 ongeboren <ongeboren@gmail.com> # ## Version: 2.1 # ## Requires: XChat 2.0.8+ # ## Distributed under the GPL license # #\#############################################################################/ our $onge_whois_time = time() + 10; sub onge_misc_can_whois { if ( $onge_whois_time + $onge_whois_interval < time() ) { $onge_whois_time = time(); return 1; } return 0; } sub onge_misc_try_whois { my ($vict, $me, $serv, $remote) = @_; if ( onge_misc_can_whois() && lc($vict) ne lc($me) ) { if ($remote) { Xchat::command( "WHOIS $vict $vict" , undef, $serv ); } else { Xchat::command( "WHOIS $vict" , undef, $serv ); } } } # The following function was kindly given to me by Khisanth on #xchat@freenode sub onge_nick_color { my @colors = ( 19, 20, 22, 24, 25, 26, 27, 28, 29 ); my $sum; $sum += ord($_) for split //, shift; return $colors[$sum%@colors]; } sub onge_misc_emit_print { my ($tab, $serv, $vict, $txt) = @_; Xchat::command( "QUERY $tab" , undef, $serv); Xchat::set_context( Xchat::find_context($tab, $serv) ); Xchat::emit_print("Channel Message", ("\003". onge_nick_color($vict) . $vict . "\003", $txt, "", "") ); } Xchat::print( "\0033 Misc functions : loaded\003\n" ); 1;
Code:#/#############################################################################\ ## Ongeboren's script collection - Wallops # ## Copyright (C) 2002 - 2005 ongeboren <ongeboren@gmail.com> # ## Version: 2.1 # ## Requires: XChat 2.0.8+ # ## Distributed under the GPL license # #\#############################################################################/ sub onge_comm_o { if (length($_[1][1]) > 0) { Xchat::command( "OPERWALL :$_[1][1]" ); } else { $onge_use_operwall = 1; Xchat::print("Using OPERWALL from now on\n"); } return Xchat::EAT_ALL; } sub onge_comm_l { if (length($_[1][1]) > 0) { Xchat::command( "LOCOPS :$_[1][1]" ); } else { $onge_use_operwall = 0; Xchat::print("Using LOCOPS from now on\n"); } return Xchat::EAT_ALL; } sub onge_parse_wallops_input { my $serv = Xchat::get_info ( "server" ); if ( Xchat::find_context() == Xchat::find_context($onge_tabs_wall, $serv) ) { if ($onge_use_operwall) { Xchat::command("OPERWALL :$_[1][0]"); } else { Xchat::command("LOCOPS :$_[1][0]"); } return Xchat::EAT_ALL; } } sub onge_parse_wallops_output { my $srce = $_[0][0]; $srce =~ /:(\S+)!/; if ($1) { $srce = $1; } my $serv = Xchat::get_info ( "server" ); if ($_[0][2] eq ":LOCOPS") { onge_misc_emit_print ( $onge_tabs_wall, $serv, $srce, "\002\0037LOCOPS\003\002 $_[1][4]" ); } elsif ($_[0][2] eq ":SLOCOPS") { onge_misc_emit_print ( $onge_tabs_wall, $serv, $srce, "\002\0037SLOCOPS\003\002 $_[1][4]" ); } elsif ($_[0][2] eq ":WALLOPS") { onge_misc_emit_print ( $onge_tabs_wall, $serv, $srce, "\002WALLOPS\002 \0034$_[1][4]\003" ); } elsif ($_[0][2] eq ":OPERWALL") { onge_misc_emit_print ( $onge_tabs_wall, $serv, $srce, "\002\0033OPERWALL\003\002 $_[1][4]" ); } else { my $txt = substr ($_[1][2], 1); $srce = substr($srce, 1); onge_misc_emit_print ( $onge_tabs_wall, $serv, $srce, "\002WALLOPS\002 \0034$txt\003" ); } return Xchat::EAT_ALL; } Xchat::print( "\0033 Wallops : loaded\003\n" ); 1;also put this one in .xchat2/onge and call this one onge_advanced_operator.pl
Code:#/#############################################################################\ ## Ongeboren's script collection # ## Copyright (C) 2002 - 2005 ongeboren <ongeboren@gmail.com> # ## Version: 2.1 # ## Requires: XChat 2.0.8+ # ## Distributed under the GPL license # #\#############################################################################/ sub onge_filter_server_notices { my $me = Xchat::get_info ( "nick" ); my $serv = lc( Xchat::get_info ( "server" ) ); return Xchat::EAT_NONE if ( lc($_[0][0]) ne lc(":$serv") ); if ( $_[1][6] =~ /^Client connecting: (\S+) \((\S+)\@(\S+)\) \[(\S+)\]/ ) { return onge_filter_process_conn ($1, $2, $3, $4, $_[1][6], $me, $serv); } elsif ( $_[1][6] =~ /^Client exiting: (\S+) \((\S+)\@(\S+)\) \[(.*)\] \[(\S+)\]$/ ) { return onge_filter_process_exit ($1, $2, $3, $5, $4, $_[1][6], $me, $serv); } elsif ( $_[1][6] =~ /^I.line is full for (\S+)\[(\S+)\@(\S+)\] \((\S+)\)/ ) { return onge_filter_process_ifull ($1, $2, $3, $4, $_[1][6], $me, $serv); } elsif ( $_[1][6] =~ /^User (\S+) \((\S+)\@(\S+)\).*is a possible spambot/ ) { return onge_filter_process_spambot ($1, $2, $3, $_[1][6], $me, $serv); } elsif ( $_[1][6] =~ /^(\S+) \((\S+)\@(\S+)\) is doing a .whois on you/ ) { return onge_filter_process_whois ($1, $2, $3, $_[1][6], $me, $serv); } elsif ( $_[1][6] =~ /(\S+!\S+\@\S+) on (\S+) is requesting gline for \[(\S+)\] \[(.*)\]\s*$/ ) { return onge_filter_gline_requests ($1, $2, $3, $4, $_[1][6], $me, $serv); } elsif ( $_[1][6] =~ /(\S+!\S+\@\S+) on (\S+) has triggered gline for \[(\S+)\] \[(.*)\]\s*$/ ) { return onge_filter_gline_trigger ($1, $2, $3, $4, $_[1][6], $me, $serv); } elsif ( $_[1][6] eq "oper or server has already voted" ) { return onge_filter_already_voted (); } elsif ( $_[1][6] =~ /(\S+) added temporary (\d+) min. K-Line for \[(.*)\] \[(.*)\]$/ ) { return onge_filter_klines ($1, $2, $3, $4, $_[1][6], $me, $serv); } } sub onge_filter_klines { my ($n, $t, $h, $r, $mm, $me, $serv) = @_; onge_print ( $serv, $onge_tabs_kline, "$n\t($t min): $h [$r]", undef ); return Xchat::EAT_ALL; } sub onge_filter_already_voted { if ( $onge_hide_voted ) { $onge_hide_voted++; return Xchat::EAT_ALL; } return Xchat::EAT_NONE; } sub onge_print { my ($serv, $tab, $text, $color) = @_; if ($tab) { Xchat::command( "QUERY $tab" , undef, $serv); Xchat::set_context( Xchat::find_context($tab, $serv) ); } Xchat::print( "\003$color$text\003\n" ); } sub onge_filter_gline_trigger { my ($who, $wserv, $gline, $greason, $mm, $me, $serv) = @_; my $n = ""; if( exists( $gliners_ign{ lc($wserv) } ) ) { $who =~ /(\S+)!/; if ($1) { $n = substr($1, 0, 3); } onge_print ( $serv, $onge_tabs_gline, "trigger:$n\t$gline \"$greason\"", 4 ); } else { onge_print ( $serv, $onge_tabs_req, "$who\ttrigger: $gline \"$greason\"", 4 ); } return Xchat::EAT_ALL; } sub onge_filter_gline_requests { my ($who, $wserv, $gline, $greason, $mm, $me, $serv) = @_; my $n = ""; return Xchat::EAT_ALL if ( exists( $gliners_ign{ lc($wserv) } ) ); if( exists( $gliners{ $wserv } ) ) { $who =~ /(\S+)!/; if ($1) { $n = substr($1, 0, 3); } onge_print ( $serv, $onge_tabs_gline, "req:$n\t$gline \"$greason\"", $gliners{ $wserv } ); } else { if ($gline =~ /(\S+)\@(\S+)/) { onge_print ( $serv, $onge_tabs_req, "$who\t$1\002\@\002$2 \"$greason\" /gline $gline $greason", undef ); } else { onge_print ( $serv, $onge_tabs_req, "$who\t$gline \"$greason\" /gline $gline $greason", undef ); } } return Xchat::EAT_ALL; } sub onge_filter_process_conn { my ($n, $id, $h, $ip, $mm, $me, $serv) = @_; onge_print( $serv, $onge_tabs_conn, "conn\t$n $id\002\@\002$h ($ip)", $onge_color_conn); return Xchat::EAT_ALL; } sub onge_filter_process_exit { my ($n, $id, $h, $ip, $rr, $mm, $me, $serv) = @_; if ( $onge_exit_apart ) { onge_print( $serv, $onge_tabs_exit, "exit\t$n $id\002\@\002$h ($ip)", $onge_color_exit); } else { onge_print( $serv, $onge_tabs_conn, "exit\t$n $id\002\@\002$h ($ip) $rr", $onge_color_exit); } return Xchat::EAT_ALL; } sub onge_filter_process_ifull { my ($n, $id, $h, $ip, $mm, $me, $serv) = @_; if ( $onge_kline_ifull ) { Xchat::command ("KLINE $onge_ktime_ifull *\@$h possible flood bots" ); onge_print( $serv, undef, "info\tk:lined *\002\@\002$h - I-line was full", $onge_color_info ); return Xchat::EAT_NONE; } return Xchat::EAT_NONE; } sub onge_filter_process_spambot { my ($n, $id, $h, $mm, $me, $serv) = @_; if ( $onge_kline_spam ) { Xchat::command ("KLINE $onge_ktime_spam $id\@$h possible spam bots" ); onge_print( $serv, undef, "info\tk:lined $id\002\@\002$h - spambot", $onge_color_info ); return Xchat::EAT_NONE; } return Xchat::EAT_NONE; } sub onge_filter_process_whois { my ($n, $id, $h, $mm, $me, $serv) = @_; if ( $onge_whois_on_whois > 1 ) { onge_misc_try_whois ( $n, $me, $serv, 1 ); onge_print( $serv, undef, "info\treceived a /whois from $n $id\002\@\002$h", $onge_color_info ); return Xchat::EAT_ALL; } elsif ( $onge_whois_on_whois > 0 ) { onge_misc_try_whois ( $n, $me, $serv, 0 ); onge_print( $serv, undef, "info\treceived a /whois from $n $id\002\@\002$h", $onge_color_info ); return Xchat::EAT_ALL; } return Xchat::EAT_NONE; } sub onge_oper_advanced_init { foreach my $e ( @gliners_to_ignore ) { $gliners_ign{ lc($e) } = 1; } } onge_oper_advanced_init(); Xchat::print( "\0033 Advanced IRC-operator : loaded\003\n" ); 1;
and lastly put this one in .xchat2/onge and call this one onge_settings.pl
Code:#/#############################################################################\ ## Ongeboren's script collection - Settings # ## Copyright (C) 2002 - 2005 ongeboren <ongeboren@gmail.com> # ## Version: 2.1 # ## Requires: XChat 2.0.8+ # ## Distributed under the GPL license # #\#############################################################################/ ### # This is the configuration part of ongeboren's script collection. # Each option is explained, but turned off by default. # Failure to read the config, understand it and set it to work for you, # will simply make the whole script collection useless. # # There is a name convention for the script. All functions and variables # begin with a prepended 'onge_'. This way you are guaranteed to avoid # confusion with any other scripts. # # The use of other scripts that process and filter inbound privmsg and notices # in case you're going to use the single message window mode or the total # ignorer, can be the cause of confusion and could lead to messages being # wrongly blocked at the wrong time. # ### ################################################################################ # Single Message Window ### ### # Use single message window for personal inbound notices and privmsgs if there # is no window/tab opened for a conversation with the person in question. our $onge_set_single = 0; ### # The tab where all private inbound messages will be redirected. # This option is only applicable if $onge_set_single is set to non zero value. # Note: Always prepend a '-' or other character a nickname may never start with. # If you choose a name for the tab that can coincide with a real nickname, # you will run into confusion if you will ever have to speak to that person! our $onge_tabs_all = "-all"; ### # Do a /whois nick or /whois nick nick when you receive a private message out # of conversation mode - only triggers if there is no conversation window/tab. # This option is only applicable if $onge_set_single is set to non zero value. # The possible values are as follows: # 1 -> do a /whois nick # 2 -> do a /whois nick nick our $onge_whois_on_private = 1; ### # How many seconds to wait if you have issued a /whois command, before issueing # a new one? The minimum value is hardcoded to 1 and it is advised to have it # set to about 5. This will prevent /whois floods on multiple lines dumped to # you like for instance the output of help commands originating of irc services # you're querying for help. Keep it reasonable high in order to prevent other # /whois floods in case you receive a multiple clones flood attack or run into # somebody having same or similar script to yours. our $onge_whois_interval = 5; ### # You may aswel define a list of nicks that will be allowed to bypass the single # message window. Follow the example syntaxis. # This option is only applicable if $onge_set_single is set to non zero value. our @onge_single_bypass = ('ns', 'cs', 'gliner', 'seenserv', 'seen'); ### # Additionally you may want to explicitely create a query dialogue for the nicks # you specified in @onge_single_bypass. By default XChat displays private # notices in the first common tab you have with a given person. This is quite # annoying if you request information from ChanServ for instance via /msg # ChanServ in the current tab and you have to run through all other tabs in # order to find the reply. # This option is only applicable if $onge_set_single is set to non zero value. our $onge_query_on_bypass = 1; ################################################################################ # Basic Operator Settings ### ### # Are you an irc operator? You can define here to auto-/oper on as many servers # as you like. You need to have the same password on each server. $onge_set_oper = 0; ### # The operator nickname or username - furst parameter of the /oper command. $onge_oper_nick = "opernick"; ### # The password. # Note that your computer must be secure. It is obviously stored as plain text. $onge_oper_pass = "operpass"; ### # Specify operator-specific user modes that you would like to set after you get # /oper-ed . $onge_oper_mode = "+ybfxcIS"; ### # Make a list of all servers where you would like to issue an /oper command when # connecting. @onge_oper_serv = ("my.irc.server"); ################################################################################ # Fancy Wallops Interface ### ### # Use fancy wallops input/output? our $onge_set_wallops = 0; ### # The name of the wallops tab. # Same considerations as the '-all' tab. Prepend a non-valid character like '-'. our $onge_tabs_wall = "-wall"; ### # Use by default operwall (1) or locops (0) ? # Beter keep it local, unless you don't care about saying incidentially or # unwillingly something stupid to a bunch of people. our $onge_use_operwall = 0; ################################################################################ # Services G:lines Requests Filter ### ################################################################################ # Normal G:line Requesrs Filter ### ################################################################################ # Server Warning/Information Notices Filter ### ### # Enable advanced server notices filter? our $onge_set_snotice = 0; ### # The name of the connecting/disconnecting tab. # Same considerations as the "-all' tab. Prepend a non-valid character like '-'. our $onge_tabs_conn = "-conn"; ### # Use a different tab for disconnecting client notices? our $onge_exit_apart = 0; ### # The name of the disconnecting tab. # Applicable only if $onge_disconn_apart is non-zero. # Same considerations as the "-all' tab. Prepend a non-valid character like '-'. our $onge_tabs_disc = "-exit"; ### # Color for connecting users' notices. our $onge_color_conn = 3; ### # Color for exiting users' notices. our $onge_color_exit = 4; ### # K:line hosts, that fill up an I-line ? our $onge_kline_ifull = 1; ### # Time for the k:line in minutes if $onge_kline_ifull is defined. our $onge_ktime_ifull = 120; ### # K:line ident@host, that trigger a spambot warning ? our $onge_kline_spam = 1; ### # Time for the k:line in minutes if $onge_kline_spam id defined. our $onge_ktime_spam = 120; ### # Name of the klines tab. # Same considerations as the "-all' tab. Prepend a non-valid character like '-'. our $onge_tabs_kline = "-kli"; ### # Do a /whois nick or /whois nick nick when you receive a /whois. # The possible values are as follows: # 1 -> do a /whois nick # 2 -> do a /whois nick nick our $onge_whois_on_whois = 2; ### # The name of the services glines requests tab. # Same considerations as the "-all' tab. Prepend a non-valid character like '-'. our $onge_tabs_gline = "-gli"; ### # List of gliners servers to ignore. # Usually there are 3 psuedo servers for a gliner service. Define here the last # 2 servers. The third one will not be ignored, or you may choose to ignore # them all, but this is imho a bad choice. our @gliners_to_ignore = ( "SAN2.org", "SAN3.org", "sockscleaner2.org", "sockscleaner3.org", "psuedo2.org", "psuedo3.org" ); ### # Define pairs of gliners and mirc colors to display in $onge_tabs_gline # This is CAsEsEnSitIVe! # This must be the first server in the gliners servers trio. our %gliners = ( "SAN1.org" => 10, "sockscleaner1.org" => 7, "psuedo1.org" => 8,); ### # The name of the operators glines requests tab. # Same considerations as the "-all' tab. Prepend a non-valid character like '-'. our $onge_tabs_req = "-req"; ### # Hide "operator or server has already voted" messages for gline requests that # do match an existing gline on your server. This happens when another server # on the network rehashes its glines in order to let viruses, drones and # abusers into the network # NB: If you intend to hide it, set it's value to just 1; you will be able to # see how many such lines were hidden by issuing /showhiddenvotes . our $onge_hide_voted = 1; ################################################################################ # Miscelaneous Settings ### ### # Color for info lines. our $onge_color_info = 8; Xchat::print( "\0033 Settings : loaded\003\n" ); 1;