;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PUTKICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ;info: ; by wiebe @ QuakeNet ; ; version 1.0 (written and tested on mIRC 6.14) ; last edit: Sun Mar 14 2004 ; ; ;What does this script do? ; ; sends kicks through a queue ; ; ;How to use this script? ; ; putkick [-fc] [kick message] ; ; the -c switch can be used to clear the queue ; putkick -c clears the queue for all channels ; putkick -c #channel clears the queue for #channel ; ; the -f switch is optional, it means the kick will be send ; even if nick is not on the channel, usefull when dealing with hidden users ; when channelmode D/d is set (QuakeNet) ; putkick -f #channel nick ; ; the script makes use of the ialmark feature, meaning that targets can change nick ; but the script will still find and kick them ; only works when the ial is on and the user is in the ial ; the script does only add/remove its sign from the ialmark, it wont delete other parts in it ; other scripts that change the ialmark may break it however ; ; script works with op and halfop, where halfop can only kick voices, regulars and hidden users ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS PUTKICK.START ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set here the maximum delay (seconds) putkick should have the first time it is called alias -l putkick.start { return 2 } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS PUTKICK.RESTART ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set here the delay (seconds) putkick should have between multiple kicks alias -l putkick.restart { return 4 } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS PUTKICK.ECHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set this to 1 if you want that putkick echos what kicks are being send out alias -l putkick.echo { return 1 } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS PUTKICK.ECHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set here the default kick message, this will be used if no kick message is specified alias -l putkick.msg { return moo } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS PUTKICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; [-fc], $1 = channel, $2 = nick, $3- = reason alias putkick { if ($1 == -f) && ($3) { tokenize 32 $2 $+($1,$3) $4- } elseif ($1 == -c) { if ($2) { $putkick.queue($+($cid,.putkick.*)).clear } else { $putkick.queue($+($cid,.putkick.,$hash($lower($1),32))).clear } return } ; place '$2-' the target and the kick message in the queue for '$1' putkick.queue $+($cid,.putkick.,$hash($lower($1),32)) $lower($1) $2- ; check if the timer does not already run if (!$timer($+($cid,.putkick.,$hash($lower($1),32)))) { ; start a timer .timer $+ $cid $+ .putkick. $+ $hash($lower($1),32) 1 $putkick.start putkick.dump $1 } ; alias is called as an identifier ($alias) if ($isid) { ; return 'done' return done } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS PUTKICK.DUMP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; $1 = chan alias -l putkick.dump { :start ; set a var with the next item in queue for '$1' var %item = $putkick.queue($+($cid,.putkick.,$hash($lower($1),32))).next ; set a var to target var %target = $gettok(%item,2,32) var %number = $gettok(%item,1,32) var %reason = $gettok(%item,3-,32) while (*!*@* !iswm %target) && (%target !ison $1) && ($left(%target,2) != -f) { ; set a var with the next item in queue for '$1' var %item = $putkick.queue($+($cid,.putkick.,$hash($lower($1),32))).next if (%item == $null) { return } ; set a var to target var %target = $gettok(%item,2,32) var %number = $gettok(%item,1,32) var %reason = $gettok(%item,3-,32) } if (*!*@* iswm %target) { var %x = $ialchan($mask(%target,0),$1,0) while (%x) { if ($gettok($wildtok($ial($ialchan($mask(%target,0),$1,%x).nick).mark,$+(putkick-,$hash($lower($1),32),-*),1,32),3,45) == %number) { var %target = $ialchan($mask(%target,0),$1,%x).nick .ialmark %target $remove($ial(%target).mark,$wildtok($ial($ialchan($mask(%target,0),$1,%x).nick).mark,$+(putkick-,$hash($lower($1),32),-*),1,32)) break } dec %x } if (%x == 0) { var %x = $ial($mask(%target,0),0) while (%x) { if ($gettok($wildtok($ial($ial($mask(%target,0),%x).nick).mark,$+(putkick-,$hash($lower($1),32),-*),1,32),3,45) == %number) { var %target = $ial($mask(%target,0),%x).nick .ialmark %target $remove($ial(%target).mark,$wildtok($ial($ial($mask(%target,0),%x).nick).mark,$+(putkick-,$hash($lower($1),32),-*),1,32)) } dec %x } goto start } } elseif ($left(%target,2) == -f) { var %target = $right(%target,-2) } ; op checks if ($me isop $1) || (($me ishop $1) && ((%target isvoice $1) || (%target isreg $1))) { ; check for echo setting if ($putkick.echo == 1) { ; echo what to kick echo -t $1 putkick kicking: %target %reason } if (%reason == $null) { var %reason = $putkick.msg } .quote KICK $1 %target $+(:,%reason) } ; still items in queue? if ($putkick.queue($+($cid,.putkick.,$hash($lower($1),32))).size > 0) { ; start timer for next round .timer $+ $cid $+ .putkick. $+ $hash($lower($1),32) 1 $putkick.restart putkick.dump $1 } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS PUTKICK.QUEUE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; $1 = table, $2 = chan, $3 = nick, $4- = reason alias -l putkick.queue { ; we got a 2nd parameter if ($prop == $null) && ($2 != $null) { ;if ($hfind($1,$replace($2,\,\\,|,\|,$chr(40),$+(\,$chr(40)),$chr(41),$+(\,$chr(41)),$chr(91),$+(\,$chr(91)),$chr(93),$+(\,$chr(93)),^,\^,$chr(123),$+(\,$chr(123)),$chr(125),$+(\,$chr(125)),.,\.,$,\$,+,\+,*,\*,?,\?) $+ (\s.*)?, 0,r).data == 0) && ($hfind($1,-f $+ $replace($2,\,\\,|,\|,$chr(40),$+(\,$chr(40)),$chr(41),$+(\,$chr(41)),$chr(91),$+(\,$chr(91)),$chr(93),$+(\,$chr(93)),^,\^,$chr(123),$+(\,$chr(123)),$chr(125),$+(\,$chr(125)),.,\.,$,\$,+,\+,*,\*,?,\?) *, 0,r).data == 0) { if ($hfind($1,& $3 *,0,w).data == 0) && ($hfind($1,& $3,0,w).data == 0) && ($hfind($1,& $+(-f,$3) *,0,w).data == 0) && ($hfind($1,& $+(-f,$3) *,0,w).data == 0) { ; increase item 'last' hinc -m $1 last if ($left($3,2) == -f) || (!$ial) || (!$ial($3)) { hadd -m $1 $hget($1,last) $hget($1,last) $3- } else { hadd -m $1 $hget($1,last) $hget($1,last) $ial($3) $4- .ialmark $gettok($3,1,33) $ial($gettok($3,1,33)).mark $+(putkick-,$hash($lower($2),32),-,$hget($1,last)) } } } ; called as identifier ($alias) and propertie is next ($alias().next) elseif ($isid) && ($prop == next) && ($hget($1)) { ; increase item 'first' hinc -m $1 first ; 'first' is smaller or equal to 'last' if ($hget($1,first) <= $hget($1,last)) { ; store next item in var '%next' var %next = $hget($1,$hget($1,first)) ; delete this item from the hashtable hdel $1 $hget($1,first) ; this is the last item if ($hget($1,first) >= $hget($1,last)) { ; free the hash table hfree $1 } ; return '%next' return %next } } ; called as identifier ($alias) and propertie is size ($alias().size) elseif ($isid) && ($prop == size) { ; decrease number of items with 1, (1 item in queue, and last is there) return $iif($calc($hget($1,0).item -1) >= 0,$ifmatch,0) } ; called as identifier ($alias) and propertie is clear ($alias().clear) elseif ($isid) && ($prop == clear) { ; free hashtables that match $1 hfree -w $1 } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DISCONNECT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:disconnect:{ ; clear the queues putkick -c }