Skip Menu |
 

This queue is for tickets about the POE-Component-IRC CPAN distribution.

Report information
The Basics
Id: 37827
Status: resolved
Priority: 0/
Queue: POE-Component-IRC

People
Owner: Nobody in particular
Requestors: polettix [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.84
Fixed in: (no value)



Subject: CTCP mostly dropped?
Download (untitled) / with headers
text/plain 712b
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
Download ircbot-01.pl
text/x-perl 1.7k
#!/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__
Will be fixed in the next release. Thanks. I attached the patched in case you're impatient.
Download ctcp.diff
text/x-diff 1.8k
Index: lib/POE/Component/IRC.pm =================================================================== --- lib/POE/Component/IRC.pm (revision 701) +++ lib/POE/Component/IRC.pm (working copy) @@ -2492,8 +2492,9 @@ event, CTCP ACTION (produced by typing "/me" in most IRC clients) generates an C<irc_ctcp_action> event, blah blah, so on and so forth. ARG0 is the nick!hostmask of the sender. ARG1 is the channel/recipient -name(s). ARG2 is the text of the CTCP message. On FreeNode there is also -ARG3, which will be 1 if the sender has identified with NickServ, 0 otherwise. +name(s). ARG2 is the text of the CTCP message. On servers supporting the +CAPAB IDENTIFY-MSG feature (e.g. FreeNode), CTCP ACTIONs will have ARG3, +which will be 1 if the sender has identified with NickServ, 0 otherwise. Note that DCCs are handled separately -- see the L<DCC plugin|POE::Component::IRC::Plugin::DCC>. Index: lib/POE/Filter/IRC/Compat.pm =================================================================== --- lib/POE/Filter/IRC/Compat.pm (revision 701) +++ lib/POE/Filter/IRC/Compat.pm (working copy) @@ -289,8 +289,9 @@ # Is this a CTCP request or reply? $type = $type eq 'PRIVMSG' ? 'ctcp' : 'ctcpreply'; + # CAPAP IDENTIFY-MSG is only applied to ACTIONs my $identified; - ($msg, $identified) = _split_idmsg($msg) if $self->{identifymsg}; + ($msg, $identified) = _split_idmsg($msg) if $self->{identifymsg} && $msg =~ /.ACTION/; my ($ctcp, $text) = _ctcp_dequote($msg); my $nick = (split /!/, $who)[0]; @@ -342,7 +343,7 @@ $who, [split /,/, $where], (defined $args ? $args : ''), - ($self->{identifymsg} ? $identified : () ), + (defined $identified ? $identified : () ), ], raw_line => $line, };


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.