From edcd76dff8e0b220f09998d6e5f3f80dc59664fa Mon Sep 17 00:00:00 2001
From: dms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Date: Wed, 21 May 2003 15:36:57 +0000
Subject: [PATCH] - one more last try. - added support for wantnick+. will kill
 if we are +n.

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@789 c11ca15a-4712-0410-83d8-924469b57eb5
---
 blootbot/src/UserExtra.pl | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/blootbot/src/UserExtra.pl b/blootbot/src/UserExtra.pl
index aaf37c4..d967932 100644
--- a/blootbot/src/UserExtra.pl
+++ b/blootbot/src/UserExtra.pl
@@ -841,7 +841,10 @@ if (0) {
     }
 
     # wantNick. xk++
-    if ($message =~ /^wantNick$/i) {
+    if ($message =~ /^wantNick(\+)?$/i) {
+	my ($force) = ($1) ? 1 : 0;
+	$force = 0 unless (&IsFlag("n"));
+
 	# cannot trust Net::IRC's nick()
 	if ($param{'ircNick'} eq $ident) {
 	    &msg($who, "I hope you're right. I'll try anyway.");
@@ -859,14 +862,22 @@ if (0) {
 	}
 
 	# idea from dondelecarlo :)
-	if ($param{'ircNick'} ne $ident and $param{'nickServ_pass'}) {
-	    &status("someone is using our nick; KILLing");
+	# todo: use cache{nickserv}
+	if ($param{'nickServ_pass'}) {
+	    return if ($param{'ircNick'} eq $ident or $force == 0);
+
+	    &status("someone is using our nick; GHOSTing");
+	    &msg($who, "using GHOST on $param{'ircNick'}.");
 	    &msg("NickServ", "GHOST $param{'ircNick'} $param{'nickServ_pass'}");
+
+	    $conn->schedule(5, sub {
+		&status("going to change nick after GHOST.");
+		&nick( $param{'ircNick'} );
+	    } );
+
 	    return;
 	}
 
-	&nick( $param{'ircNick'} );
-
 	return;
     }
 
-- 
2.39.5