Around OHM2013 I started using Xchat again to manage all the IRC networks I have to be on.
Pidgin simply could not do the job.

However I have to constantly authenticate my self against services. Unfortunately I have lost my ns-authenticate.pl plugin so I wrote a new one :)

#!/usr/bin/perl
use strict;
use warnings;

Xchat::register('NS Identify', '0.2', 'Identify against NickServ');
Xchat::hook_server( 'Notice', \&ns_identify );
Xchat::hook_print( 'Message Send', \&hide_nickserv ); 

my %pass = (
    'UniBG' => '',
    'FreeNode' => '',
    'OFTC' => ''
);

# Catch the notices from services and send passwords
sub ns_identify {
    return Xchat::EAT_NONE if !defined($_[0]);
    if ($_[0][0] =~ /^:NS!NickServ\@UniBG/ && $_[0][3] =~ /^:This/) {
        Xchat::command("msg NS identify $pass{'UniBG'}");
        return Xchat::EAT_NONE;
    }
    if ($_[0][0] =~ /^:NickServ!NickServ\@services./ && $_[0][3] =~ /^:This/) {
        Xchat::command("msg NickServ identify $pass{'FreeNode'}");
        return Xchat::EAT_NONE;
    }
    return Xchat::EAT_NONE;
}

# Catch the messages to NS and NickServ and do not show them in the windows and logs.
sub hide_nickserv {
    if (defined($_[0])) {
        if ($_[0][0] eq 'NS' || $_[0][0] =~ /NickServ/) {
            return Xchat::EAT_ALL;
        }
    }
    return Xchat::EAT_NONE;
}

Comments are closed.

Posted by HackMan
Dated: 9th August 2013
Filled Under: Uncategorized