Posted to tcl by aspect at Mon Jul 03 12:47:07 GMT 2023view raw
- Index: apps/ijbridge/ijbridge.tcl
- ==================================================================
- --- apps/ijbridge/ijbridge.tcl
- +++ apps/ijbridge/ijbridge.tcl
- @@ -1086,12 +1086,28 @@
- 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]"
- +
- + # avoid piling up afters
- + after cancel [list cmd-send "NICK $preferred_nick"]
- +
- + set preferred_nick $::ijchain::Options(IrcUser)
- + # $::client::nick is our current nick - or, during intial handshake, the nick we are trying to assume.
- +
- + if {[lindex [additional] 0] eq $::client_nick} {
- +
- + # we are still trying to set an initial nick
- +
- + set fallback_nick "$preferred_nick[string range [expr rand()] end-2 end]"
- + cmd-send "NICK $fallback_nick"
- + set $::client::nick $fallback_nick
- + }
- +
- + if {$::client::nick ne $preferred_nick} {
- + after 20000 [list cmd-send "NICK $preferred_nick"]
- }
- }
- $cn registerevent 353 {
- # RPL_NAMEREPLY