;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BANLISTEXEC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;info: ; ; by wiebe @ QuakeNet ; version 1.0 (written and tested on mIRC 6.14) ; ; last edit: Tue Feb 17 2004 ; ; ;What does this script do? ; ; retrieves the banlist from a channel ; and sends the info the an alias, example: ; ; ;How to use this script? ; ; /banlistexec [params] ; to request the banlist from channel and send the info to the alias ; ; /banlistexec -c ; to clear the queue ; ; the script sends the following things to the alias: ; ; 367 ; channel, from which the ban info is ; banmask, the ban that is set ; nick, who set the ban ; ctime, when the ban was set ; ; 368 End of Channel Ban List ; this marks the end of the banlist ; ; WARNING: DO NOT USE HALT IN AN ALIAS, USE RETURN! ; halt also halts the calling alias/event, return only stops the current alias ; and gives control back to the calling alias/event ; using halt in alias'es that are called from this script can cause it not to work 100% ; ; example at end of script ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS BANLISTEXEC.DELAY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l banlistexec.delay { ; what delay in seconds should banlistexec have when it is called !return 1 } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS BANLISTEXEC.RESTART ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l banlistexec.restart { ; what delay in seconds should be between multiple ban requests !return 5 } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; stop here, only change stuff if you know what you are doing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS BANLISTEXEC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; /banlistexec alias banlistexec { ; we are connected if ($status == connected) { ; '$1' is '-c' if ($1 == -c) { ; clear the queue $banlistexec.queue($+(ban.exec.queue.,$cid)).clear ; stop !return } ; less then 3 parameters, stop if ($0 < 3) { return } ; check if IBL has the bans if ($chan($1).ibl == $true) { ; set a var !var %x = $ibl($1,0) ; loop as long as '%x' is greater then 0 while (%x) { ; run the alias with the requested info $2- 367 $1 $ibl($1,%x) $ibl($1,%x).by $ibl($1,%x).ctime ; decrease var !dec %x } ; send end of channel ban list $2- 368 $1 End of Channel Ban List ; stop, no need to request the banlist !return } ; if there is a , in '$1' we take the first part only ; replace some chars in '$1', see in the alias itself why !tokenize 32 $banlistexec.lower($gettok($1,1,44)) $1- ; add queue '$1-' to the queue banlistexec.queue $+(ban.exec.queue.,$cid) $1- ; check if '$1-' is not already in the hash table if (!$hfind($+(ban.exec.queue.,$cid,.item),$1-,0).data) { ; increase item 'last' in the hash table !hinc -m $+(ban.exec.queue.,$cid,.item) last ; add an item with the value 'last' has with value '$1-' !hadd -m $+(ban.exec.queue.,$cid,.item) $hget($+(ban.exec.queue.,$cid,.item),last) $1- } ; check if the timer does not already run if (!$timer($+($cid,.banlistexec))) { ; start a timer .!timer $+ $cid $+ .banlistexec 1 $$banlistexec.delay banlistexec.dump } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS BANLISTEXEC.DUMP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l banlistexec.dump { ; set the next item !var %chan = $gettok($banlistexec.queue($+(ban.exec.queue.,$cid)).next,1,32) ; '%chan' is something and left char is in '$chantypes' if (%chan) && ($left(%chan,1) isin $chantypes) { ; enable the '#banlistexec' group .!enable #banlistexec ; send ban .!quote MODE %chan +b } ; there are items left in the queue if ($banlistexec.queue($+(ban.exec.queue.,$cid)).size > 0) { ; start a timer to start this alias again .!timer $+ $cid $+ .banlistexec 1 $$banlistexec.restart banlistexec.dump } } ; start of '#banlistexec' group #banlistexec off ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 367 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; raw 367