Subject: | CTCP mostly dropped? |
I hope I didn't misunderstand the examples and the docs, but most CTCP
events seem to be dropped. I attached a sample script that is basically
the example in the docs. It is supposed to print out any event it's not
explicitly told to listen to, with the parameters.
What I see is that the only CTCP event that is actually generated is
irc_ctcp_action, none other. For example, if I try to ping ("/PING
ipw2008" in xchat), the message is delivered to the application (I see
it in wireshark), but no event is generated/logged. The same seems to
apply whenever I try some CTCP command, e.g. from xchat:
/CTCP ipw2008 VERSION
/CTCP ipw2008 SOURCE
etc., while this works instead:
/CTCP ipw2008 ACTION shouts
Subject: | ircbot-01.pl |
#!/usr/bin/env perl
use strict;
use warnings;
use English qw( -no_match_vars );
use Log::Log4perl qw( :easy );
Log::Log4perl->easy_init($INFO);
use File::Basename qw( basename );
use POE qw( Component::IRC );
my @canali = ('#ipw2008');
my $irc = POE::Component::IRC->spawn(
alias => 'irc',
nick => 'ipw2008',
ircname => 'Simple Bot for IPW 2008 ' . basename($0),
server => 'irc.freenode.net',
port => 6667,
);
POE::Session->create(
package_states => [main => [qw( _start _default irc_001 irc_public )]],
);
$poe_kernel->run();
sub _start {
my $kernel = $_[KERNEL];
INFO 'mi registro con PoCo::IRC';
$kernel->post(irc => register => 'all');
INFO 'chiedo a PoCo::IRC di connettersi quando possibile';
$kernel->post(irc => connect => {});
return;
} ## end sub _start
sub _default {
my ($event, $args) = @_[ARG0, ARG1];
my @output = ("$event: ");
foreach my $arg (@$args) {
if (ref($arg) eq 'ARRAY') {
push(@output, "[" . join(" ,", @$arg) . "]");
}
else {
push(@output, defined $arg ? "'$arg'" : '<undef>');
}
} ## end foreach my $arg (@$args)
INFO join ' ', @output;
return 0;
} ## end sub _default
sub irc_001 {
my $kernel = $_[KERNEL];
INFO "connesso, mi unisco ai canali: @canali";
$kernel->post(irc => join => $_) for @canali;
return;
} ## end sub irc_001
sub irc_public {
my ($kernel, $chi, $dove, $cosa) = @_[KERNEL, ARG0 .. ARG2];
my $nick = (split /!/, $chi)[0];
my $canale = $dove->[0];
if (my ($testo) = $cosa =~ /\A rot13 \s+ (.+)/mxs) {
$testo =~ tr[a-zA-Z][n-za-mN-ZA-M];
$kernel->post(irc => privmsg => $canale => "$nick: $testo");
}
else {
$kernel->post(irc => privmsg => $canale => 'non capisco...');
}
return;
} ## end sub irc_public
__END__