I have an eggdrop that connects to several crowded channels, so every once and again, when the bot crashed or got stoned, the eggdrop would get kicked out of the network because it would exceed the sendq data limit. So to stop that, I had to set some channels to inactive and enable them one at a time. Finally, I figured out that a script should do that. The scripts sets all the bot's channels to inactive when reloading, disconnecting or reconnecting and sets its channel to active one channel at a time after n (in this example, 60) seconds.
## Delay Join ##
foreach bind [binds active] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
foreach bind [binds inactive] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
set joindelay 60
bind evnt - connect-server inactive
proc inactive {type} {
global i
set i 0
foreach chan [channels] {
if {![channel get $chan inactive]} {
putlog "Passing to inactive $chan"
channel set $chan +inactive
}
}
}
bind evnt - init-server active
proc active {type} {
global i joindelay
if {![info exists i]} {
set i 0
}
if { $i < [ llength [split [channels]] ] } {
if { $i == 0 } { set chan [ string range [lindex [split [channels]] $i] 1 end-1]
} else { set chan [lindex [split [channels]] $i] }
if {[channel get $chan inactive]} {
putlog "Passing to active $chan"
channel set $chan -inactive
}
utimer $joindelay [list active type]
incr i
} else {
set i 0
}
}
putlog "Delay join"