i'll appreciate if some can help me to fix the following codes, its expired the global bans and the channel bans, i wanted it to expire just "channel bans", not the global.
advance thanks
Code: Select all
proc exe_timersequence { } {
set IGNITION 2
timer $IGNITION bcheck
timer $IGNITION ulcheck
}
exe_timersequence
proc bcheck {} {
set CK_INTERBAL1 720
set CK_INTERBAL2 360
foreach j [timers] {
if {[string compare [lindex $j 1] bcheck] == 0} {
killtimer [lindex $j 2]
}
}
blistcheck GLOBAL
foreach channame [channels] {
blistcheck $channame
}
backup
save
timer $CK_INTERBAL1 bcheck
timer $CK_INTERBAL2 ulcheck
}
proc blistcheck {watchchannel} {
set CGLOBAL GLOBAL
if {[string compare $watchchannel $CGLOBAL] == 0 } {
foreach bansentry [banlist] {
set watchchannel #test
delban $watchchannel $bansentry
}
} else {
foreach bansentry [banlist $watchchannel] {
delban $watchchannel $bansentry
}
}
}
proc delban {watchchannel bansentry} {
set EXPIRE_LIMIT 150
set NV_LIMIT 40
set NV_LIMIT2 50
set createdday [lindex $bansentry 3]
set usedday [lindex $bansentry 4]
set currnttime [unixtime]
set daylength 86400
set createdday [expr ($currnttime - $createdday)/$daylength]
set bannedperson [lindex $bansentry 0]
set bywho [lindex $bansentry 5]
set breason [lindex $bansentry 1]
if { $usedday == 0} {
if { $createdday > $NV_LIMIT } {
if {[isban $bannedperson] == 0} {
killchanban $watchchannel $bannedperson
putlog "Okay Expired."
} else {
killban $bannedperson
putlog "Okay Expired."
}
}
} else {
set usedday [expr ($currnttime - $usedday)/$daylength]
if {$usedday > $EXPIRE_LIMIT } {
if {[isban $bannedperson] == 0} {
killchanban $watchchannel $bannedperson
putlog "Okay Expired."
} else {
killban $bannedperson
putlog "Okay Expired."
}
} elseif { ($usedday == $createdday) && ($createdday > $NV_LIMIT2 ) } {
if {[isban $bannedperson] == 0} {
killchanban $watchchannel $bannedperson
putlog "Okay Expired."
} else {
killban $bannedperson
putlog "Okay Expired."
}
}
}
}