im trying to write a tcl that basically stores nicks on join to send away every like 3 minutes with a fixed timer that should run all the time to a proc to check if nicks have any channel access levels or special user flags to exempt and store everyone else to send away to do a whois in stacks of 20 as thats what the ircd allows i did several attempts but so far im stuck it stores nicks but doesnt clear after sending away
this is what i work with so far:
Code: Select all
bind join - * Delayed-Check:WHois-BadChanz
array set CheckBadChanOnJoin {}
proc Delayed-Check:WHois-BadChanz {nick uhost hand chan} {
global throttle_Chker CheckBadChanOnJoin
if {![info exists CheckBadChanOnJoin($chan)]} { set CheckBadChanOnJoin($chan) [list] }
if {[isbotnick $nick] || [matchattr $hand of|of $chan]} { return 0 }
# if {[matchattr [nick2hand $nick] of|of $chan] || [isbotnick $nick] || [isop $nick $chan] || [ishalfop $nick $chan] || [isvoice $nick $chan]} { return 0 }
if {[lsearch -exact $CheckBadChanOnJoin($chan) $nick] == -1} { lappend CheckBadChanOnJoin($chan) $nick }
if {![info exists throttle_Chker($chan)]} {
set throttle_Chker($chan) 1
# putserv "privmsg $chan :$CheckBadChanOnJoin($chan)"
if {![info exists CheckWHoisOnJOIN($chan)] && [info exists CheckBadChanOnJoin($chan)]} { set CheckWHoisOnJOIN($chan) [after [expr {3*1000*1}] [list putserv "privmsg $chan :$CheckBadChanOnJoin($chan)"]] }
# if {![info exists CheckWHoisOnJOIN($chan)] && [info exists CheckBadChanOnJoin($chan)]} { set CheckWHoisOnJOIN($chan) [after [expr {3*1000*1}] [list StackEDX:QWHois $chan $CheckBadChanOnJoin($chan)]] }
utimer 2 [list unset -nocomplain throttle_Chker($chan)]
}
}
proc StackEDX:QWHois {chan userList {max 20}} {
set counter 0
set count [llength $userList]
set counter 0
while {$count > 0} {
if {$count > $max} {
set users [join [lrange $userList 0 [expr {$max - 1}]] ","]
set userList [lreplace $userList 0 [expr {$max -1}]]
incr count -$max
} else {
set users [join $userList ","]
set count 0
}
after [expr {$counter*5000}] [list putserv "Whois :$users"]
incr counter 1
}
}
proc General:Throttle-Proc {id seconds} {
global JoinThrottle
if {[info exists JoinThrottle($id)] && $JoinThrottle($id) > [clock seconds]} {
set id 1
} {
set JoinThrottle($id) [expr {[clock seconds] + $seconds}]
set id 0
}
}
hope someone can shed some light, thanks in advance.