On *:CONNECT: {
set -e %NicknameRecovery.Allowed $true
set -e %NicknameRecovery.Disabled $false
}
RAW 433:*: { ; :Nickname is already in use.
if ($2 == $mnick) $&
&& (!%NicknameRecovery.Disabled) {
; This basically asserts that the user wants to retry claiming their main nickname.
; All they have to do next is change into their alternate nickname.
set -e %NicknameRecovery.Allowed $true
} }
On me:*:NICK: {
if ($nick == $mnick) {
; The user did this or the server did this intentionally.
; (We used to have our $mnick, but we changed it to something else.)
; ((Remember that $nick is our old nick, and $newnick is our new nick.))
set -eu600 %NicknameRecovery.Disabled $true
}
elseif ($newnick == $anick) $&
&& (%NicknameRecovery.Allowed) $&
&& (!%NicknameRecovery.Disabled) {
; If we're changing from any random nickname to our alt nickname,
; monitor for our main preferred nickname to become available.
notify $mnick
notify on
} }
On *:UNOTIFY: {
if ($me == $anick) $&
&& ($nick == $mnick) $&
&& (%NicknameRecovery.Allowed) $&
&& (!%NicknameRecovery.Disabled) {
; super sanity: the former can be reset again by a 433 later on,
; but the latter must first timeout after a 10 minute hard wait.
set -e %NicknameRecovery.Allowed $false
set -eu600 %NicknameRecovery.Disabled $true
nick $mnick
} } ; by Raccoon 2018
; On *:QUIT:
; On *:NICK:
;; both events are handled by On UNOTIFY implicitly.
; There's no feasible easy way to clean up temporary /notify use, so I didn't bother.
; This code is untested.