]> git.donarmstrong.com Git - infobot.git/blobdiff - src/UserExtra.pl
- try and not kill ourself :)
[infobot.git] / src / UserExtra.pl
index cfd15aa1f509ae1c116f247e9e64dece494e91b3..aaf37c488f42ec5a6dbae2fa2311d659474b4681 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{'ircNick'} ne $ident and $param{'nickServ_pass'}) {
+           &status("someone is using our nick; KILLing");
+           &msg("NickServ", "GHOST $param{'ircNick'} $param{'nickServ_pass'}");
+           return;
        }
 
+       &nick( $param{'ircNick'} );
+
        return;
     }