alias clearbans {
if $me !isop $1 {
return
}
if $chan($1).ibl == $false {
;
; If mIRC hasn't seen the channel bans list, it must do a /mode +b
; before attemting to remove bans it doesn't know about.
;
; We'll be back at the end of the ban list (raw 368)
;
.enable #banlist
mode $1 +b
return
}
;
; We initialize the %counter variable with the value of
; total number of active bans.
;
; Then we'll decrease it by one every time the loop runs
; until it reaches zero then the loop stops.
;
var %counter = $ibl($1,0)
while %counter > 0 {
;
; %buffer will keep a short list of bans, which should be
; lifted in one command, as much bans as the server allows.
;
; In this way, mIRC will not send a separate /mode command
; for each ban. it will take a few together.
;
var %buffer = %buffer $ibl($1,%counter), %counter = %counter - 1
;
; If total number of buffered bans equals to the server mode limit,
; or - the buffer equals to zero (ie. no more bans left in the list),
; we perform a /mode command and then clear the %buffer.
;
if $numtok(%buffer,32) == $modespl || %counter == 0 {
mode $1 - $+ $str(b,$ifmatch) %buffer
unset %buffer
}
}
}
#banlist off
raw 367:*:haltdef
raw 368:*:haltdef | .disable #banlist | clearbans $2
#banlist end