Subject: | POE::Component::IRC::Plugin::AutoJoin - Rejoin on kick/ban broken for passworded channels on ircu/snircd servers |
Date: | Sun, 19 Apr 2009 04:07:17 +0100 |
To: | bug-POE-Component-IRC [...] rt.cpan.org |
From: | Jase Thew <bazerka [...] beardz.net> |
Due to ircu/snircd servers hiding channel passwords from non-opped users
(they return '*' instead of the channel password in the 3rd item of
numeric 324's reply string), the S_Join server method is overwriting the
channel password stored in the Channels hash with an invalid password
('*'). This results in the plugin failing to rejoin a passworded channel
after being kicked or kick-banned.
The attached patch (against latest Autojoin.pm in the git repo)
introduces a new argument ( Store_key_on_join ) for the plugin's new
method which dictates whether the S_Join server method stores a
channel's password to the Channels hash. By default, it is enabled and
must be disabled for use on ircu/snircd servers.
Regards,
Jase Thew.
--- AutoJoin.pm.git 2009-04-19 02:38:48.000000000 +0100
+++ AutoJoin.pm 2009-04-19 03:22:56.000000000 +0100
@@ -34,6 +34,7 @@
}
$self->{Rejoin_delay} = 5 if !defined $self->{Rejoin_delay};
+ $self->{Store_key_on_join} = 1 if !defined $self->{Store_key_on_join};
$irc->plugin_register($self, 'SERVER', qw(474 isupport chan_mode join kick part));
return 1;
}
@@ -82,6 +83,7 @@
my ($self, $irc) = splice @_, 0, 2;
my $joiner = parse_user(${ $_[0] });
my $chan = ${ $_[1] };
+ return unless $self->{Store_key_on_join};
if ($joiner eq $irc->nick_name()) {
$self->{Channels}->{$chan} = $irc->channel_key($chan);
@@ -173,7 +175,7 @@
=head2 C<new>
-Two optional arguments:
+Four optional arguments:
B<'Channels'>, either an array reference of channel names, or a hash reference
keyed on channel name, containing the password for each channel. By default it
@@ -188,6 +190,13 @@
B<'Retry_when_banned'>, if you can't join a channel due to a ban, set this
to the number of seconds to wait between retries. Default is 0 (disabled).
+B<'Store_key_on_join'>, set this to 0 if you're using this plugin on ircu or
+snircd servers (such as undernet or QuakeNet servers). As both ircu and snircd
+hide channel passwords from non-opped users (they show * instead of the channel
+password), setting this to 0 prevents the plugin from overwriting the channel
+password stored in the B<'Channels'> hash with the masked password. Default is
+1 (enabled).
+
Returns a plugin object suitable for feeding to
L<POE::Component::IRC|POE::Component::IRC>'s C<plugin_add> method.