From: dms Date: Wed, 21 May 2003 15:10:02 +0000 (+0000) Subject: - rewrote patch from dondelecarlo to add nickserv's GHOST support. X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=fbfa6c3cc77385f9e7e6da34d28de8f2572eaaa8;p=infobot.git - rewrote patch from dondelecarlo to add nickserv's GHOST support. - fixed up nick_taken code. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@785 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/IRC/IrcHooks.pl b/blootbot/src/IRC/IrcHooks.pl index bc2ee65..fa11dab 100644 --- a/blootbot/src/IRC/IrcHooks.pl +++ b/blootbot/src/IRC/IrcHooks.pl @@ -715,7 +715,14 @@ sub on_nick { sub on_nick_taken { my ($self) = @_; my $nick = $self->nick; - my $newnick = $nick."-"; + my $newnick = $nick.int(rand 10); + + if ($nick eq $ident) { + &DEBUG("on_nick_tane: nick eq ident... wtf?"); + return; + } + + &DEBUG("on_nick_taken: ident => $ident"); &status("nick taken ($nick); preparing nick change."); diff --git a/blootbot/src/UserExtra.pl b/blootbot/src/UserExtra.pl index cfd15aa..cad732b 100644 --- a/blootbot/src/UserExtra.pl +++ b/blootbot/src/UserExtra.pl @@ -842,23 +842,31 @@ if (0) { # wantNick. xk++ if ($message =~ /^wantNick$/i) { + # cannot trust Net::IRC's nick() if ($param{'ircNick'} eq $ident) { &msg($who, "I hope you're right. I'll try anyway."); + &DEBUG("ircNick => $param{'ircNick'}"); + &DEBUG("ident => $ident"); } - &DEBUG("ircNick => $param{'ircNick'}"); - &DEBUG("ident => $ident"); - if (! &IsNickInAnyChan( $param{ircNick} ) ) { + # fallback check, I guess. needed? + if (! &IsNickInAnyChan( $param{'ircNick'} ) ) { my $str = "attempting to change nick to $param{'ircNick'}"; &status($str); &msg($who, $str); - &nick($param{'ircNick'}); - } else { - &msg($who, "hrm.. I shouldn't do it (BUG?) but doing it anyway!"); - &DEBUG("wN: nick is somewhere... should try later."); - &nick($param{'ircNick'}); + &nick($param{ 'ircNick' }); + return; + } + + # idea from dondelecarlo :) + if ($param{'nickServ_pass'}) { + &status("someone is using our nick; KILLing"); + &msg("NickServ", "GHOST $param{'ircNick'} $param{'nickServ_pass'}"); + return; } + &nick( $param{'ircNick'} ); + return; }