
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);

$VERSION = "0.2";

%IRSSI = (
    authors     => 'Tom Laermans (SiD3WiNDR), Teemu Koskinen',
    contact     => 'sid3windr@sid3windr.be, teemu.koskinen@mbnet.fi',
    name        => 'raw330',
    description => 'Prints the X/K/Q/... username in right format',
    license     => 'Public Domain',
    url         => 'http://www.codemonkey.be',
);

Irssi::theme_register([whois_auth => '[%Wx%n] authed   : $1']);

sub event_whois_auth {
	my ($server, $data) = @_;
	my ($num, $nick, $auth_nick) = split(/ +/, $_[1], 3);
        $auth_nick =~ s/\:is authed as //;
        $auth_nick =~ s/\:is authed as//;
        $auth_nick =~ s/\:is logged in as//;

	$server->printformat($nick, MSGLEVEL_CRAP, 'whois_auth', $nick, $auth_nick);
	Irssi::signal_stop();
}

Irssi::signal_add('event 330', 'event_whois_auth');
