Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: damien.bezborodow [...] valex.com.au
Cc:
AdminCc:

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



MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=
content-type: text/plain; charset="utf-8"; format="flowed"
Message-ID: <4A0BC2F5.4080202 [...] valex.com.au>
X-Virus-Scanned: Debian amavisd-new at megawhogg.com.au
Organization: Valuaton Exchange - IT
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id 82B2523C10B for <bug-POE-Component-IRC [...] rt.cpan.org>; Thu, 14 May 2009 03:06:50 -0400 (EDT)
Received: (qmail 5376 invoked by uid 103); 14 May 2009 07:06:49 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 14 May 2009 07:06:49 -0000
Received: from mail.valuationexchange.com.au (HELO mail1.valuationexchange.com.au) (203.63.223.135) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 14 May 2009 00:06:42 -0700
Received: from localhost (localhost [127.0.0.1]) by mail1.valuationexchange.com.au (Postfix) with ESMTP id E88E9A72BE2 for <bug-POE-Component-IRC [...] rt.cpan.org>; Thu, 14 May 2009 16:36:36 +0930 (CST)
Received: from mail1.valuationexchange.com.au ([127.0.0.1]) by localhost (mail1.valuationexchange.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4yKjt8p1iygu for <bug-POE-Component-IRC [...] rt.cpan.org>; Thu, 14 May 2009 16:36:33 +0930 (CST)
Received: by mail1.valuationexchange.com.au (Postfix, from userid 5000) id 58BCAA72CAF; Thu, 14 May 2009 16:36:33 +0930 (CST)
Received: from [172.16.15.254] (unknown [203.63.223.130]) by mail1.valuationexchange.com.au (Postfix) with ESMTP id 49611A72BE2 for <bug-POE-Component-IRC [...] rt.cpan.org>; Thu, 14 May 2009 16:36:30 +0930 (CST)
Delivered-To: cpan-bug+POE-Component-IRC [...] diesel.bestpractical.com
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
Subject: POE::Component::IRC::Plugin::BotCommand does not respond as documented
Return-Path: <damien.bezborodow [...] valex.com.au>
X-Original-To: bug-POE-Component-IRC [...] rt.cpan.org
X-Spam-Check-BY: 16.mx.develooper.com
Date: Thu, 14 May 2009 16:36:29 +0930
X-Spam-Level: *
To: bug-POE-Component-IRC [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Damien Bezborodov <damien.bezborodow [...] valex.com.au>
X-RT-Original-Encoding: ISO-8859-1
Content-Length: 2709
Download (untitled) / with headers
text/plain 2.6k
*Steps:* 1. Use the example script provided on CPAN documentation, any OS, version 6.06. *Expect:* (4:17:44 PM) dbezborodov: vxTEST: test (4:17:45 PM) vxTEST: (notice) Unknown command: test (4:17:45 PM) vxTEST: (notice) To get a list of commands, do: /msg vxTEST help (4:23:17 PM) dbezborodov: vxTEST: help (4:23:18 PM) vxTEST: (notice) Commands: slap, lookup (4:23:19 PM) vxTEST: (notice) You can do: /msg vxTEST help <command> (4:18:11 PM) dbezborodov: vxTEST: help lookup (4:18:12 PM) vxTEST: (notice) Takes two arguments: a record type (optional), and a host. (4:19:16 PM) dbezborodov: vxTEST: help test (4:19:17 PM) vxTEST: (notice) Unknown command: test *Actual:* (3:45:52 PM) dbezborodov: vxTEST: help (3:45:52 PM) vxTEST: (notice) Unknown command: help (3:45:53 PM) vxTEST: (notice) To get a list of commands, do: /msg vxTEST help (3:48:14 PM) dbezborodov: vxTEST: slap dbezborodov (3:48:15 PM) ***vxTEST slaps dbezborodov (3:53:30 PM) dbezborodov: vxTEST: help slap (3:53:32 PM) vxTEST: (notice) Unknown command: help (3:53:33 PM) vxTEST: (notice) To get a list of commands, do: /msg vxTEST help (4:00:55 PM) dbezborodov: vxTEST: test (doesn't respond at all here) *My fix (implemented by overriding methods) is below (although it _will need review_):* package VXBot::BotCommand; use strict; use warnings; use Carp; use POE::Component::IRC::Plugin::BotCommand; use POE::Component::IRC::Common qw( parse_user ); use POE::Component::IRC::Plugin qw( :ALL ); our $VERSION = '6.06'; our @ISA = qw(POE::Component::IRC::Plugin::BotCommand); sub _handle_cmd { my ($self, $who, $where, $cmd, $args) = @_; my $irc = $self->{irc}; $cmd = lc $cmd; if (defined $self->{Commands}->{$cmd}) { $irc->send_event("irc_botcmd_$cmd" => $who, $where, $args); } else { my @help = $self->_get_help($cmd, $args); $irc->yield(notice => $where => $_) for @help; } return 1; } sub _get_help { my ($self, $cmd, $args) = @_; my $irc = $self->{irc}; my @help; if ($cmd eq "help") { if (defined $args) { if (exists $self->{Commands}->{$args}) { @help = split /\015?\012/, $self->{Commands}->{$args}; } else { push @help, "Unknown command: $args"; } } else { push @help, 'Commands: ' . join ', ', keys %{ $self->{Commands} }; push @help, 'You can do: /msg ' . $irc->nick_name() . ' help <command>'; } } else { push @help, "Unknown command: $cmd"; push @help, 'To get a list of commands, do: /msg '. $irc->nick_name() . ' help'; } return @help; } 1; __END__
MIME-Version: 1.0
In-Reply-To: <4A0BC2F5.4080202 [...] valex.com.au>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
References: <4A0BC2F5.4080202 [...] valex.com.au>
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-2324-1242296641-291.46065-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 342
Download (untitled) / with headers
text/plain 342b
You are right about the help command not working. I've fixed it. The fact that it doesn't respond to unknown commands was intentional, but I changed it to print a help message by default now (can be changed with "Handle_unkown => 0" to constructor). http://github.com/bingos/poe-component-irc/commit/b3fa36465da5bcf60540d3020a85f6bf055e6beb


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.