#!/usr/bin/perl -w
#
# Copyright 2005, Karl Y. Pradene <knotty@cpan.org> All rights reserved.
#
# Dumb Bot for test Net::IRC2

use Net::IRC2;

use strict; 
use warnings;
$| = 1;

sub p($) { print "@_\n" }


my $bot = new Net::IRC2;

my $conn = $bot->newconn(uri=>'irc://B1-66ER!void@irc.webservor.org:6667/') || die 'No Connection';
$conn->mode($conn->nick,'+B');
my $sock = $conn->socket;

#$bot->callback(\&process_event);
$bot->add_handler(['002'..'999'], \&dump_event);
$bot->add_handler(['372'], sub { } );
$bot->add_handler(['002','003'], \&dump_event);
$bot->add_handler(['376'],\&end_of_motd);
$bot->start;

sub dump_event { 
    $_[1]->dump;
}
sub end_of_motd {
    $conn->join('#Perl');
    $conn->privmsg('#Perl', 'knotty: tu peux release Net::IRC2 v 0.05');
}
sub Net::IRC2::Connection::cb001{ $_[1]->dump }
exit 0;


