From 78f9fb377a4150692f3def291d7402da739d5357 Mon Sep 17 00:00:00 2001 From: Chris Williams Date: Mon, 27 May 2013 09:43:25 +0000 Subject: [PATCH] Import of BINGOS/POE-Component-IRC-6.83 from CPAN. gitpan-cpan-distribution: POE-Component-IRC gitpan-cpan-version: 6.83 gitpan-cpan-path: BINGOS/POE-Component-IRC-6.83.tar.gz gitpan-cpan-author: BINGOS gitpan-cpan-maturity: released --- Changes | 9 + META.json | 4 +- META.yml | 4 +- Makefile.PL | 24 +- README | 11 + lib/POE/Component/IRC.pm | 31 ++- lib/POE/Component/IRC/Common.pm | 2 +- lib/POE/Component/IRC/Constants.pm | 2 +- lib/POE/Component/IRC/Plugin.pm | 2 +- lib/POE/Component/IRC/Plugin/AutoJoin.pm | 2 +- lib/POE/Component/IRC/Plugin/BotAddressed.pm | 2 +- lib/POE/Component/IRC/Plugin/BotCommand.pm | 227 +++++++++++++++---- lib/POE/Component/IRC/Plugin/BotTraffic.pm | 2 +- lib/POE/Component/IRC/Plugin/CTCP.pm | 2 +- lib/POE/Component/IRC/Plugin/Connector.pm | 2 +- lib/POE/Component/IRC/Plugin/Console.pm | 2 +- lib/POE/Component/IRC/Plugin/CycleEmpty.pm | 2 +- lib/POE/Component/IRC/Plugin/DCC.pm | 2 +- lib/POE/Component/IRC/Plugin/FollowTail.pm | 2 +- lib/POE/Component/IRC/Plugin/ISupport.pm | 2 +- lib/POE/Component/IRC/Plugin/Logger.pm | 2 +- lib/POE/Component/IRC/Plugin/NickReclaim.pm | 2 +- lib/POE/Component/IRC/Plugin/NickServID.pm | 14 +- lib/POE/Component/IRC/Plugin/PlugMan.pm | 2 +- lib/POE/Component/IRC/Plugin/Proxy.pm | 2 +- lib/POE/Component/IRC/Plugin/Whois.pm | 2 +- lib/POE/Component/IRC/Qnet.pm | 2 +- lib/POE/Component/IRC/Qnet/State.pm | 2 +- lib/POE/Component/IRC/State.pm | 2 +- lib/POE/Filter/IRC.pm | 2 +- lib/POE/Filter/IRC/Compat.pm | 2 +- 31 files changed, 285 insertions(+), 85 deletions(-) diff --git a/Changes b/Changes index fb48417..515993b 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,14 @@ Revision history for Perl extension POE::Component::IRC. +6.83 Mon May 27 10:40:09 BST 2013 + - NickServID: React on IRC Message 433 - Commit: ec7cd33736 + - BotCommand: Support for overriding the Command Handler + - BotCommand: Added Support for a Help Modification Callback + - BotCommand: Adapted the Help Callback Options so it gets the Command and Arguments + - BotCommand: Added Support for Command Aliases + - BotCommand: Allowed No Arguments/Only Variable Arguments + - Implemented SSL Client Cert Support + 6.82 Sat Mar 9 22:15:02 GMT 2013 - Add the Prefix to the "Syntax:" line of the command help diff --git a/META.json b/META.json index 0c8dd81..865812d 100644 --- a/META.json +++ b/META.json @@ -5,7 +5,7 @@ "Hinrik \u00c3\u0096rn Sigur\u00c3\u00b0sson " ], "dynamic_config" : 0, - "generated_by" : "Dist::Zilla version 4.300030, CPAN::Meta::Converter version 2.120921", + "generated_by" : "Dist::Zilla version 4.300034, CPAN::Meta::Converter version 2.130880", "license" : [ "perl_5" ], @@ -76,7 +76,7 @@ "web" : "http://github.com/bingos/poe-component-irc" } }, - "version" : "6.82", + "version" : "6.83", "x_authority" : "cpan:HINRIK" } diff --git a/META.yml b/META.yml index 4f88767..8ee4843 100644 --- a/META.yml +++ b/META.yml @@ -9,7 +9,7 @@ build_requires: configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 -generated_by: 'Dist::Zilla version 4.300030, CPAN::Meta::Converter version 2.120921' +generated_by: 'Dist::Zilla version 4.300034, CPAN::Meta::Converter version 2.130880' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -42,5 +42,5 @@ resources: homepage: http://metacpan.org/release/POE-Component-IRC license: http://dev.perl.org/licenses/ repository: git://github.com/bingos/poe-component-irc.git -version: 6.82 +version: 6.83 x_authority: cpan:HINRIK diff --git a/Makefile.PL b/Makefile.PL index e545ff7..f69e7ee 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -11,10 +11,7 @@ use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "A fully event-driven IRC client module", "AUTHOR" => "Chris Williams , Hinrik \303\226rn Sigur\303\260sson ", - "BUILD_REQUIRES" => { - "Test::Differences" => "0.61", - "Test::More" => "0.47" - }, + "BUILD_REQUIRES" => {}, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, @@ -36,13 +33,30 @@ my %WriteMakefileArgs = ( "POE::Wheel::ReadWrite" => 0, "POE::Wheel::SocketFactory" => 0 }, - "VERSION" => "6.82", + "TEST_REQUIRES" => { + "Test::Differences" => "0.61", + "Test::More" => "0.47" + }, + "VERSION" => "6.83", "test" => { "TESTS" => "t/01_base/*.t t/02_behavior/*.t t/03_subclasses/*.t t/04_plugins/01_ctcp/*.t t/04_plugins/02_connector/*.t t/04_plugins/03_botaddressed/*.t t/04_plugins/04_bottraffic/*.t t/04_plugins/05_isupport/*.t t/04_plugins/06_plugman/*.t t/04_plugins/07_console/*.t t/04_plugins/08_proxy/*.t t/04_plugins/09_nickreclaim/*.t t/04_plugins/10_followtail/*.t t/04_plugins/11_cycleempty/*.t t/04_plugins/12_autojoin/*.t t/04_plugins/13_botcommand/*.t t/04_plugins/14_logger/*.t t/04_plugins/15_nickservid/*.t t/04_plugins/16_whois/*.t t/04_plugins/17_dcc/*.t t/05_regression/*.t" } ); +unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { + my $tr = delete $WriteMakefileArgs{TEST_REQUIRES}; + my $br = $WriteMakefileArgs{BUILD_REQUIRES}; + for my $mod ( keys %$tr ) { + if ( exists $br->{$mod} ) { + $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod}; + } + else { + $br->{$mod} = $tr->{$mod}; + } + } +} + unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; my $pp = $WriteMakefileArgs{PREREQ_PM}; diff --git a/README b/README index ff9f459..61c2568 100644 --- a/README +++ b/README @@ -249,6 +249,17 @@ CONSTRUCTORS * 'UseSSL', set to some true value if you want to connect using SSL. + * 'SSLCert', set to a SSL Certificate(PAM encoded) to connect using a + client cert + + * 'SSLKey', set to a SSL Key(PAM encoded) to connect using a client + cert + + * 'SSLCtx', set to a SSL Context to configure the SSL Connection + + The 'SSLCert' and 'SSLKey' both need to be specified. The 'SSLCtx' + takes precedence specified. + * 'Raw', set to some true value to enable the component to send "irc_raw" and "irc_raw_out" events. diff --git a/lib/POE/Component/IRC.pm b/lib/POE/Component/IRC.pm index 6103675..e41ef2a 100644 --- a/lib/POE/Component/IRC.pm +++ b/lib/POE/Component/IRC.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::VERSION = '6.82'; + $POE::Component::IRC::VERSION = '6.83'; } use strict; @@ -26,7 +26,7 @@ our ($GOT_SSL, $GOT_CLIENT_DNS, $GOT_SOCKET6, $GOT_ZLIB); BEGIN { eval { require POE::Component::SSLify; - import POE::Component::SSLify qw( Client_SSLify ); + import POE::Component::SSLify qw( Client_SSLify SSLify_ContextCreate ); $GOT_SSL = 1; }; eval { @@ -352,11 +352,26 @@ sub _sock_up { # ssl! if ($GOT_SSL and $self->{usessl}) { eval { - $socket = Client_SSLify($socket); + my ($ctx); + + if( $self->{sslctx} ) + { + $ctx = $self->{sslctx}; + } + elsif( $self->{sslkey} && $self->{sslcert} ) + { + $ctx = SSLify_ContextCreate( $self->{sslkey}, $self->{sslcert} ); + } + else + { + $ctx = undef; + } + + $socket = Client_SSLify($socket, undef, undef, $ctx); }; if ($@) { - chomp $@; + chomp $@; warn "Couldn't use an SSL socket: $@\n"; $self->{usessl} = 0; } @@ -1709,6 +1724,14 @@ be used. =item * B<'UseSSL'>, set to some true value if you want to connect using SSL. +=item * B<'SSLCert'>, set to a SSL Certificate(PAM encoded) to connect using a client cert + +=item * B<'SSLKey'>, set to a SSL Key(PAM encoded) to connect using a client cert + +=item * B<'SSLCtx'>, set to a SSL Context to configure the SSL Connection + +The B<'SSLCert'> and B<'SSLKey'> both need to be specified. The B<'SSLCtx'> takes precedence specified. + =item * B<'Raw'>, set to some true value to enable the component to send L|/irc_raw> and L|/irc_raw_out> events. diff --git a/lib/POE/Component/IRC/Common.pm b/lib/POE/Component/IRC/Common.pm index 1c6f3dd..a5a752a 100644 --- a/lib/POE/Component/IRC/Common.pm +++ b/lib/POE/Component/IRC/Common.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Common::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Common::VERSION = '6.82'; + $POE::Component::IRC::Common::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Constants.pm b/lib/POE/Component/IRC/Constants.pm index 8b6e4a3..0f7a3d7 100644 --- a/lib/POE/Component/IRC/Constants.pm +++ b/lib/POE/Component/IRC/Constants.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Constants::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Constants::VERSION = '6.82'; + $POE::Component::IRC::Constants::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin.pm b/lib/POE/Component/IRC/Plugin.pm index 41e11bc..8d16d86 100644 --- a/lib/POE/Component/IRC/Plugin.pm +++ b/lib/POE/Component/IRC/Plugin.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::VERSION = '6.82'; + $POE::Component::IRC::Plugin::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/AutoJoin.pm b/lib/POE/Component/IRC/Plugin/AutoJoin.pm index 09710ea..c2062a9 100644 --- a/lib/POE/Component/IRC/Plugin/AutoJoin.pm +++ b/lib/POE/Component/IRC/Plugin/AutoJoin.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::AutoJoin::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::AutoJoin::VERSION = '6.82'; + $POE::Component::IRC::Plugin::AutoJoin::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/BotAddressed.pm b/lib/POE/Component/IRC/Plugin/BotAddressed.pm index 9d93ae4..f96cedf 100644 --- a/lib/POE/Component/IRC/Plugin/BotAddressed.pm +++ b/lib/POE/Component/IRC/Plugin/BotAddressed.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::BotAddressed::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::BotAddressed::VERSION = '6.82'; + $POE::Component::IRC::Plugin::BotAddressed::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/BotCommand.pm b/lib/POE/Component/IRC/Plugin/BotCommand.pm index b669148..9de9233 100644 --- a/lib/POE/Component/IRC/Plugin/BotCommand.pm +++ b/lib/POE/Component/IRC/Plugin/BotCommand.pm @@ -3,8 +3,9 @@ BEGIN { $POE::Component::IRC::Plugin::BotCommand::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::BotCommand::VERSION = '6.82'; + $POE::Component::IRC::Plugin::BotCommand::VERSION = '6.83'; } +# vim: set expandtab ts=4 sw=4 ai: use strict; use warnings FATAL => 'all'; @@ -23,9 +24,9 @@ sub new { if (ref $args{Commands}->{$cmd} eq 'HASH') { croak "$cmd: no info provided" if !exists $args{Commands}->{$cmd}->{info} ; - croak "$cmd: no arguments provided" - if !@{ $args{Commands}->{$cmd}->{args} }; - + $args{Commands}->{lc $cmd}->{handler} = + sprintf("irc_botcmd_%s", lc($cmd)) + if !$args{Commands}->{lc $cmd}->{handler}; } $args{Commands}->{lc $cmd} = delete $args{Commands}->{$cmd}; } @@ -112,49 +113,71 @@ sub _handle_cmd { my $public = $where =~ /^[$chantypes]/ ? 1 : 0; $cmd = lc $cmd; + my $cmd_unresolved = $cmd; + + if((my $cmd_resolved = $self->resolve_alias($cmd))) + { + $cmd = $cmd_resolved; + } + + if (defined $self->{Commands}->{$cmd}) { if (ref $self->{Commands}->{$cmd} eq 'HASH') { my @args_array = defined $args ? split /\s+/, $args : (); - if (@args_array < @{ $self->{Commands}->{$cmd}->{args} } || + if (defined($self->{Commands}->{$cmd}->{args}) && + ref($self->{Commands}->{$cmd}->{args}) eq 'ARRAY' && + @{ $self->{Commands}->{$cmd}->{args} } && + (@args_array < @{ $self->{Commands}->{$cmd}->{args} } || (!defined $self->{Commands}->{$cmd}->{variable} && - @args_array > @{ $self->{Commands}->{$cmd}->{args} }) + @args_array > @{ $self->{Commands}->{$cmd}->{args} })) ) { $irc->yield($self->{Method}, $where, "Not enough or too many arguments. See help for $cmd"); return; } - $args = {}; - for (@{ $self->{Commands}->{$cmd}->{args} }) { - my $in_arg = shift @args_array; - if (ref $self->{Commands}->{$cmd}->{$_} eq 'ARRAY') { - my @values = @{ $self->{Commands}->{$cmd}->{$_} }; - shift @values; - - use List::MoreUtils qw(none); - # Check if argument has one of possible values - if (none { $_ eq $in_arg} @values) { - $irc->yield($self->{Method}, $where, - "$_ can be one of ".join '|', @values); - return; + if(defined $self->{Commands}->{$cmd}->{variable} || + (defined($self->{Commands}->{$cmd}->{args}) && + ref($self->{Commands}->{$cmd}->{args}) eq 'ARRAY' && + @{ $self->{Commands}->{$cmd}->{args} })) + { + $args = {}; + if( defined($self->{Commands}->{$cmd}->{args}) && + ref($self->{Commands}->{$cmd}->{args}) eq 'ARRAY' && + @{ $self->{Commands}->{$cmd}->{args} }) + { + for (@{ $self->{Commands}->{$cmd}->{args} }) { + my $in_arg = shift @args_array; + if (ref $self->{Commands}->{$cmd}->{$_} eq 'ARRAY') { + my @values = @{ $self->{Commands}->{$cmd}->{$_} }; + shift @values; + + use List::MoreUtils qw(none); + # Check if argument has one of possible values + if (none { $_ eq $in_arg} @values) { + $irc->yield($self->{Method}, $where, + "$_ can be one of ".join '|', @values); + return; + } + + } + $args->{$_} = $in_arg; } - } - $args->{$_} = $in_arg; - } - # Process remaining arguments if variable is set - my $arg_cnt = 0; - if (defined $self->{Commands}->{$cmd}->{variable}) { - for (@args_array) { - $args->{"opt".$arg_cnt++} = $_; + # Process remaining arguments if variable is set + my $arg_cnt = 0; + if (defined $self->{Commands}->{$cmd}->{variable}) { + for (@args_array) { + $args->{"opt".$arg_cnt++} = $_; + } } } } } if (ref $self->{Auth_sub} eq 'CODE') { - my ($authed, $errors) = $self->{Auth_sub}->($self->{irc}, $who, $where, $cmd, $args); + my ($authed, $errors) = $self->{Auth_sub}->($self->{irc}, $who, $where, $cmd, $args, $cmd_unresolved); if (!$authed) { my @errors = ref $errors eq 'ARRAY' @@ -168,7 +191,8 @@ sub _handle_cmd { } if (defined $self->{Commands}->{$cmd}) { - $irc->send_event_next("irc_botcmd_$cmd" => $who, $where, $args); + my $handler = (ref($self->{Commands}->{$cmd}) eq 'HASH' ? $self->{Commands}->{$cmd}->{handler} : "irc_botcmd_$cmd"); + $irc->send_event_next($handler => $who, $where, $args, $cmd, $cmd_unresolved); } elsif ($cmd =~ /^help$/i) { my @help = $self->_get_help($args, $public); @@ -192,28 +216,58 @@ sub _get_help { my @help; if (defined $args) { my $cmd = (split /\s+/, $args, 2)[0]; - if (exists $self->{Commands}->{$cmd}) { - if (ref $self->{Commands}->{$cmd} eq 'HASH') { - push @help, "Syntax: $p$cmd ". - (join ' ', @{ $self->{Commands}->{$cmd}->{args} }). - (defined $self->{Commands}->{$cmd}->{variable} ? + + $cmd = lc $cmd; + + my $cmd_resolved = $self->resolve_alias($cmd) || $cmd; + + if (exists $self->{Commands}->{$cmd_resolved}) { + if (ref $self->{Commands}->{$cmd_resolved} eq 'HASH') { + push @help, "Syntax: $p$cmd". + ( defined($self->{Commands}->{$cmd_resolved}->{args}) && + ref($self->{Commands}->{$cmd_resolved}->{args}) eq 'ARRAY' ? + " ".join ' ', @{ $self->{Commands}->{$cmd_resolved}->{args} } : + "" ). + (defined $self->{Commands}->{$cmd_resolved}->{variable} ? " ..." : ""); push @help, split /\015?\012/, - "Description: ".$self->{Commands}->{$cmd}->{info}; - push @help, "Arguments:"; - - for my $arg (@{ $self->{Commands}->{$cmd}->{args} }) { - next if not defined $self->{Commands}->{$cmd}->{$arg}; - if (ref $self->{Commands}->{$cmd}->{$arg} eq 'ARRAY') { - my @arg_usage = @{$self->{Commands}->{$cmd}->{$arg}}; - push @help, " $arg: ".$arg_usage[0]. - " (".(join '|', @arg_usage[1..$#arg_usage]).")" - } - else { - push @help, " $arg: ". - $self->{Commands}->{$cmd}->{$arg}; + "Description: ".$self->{Commands}->{$cmd_resolved}->{info}; + if( defined($self->{Commands}->{$cmd_resolved}->{args}) && + ref($self->{Commands}->{$cmd_resolved}->{args}) eq 'ARRAY' && + @{ $self->{Commands}->{$cmd_resolved}->{args} }) + { + push @help, "Arguments:"; + + for my $arg (@{ $self->{Commands}->{$cmd_resolved}->{args} }) { + next if not defined $self->{Commands}->{$cmd_resolved}->{$arg}; + if (ref $self->{Commands}->{$cmd_resolved}->{$arg} eq 'ARRAY') { + my @arg_usage = @{$self->{Commands}->{$cmd_resolved}->{$arg}}; + push @help, " $arg: ".$arg_usage[0]. + " (".(join '|', @arg_usage[1..$#arg_usage]).")" + } + else { + push @help, " $arg: ". + $self->{Commands}->{$cmd_resolved}->{$arg}; + } } } + + push @help, "Alias of: ${p}${cmd_resolved}" . + (ref($self->{Commands}->{$cmd_resolved}->{args}) eq 'ARRAY' ? + " ".join ' ', @{ $self->{Commands}->{$cmd_resolved}->{args} } : + "" ). + (defined $self->{Commands}->{$cmd_resolved}->{variable} ? + " ..." : "") + if $cmd_resolved ne $cmd; + + my @aliases = grep { $_ ne $cmd } $self->list_aliases($cmd_resolved); + + if($cmd_resolved ne $cmd) + { + push @aliases, $cmd_resolved; + } + + push @help, "Aliases: ".join( " ", @aliases) if scalar(@aliases); } else { @help = split /\015?\012/, $self->{Commands}->{$cmd}; @@ -234,7 +288,18 @@ sub _get_help { } } - return @help; + if(ref($self->{'Help_sub'}) eq 'CODE') + { + my ($cmd, $args) = (defined $args ? split /\s+/, $args, 2 : ('', '')); + + my $cmd_resolved = $self->resolve_alias($cmd) || $cmd; + + return $self->{'Help_sub'}->($self->{irc}, $cmd, $cmd_resolved, $args, @help); + } + else + { + return @help; + } } sub add { @@ -263,6 +328,38 @@ sub list { return %{ $self->{Commands} }; } +sub resolve_alias { + my ($self, $alias) = @_; + + my %cmds = $self->list(); + + #TODO: refactor using smartmatch/Perl6::Junction if feasible + while(my ($cmd, $info) = each(%cmds)) + { + next unless ref($info) eq 'HASH'; + next unless $info->{aliases} && ref($info->{aliases}) eq 'ARRAY'; + my @aliases = @{$info->{aliases}}; + + foreach my $cmdalias (@aliases) + { + return $cmd if $alias eq $cmdalias; + } + } + + return undef; +} + +sub list_aliases +{ + my ($self, $cmd) = @_; + $cmd = lc $cmd; + return if !exists $self->{Commands}->{$cmd}; + return unless ref($self->{Commands}->{$cmd}) eq 'HASH'; + return unless exists $self->{Commands}->{$cmd}->{aliases} && ref($self->{Commands}->{$cmd}->{aliases}) eq 'ARRAY'; + return @{$self->{Commands}->{$cmd}->{aliases}}; + +} + 1; =encoding utf8 @@ -388,6 +485,12 @@ The args array reference is than used to validate number of arguments required and to name arguments passed to event handler. Help is than generated from C and other hash keys which represent arguments (they are optional). +An optional C key can be specified inside the HASH ref to override the event handler. +The irc_botcmd_ prefix is not automatically prepended to the handler name when overriding it. + +An optional C key can be specified inside the HASH ref containing a array ref with alias names. +The aliases can be specified for help and to run the command. + =head3 Accepting commands B<'In_channels'>, a boolean value indicating whether to accept commands in @@ -439,6 +542,29 @@ B<'Ignore_unauthorized'>, if true, the plugin will ignore unauthorized commands, rather than printing an error message upon receiving them. This is only relevant if B<'Auth_sub'> is also supplied. Default is false. +=head3 Help Command + +B<'Help_sub'>, a subroutine reference which, if provided, will be called upon +the end of the predefined help command. The subroutine will be called in list context. + +Your subroutine will be called with the following arguments: + +=over 4 + +=item 1. The IRC component object + +=item 2. The command. + +=item 3. The resolved command(after alias processing). + +=item 4. The arguments. + +=item 5. The generated help text as array. + + +=back + + =head3 Miscellaneous B<'Ignore_unknown'>, if true, the plugin will ignore undefined commands, @@ -472,6 +598,11 @@ if the command wasn't defined to begin with, true otherwise. Takes no arguments. Returns a list of key/value pairs, the keys being the command names and the values being the usage strings or hash references. +=head2 C + +Takes one argument, a string to match against command aliases, if no matching +command can be found undef is returned. + =head1 OUTPUT EVENTS =head2 C diff --git a/lib/POE/Component/IRC/Plugin/BotTraffic.pm b/lib/POE/Component/IRC/Plugin/BotTraffic.pm index 91ff3aa..ca896cf 100644 --- a/lib/POE/Component/IRC/Plugin/BotTraffic.pm +++ b/lib/POE/Component/IRC/Plugin/BotTraffic.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::BotTraffic::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::BotTraffic::VERSION = '6.82'; + $POE::Component::IRC::Plugin::BotTraffic::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/CTCP.pm b/lib/POE/Component/IRC/Plugin/CTCP.pm index e56e618..f2cc67c 100644 --- a/lib/POE/Component/IRC/Plugin/CTCP.pm +++ b/lib/POE/Component/IRC/Plugin/CTCP.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::CTCP::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::CTCP::VERSION = '6.82'; + $POE::Component::IRC::Plugin::CTCP::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/Connector.pm b/lib/POE/Component/IRC/Plugin/Connector.pm index d5cdd95..71e870d 100644 --- a/lib/POE/Component/IRC/Plugin/Connector.pm +++ b/lib/POE/Component/IRC/Plugin/Connector.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::Connector::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::Connector::VERSION = '6.82'; + $POE::Component::IRC::Plugin::Connector::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/Console.pm b/lib/POE/Component/IRC/Plugin/Console.pm index 1424a70..d182d9c 100644 --- a/lib/POE/Component/IRC/Plugin/Console.pm +++ b/lib/POE/Component/IRC/Plugin/Console.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::Console::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::Console::VERSION = '6.82'; + $POE::Component::IRC::Plugin::Console::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/CycleEmpty.pm b/lib/POE/Component/IRC/Plugin/CycleEmpty.pm index 89eb634..8eb12ad 100644 --- a/lib/POE/Component/IRC/Plugin/CycleEmpty.pm +++ b/lib/POE/Component/IRC/Plugin/CycleEmpty.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::CycleEmpty::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::CycleEmpty::VERSION = '6.82'; + $POE::Component::IRC::Plugin::CycleEmpty::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/DCC.pm b/lib/POE/Component/IRC/Plugin/DCC.pm index c90a9a4..e5eaf15 100644 --- a/lib/POE/Component/IRC/Plugin/DCC.pm +++ b/lib/POE/Component/IRC/Plugin/DCC.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::DCC::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::DCC::VERSION = '6.82'; + $POE::Component::IRC::Plugin::DCC::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/FollowTail.pm b/lib/POE/Component/IRC/Plugin/FollowTail.pm index ff21855..463b1d9 100644 --- a/lib/POE/Component/IRC/Plugin/FollowTail.pm +++ b/lib/POE/Component/IRC/Plugin/FollowTail.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::FollowTail::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::FollowTail::VERSION = '6.82'; + $POE::Component::IRC::Plugin::FollowTail::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/ISupport.pm b/lib/POE/Component/IRC/Plugin/ISupport.pm index 0fa8310..f292305 100644 --- a/lib/POE/Component/IRC/Plugin/ISupport.pm +++ b/lib/POE/Component/IRC/Plugin/ISupport.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::ISupport::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::ISupport::VERSION = '6.82'; + $POE::Component::IRC::Plugin::ISupport::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/Logger.pm b/lib/POE/Component/IRC/Plugin/Logger.pm index 04c41fe..231da1d 100644 --- a/lib/POE/Component/IRC/Plugin/Logger.pm +++ b/lib/POE/Component/IRC/Plugin/Logger.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::Logger::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::Logger::VERSION = '6.82'; + $POE::Component::IRC::Plugin::Logger::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/NickReclaim.pm b/lib/POE/Component/IRC/Plugin/NickReclaim.pm index 12a23fd..6e55716 100644 --- a/lib/POE/Component/IRC/Plugin/NickReclaim.pm +++ b/lib/POE/Component/IRC/Plugin/NickReclaim.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::NickReclaim::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::NickReclaim::VERSION = '6.82'; + $POE::Component::IRC::Plugin::NickReclaim::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/NickServID.pm b/lib/POE/Component/IRC/Plugin/NickServID.pm index b586ddd..18528b2 100644 --- a/lib/POE/Component/IRC/Plugin/NickServID.pm +++ b/lib/POE/Component/IRC/Plugin/NickServID.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::NickServID::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::NickServID::VERSION = '6.82'; + $POE::Component::IRC::Plugin::NickServID::VERSION = '6.83'; } use strict; @@ -66,6 +66,18 @@ sub S_notice { return PCI_EAT_NONE; } +# ERR_NICKNAMEINUSE +sub S_433 { + my ($self, $irc) = splice @_, 0, 2; + my $offending = ${ $_[2] }->[0]; + my $reason = ${ $_[2] }->[1]; + + if ($irc->nick_name() eq $offending && $reason eq "Nickname is registered to someone else") { + $irc->yield(nickserv => "IDENTIFY $self->{Password}"); + } + + return PCI_EAT_NONE; +} 1; =encoding utf8 diff --git a/lib/POE/Component/IRC/Plugin/PlugMan.pm b/lib/POE/Component/IRC/Plugin/PlugMan.pm index a3490aa..1a76843 100644 --- a/lib/POE/Component/IRC/Plugin/PlugMan.pm +++ b/lib/POE/Component/IRC/Plugin/PlugMan.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::PlugMan::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::PlugMan::VERSION = '6.82'; + $POE::Component::IRC::Plugin::PlugMan::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/Proxy.pm b/lib/POE/Component/IRC/Plugin/Proxy.pm index a63643b..056a62d 100644 --- a/lib/POE/Component/IRC/Plugin/Proxy.pm +++ b/lib/POE/Component/IRC/Plugin/Proxy.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::Proxy::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::Proxy::VERSION = '6.82'; + $POE::Component::IRC::Plugin::Proxy::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Plugin/Whois.pm b/lib/POE/Component/IRC/Plugin/Whois.pm index 9570c57..75ffac2 100644 --- a/lib/POE/Component/IRC/Plugin/Whois.pm +++ b/lib/POE/Component/IRC/Plugin/Whois.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Plugin::Whois::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Plugin::Whois::VERSION = '6.82'; + $POE::Component::IRC::Plugin::Whois::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Qnet.pm b/lib/POE/Component/IRC/Qnet.pm index fc06355..81122d6 100644 --- a/lib/POE/Component/IRC/Qnet.pm +++ b/lib/POE/Component/IRC/Qnet.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Qnet::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Qnet::VERSION = '6.82'; + $POE::Component::IRC::Qnet::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/Qnet/State.pm b/lib/POE/Component/IRC/Qnet/State.pm index c7e4cd3..0c8c77f 100644 --- a/lib/POE/Component/IRC/Qnet/State.pm +++ b/lib/POE/Component/IRC/Qnet/State.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::Qnet::State::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::Qnet::State::VERSION = '6.82'; + $POE::Component::IRC::Qnet::State::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Component/IRC/State.pm b/lib/POE/Component/IRC/State.pm index de0ae99..92f55fb 100644 --- a/lib/POE/Component/IRC/State.pm +++ b/lib/POE/Component/IRC/State.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Component::IRC::State::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Component::IRC::State::VERSION = '6.82'; + $POE::Component::IRC::State::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Filter/IRC.pm b/lib/POE/Filter/IRC.pm index 584aa8d..db4a44b 100644 --- a/lib/POE/Filter/IRC.pm +++ b/lib/POE/Filter/IRC.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Filter::IRC::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Filter::IRC::VERSION = '6.82'; + $POE::Filter::IRC::VERSION = '6.83'; } use strict; diff --git a/lib/POE/Filter/IRC/Compat.pm b/lib/POE/Filter/IRC/Compat.pm index 68b4c9c..edebba5 100644 --- a/lib/POE/Filter/IRC/Compat.pm +++ b/lib/POE/Filter/IRC/Compat.pm @@ -3,7 +3,7 @@ BEGIN { $POE::Filter::IRC::Compat::AUTHORITY = 'cpan:HINRIK'; } { - $POE::Filter::IRC::Compat::VERSION = '6.82'; + $POE::Filter::IRC::Compat::VERSION = '6.83'; } use strict;