#!/usr/bin/perl # # NSidentify.pl # # Created by Jim Seymour (jseymour@LinxNet.com) from suggestion/example # code by Woody Green # # Currently knows how to do DALnet and openprojects.net. Handles # multiple nicks, with different passwords for each (if you want) per # network. # # Drop it in your ~/.xchat directory as NSidentify.pl, fixup the nicks # and passwords (in %authTable, below) and re-start x-chat. # # If you have trouble with it, you can probably get help at # http://www.xchat.org package NSidentify; # Play in our own backyard # # IRC network -> nick -> password lookup # Format: 'arbitrary network name' => # 'nick' => 'password' # 'nick' => 'password' # 'nick' => 'password' # etc. # Note: entries are case-sensitive! # my %authTable = ( 'DALnet' => { 'somenick' => 'apassword', 'anothernick' => 'apassword', 'thirdnick' => 'differentpw', }, 'OPN' => { 'yournick' => 'yourpassword', 'guesswhat' => 'youknow', }, ); # Tell Xchat who we are ( name, version, closeoutfunction, "" ) # closeoutfunction is optional (good place for cleaning up and # writing config files if needed) IRC::register( "NSidentify", "0.0.1", "", "" ); # Listen for NOTICEs, pass them on to our notice function/sub # Xchat looks in main:: by default, so we explicitly declare # where our sub is since we used the package command above. IRC::add_message_handler( "NOTICE", "NSidentify::handler_message_notice" ); sub handler_message_notice ( ) { my ( $sender, $notice ) = ( $_[0] =~ /^:(.*?)\s.*?:(.*)$/ ); my $server = IRC::get_info( 3 ); my $nick = IRC::get_info( 1 ); # Make sure were talking to the real nickserv on a dal.net server # The msg test tells us it's time to send the password if ( ( $sender =~ /^NickServ!service\@dal\.net$/o ) && ( $server =~ /\.dal.net$/oi ) ) { if ( $notice =~ /^This nick is owned by someone else\.\s+Please choose another\.$/o ) { my $nl = $authTable{'DALnet'}; foreach my $ne (keys %{$nl}) { if($nick eq $ne) { IRC::send_raw( "IDENTIFY ${$nl}{$ne}\r\n" ); } } } # Openprojects.net? } elsif ( ( $sender =~ /^NickServ!NickServ\@services\.$/o ) && ( $server =~ /\.openprojects\.net$/oi ) ) { if ( $notice =~ /^This nickname is owned by someone else$/o ) { my $nl = $authTable{'OPN'}; foreach my $ne (keys %{$nl}) { if($nick eq $ne) { IRC::command_with_server("/msg NickServ IDENTIFY ${$nl}{$ne}", $server); } } } } return 0; # Let xchat continue processing this NOTICE }