On Sun, Apr 18, 2004 at 07:48:29AM -0400, Jeff Bisbee wrote:
> I got this bit of code from Martijn van Beers' http proxy bot and it
> handles the problem. Basically just post nick to the IRC session with
> the new nick.
>
> $kernel->post($irc_session, 'nick', $new_nick);
>
> Here is the call in context:
>
> irc_433 => \&bot_nick_taken,
>
> sub bot_nick_taken
> {
> my ($kernel, $heap) = @_[KERNEL, HEAP];
> substr($heap->{irc}{nick}, 0, 1)++;
> warn "Nick taken! Trying new nick $heap->{irc}{nick}";
> $kernel->post($heap->{irc}{session}, 'nick', $heap->{irc}{nick});
> }
>
I tried doing just that, but didn't have any luck. I even tried adding a 'post' to
restart the "login" process. It doesn't seem that the session ever shows up on
IRC though.
I've been fighting with this one for a month. :)
sub irc_433 #nickname in use? Try to ghost it! Give it one shot, then quit.
{
my $self=shift;
my $server=shift;
my $sess=$self->{KERNEL}->alias_resolve($server);
my $heap=$sess->get_heap();
my $nick=$heap->{"nick"};
print "Error on $server : Nickname \"$nick\" in use.\n";
$nick = ($nick . int(rand(10000)));
$self->nick($nick);
$self->{KERNEL}->post($sess, 'irc_001');
}
--
There are more acronyms floating around [NANAE] than feathers during a
pillow fight. -- Beverly in NANAE