]> git.donarmstrong.com Git - infobot.git/commitdiff
- rewrote patch from dondelecarlo to add nickserv's GHOST support.
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 21 May 2003 15:10:02 +0000 (15:10 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 21 May 2003 15:10:02 +0000 (15:10 +0000)
- fixed up nick_taken code.

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@785 c11ca15a-4712-0410-83d8-924469b57eb5

src/IRC/IrcHooks.pl
src/UserExtra.pl

index bc2ee65c9bcd37bf166163a1c0d89c4562ce0af9..fa11dab1480d7cb3232dab1c70eb813a775658c5 100644 (file)
@@ -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.");
 
index cfd15aa1f509ae1c116f247e9e64dece494e91b3..cad732babcc62a59379fb4c9f0e855c5d02d3737 100644 (file)
@@ -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;
     }