Posted to tcl by aspect at Mon Jul 03 12:11:50 GMT 2023view raw
- Index: apps/ijbridge/ijbridge.tcl
- ==================================================================
- --- apps/ijbridge/ijbridge.tcl
- +++ apps/ijbridge/ijbridge.tcl
- @@ -1086,12 +1086,29 @@
- cmd-join $::client::channel
- }
- $cn registerevent 433 {
- # ERR_NICKNAMEINUSE
- - if { [lindex [additional] 0] == $::client::nick } {
- - cmd-send "NICK [string trimright $::client::nick 0123456789][string range [expr rand()] end-2 end]"
- + set requested_nick [lindex [additional 0]]
- + set preferred_nick $::ijchain::Options(IrcUser)
- + set current_nick $::client::nick
- +
- + if {$requested_nick == $current_nick} {
- +
- + # initial nick selection failed - choose a fallback, and schedule a retry
- + cmd-send "NICK $preferred_nick[string range [expr rand()] end-2 end]"
- + after 20000 [list cmd-send "NICK $preferred_nick"]
- +
- + } elseif {$requested_nick ne $preferred_nick} {
- +
- + # fallback nick selection failed - choose another. A retry is already scheduled.
- + cmd-send "NICK $preferred_nick[string range [expr rand()] end-2 end]"
- +
- + } elseif {$requested_nick == $preferred_nick} {
- +
- + # trying to regain preferred nick failed. Keep our current fallback nick, but schedule another retry.
- + after 20000 [list cmd-send "NICK $preferred_nick"]
- }
- }
- $cn registerevent 353 {
- # RPL_NAMEREPLY