[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Nick Regaining



purl doesn't have her nick back. :(

http://othersideofthe.earth.li/infobot/regain.patch

--- Irc.old	Mon Jan 17 18:55:44 2000
+++ Irc.pl	Wed Jan 19 22:32:07 2000
@@ -165,6 +165,9 @@
 	    }
 	}
     } elsif ($type=~/NICK/) {
+	if ($chan eq $ident and $nick eq $param{wantNick}) { # That's me!
+		$ident=$param{nick}=$param{wantNick}; $regain_nick == undef ;
+	}
 	if ($param{ansi_control}) {
 	    &status(">>> ".c($nick,'bold green').
 		    " materializes into ".c($chan,'bold green'));
@@ -255,6 +258,7 @@
            &status(">>> set by $1 at $2");
        }
     } elsif ($msg=~/^433/) {
+	$regain_nick=1;
 	++$nicktries;
 	if (length($param{wantNick}) > 9) {
 	    $ident = chop $param{wantNick};
--- Process.old	Wed Jan 19 22:18:25 2000
+++ Process.pl	Wed Jan 19 22:32:12 2000
@@ -3,11 +3,18 @@
 # process the incoming message
 
 $SIG{'ALRM'} = 'TimerAlarm';
+my $regain_counter=0;
 
 sub process {
     ($who, $msgType, $message) = @_;
     $origMessage = $message;
     $message =~ s/[\cA-\c_]//ig; # strip control characters
+
+	if (defined $regain_nick ) { # and ! ++$regain_counter%20) {
+		&status("Trying to get my nick back");
+		$regain_nick=undef; # will be set back to 1 if we fail.
+		rawout("NICK $param{wantNick}");
+	}
 
     $addressed = 0;
 

-- 
I washed a sock.  Then I put it in the dryer.  When I took it out, it was gone.
        -- Steven Wright