;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IBL-UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;info: ; ; by wiebe @ QuakeNet ; version 1.0 (written and tested on mIRC 6.14) ; ; last edit: Fri Mar 26 2004 ; ; ;What does this script do? ; ; updates the IBL ; ; ;How to use this script? ; ; config the options below ; ; ;Why is this script good? ; ; script will request the banlist for channel according to your highest prefix on the channel ; meaning, @ (op) goes before % (halfop), then + (voice) and regular as last ; or whatever prefixes are supported on the server, script uses $prefix identifier ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IBL-UPDATE.CONF.DELAY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l ibl-update.conf.delay { ; N seconds after the last join, the script starts to update the IBL return 30 } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IBL-UPDATE.CONF.REPEAT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l ibl-update.conf.repeat { ; wait N seconds after doing /mode chan +b to do the next return 15 } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IBL-UPDATE.CONF.SHOW ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l ibl-update.conf.show { ; set this to 1 if you want the script to echo when the banlist is updated return 1 } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; JOIN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:join:#:{ ; we join, timer does not run if ($nick == $me) && (!$timer($+($cid,.ibl-update.update))) { ; start a timer .timer $+ $cid $+ .ibl-update.update 1 $$ibl-update.conf.delay ibl-update.update } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LOAD EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:load:{ ; start a timer .timer $+ $cid $+ .ibl-update.update 1 $$ibl-update.conf.delay ibl-update.update } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IBL-UPDATE.UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l ibl-update.update { ; connected if ($status == connected) { ; hash table does not exist if (!$hget($+(ibl-update.,$cid))) { ; set a var with the channels we need to who var %c = $ibl-update.sort ; something is in there if (%c) { ; add to hash table hadd -m $+(ibl-update.,$cid) chan $comchan($me,%c) ; send the who request mode $comchan($me,%c) +b } } ; requested banlist or the hash table was not empty if (%c) || ($hget($+(ibl-update.,$cid))) { ; start a timer to run this alias again .timer $+ $$ctimer 1 $ibl-update.conf.repeat ibl-update.update } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IBL-UPDATE.SORT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; $ibl-update.sort ; sorts channels where the IBL is not updated ; . ; example: ; 3000004.1 2000001.2 1000001.3 1.4 ; op 4 users chan nr 1 halfop 1 user chan nr 2 voice 1 user chan nr 3 regular 1 user chan nr 4 ; or whatever prefixes are on the server alias -l ibl-update.sort { ; called as identifier if ($isid) { ; set a var var %x = 1, %c, %p = $len($prefix), %prefix ; loop through the prefixes while (%p) { ; add to var var %prefix = $addtok(%prefix,$mid($prefix,%p,1),46) ; next prefix dec %p } ; loop through all common channels that we have with ourself while (%x <= $comchan($me,0)) { ; check if the ibl is not updated or busy if ($chan($comchan($me,%x)).ibl == $false) { ; set var with channel var %chan = $comchan($me,%x) ; set var with number of nicks var %nicks = $nick(%chan,0) ; set var with our highest prefix on the channel var %prefixme = $left($remove($nick(%chan,$me).pnick,$me),1) ; set var with place of our highest prefix times 100000 ; (big, no channel should ever come close to this number of users) var %value = $calc($iif($findtok(%prefix,%prefixme,46),$ifmatch,0) * 1000000) ; set var with number of nicks + the value based on our highest prefix var %nicks = $calc(%nicks + %value) ; add to the var var %c = $addtok(%c,$+(%nicks,.,%x),32) } ; go to the next channel inc %x } ; return the channel number with the highest score return $gettok($gettok($sorttok(%c,32,nr),1,32),2,46) } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 367 BANLIST ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; raw 367 me chan ban nick ctime raw 367:& & & & *:{ ; check hash table if ($hget($+(ibl-update.,$cid),chan) == $2) { ; stop raw haltdef } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 368 BANLIST END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; raw 368 me chan :End of channel ban list raw 368:& & end of channel ban list*:{ ; check hash table if ($hget($+(ibl-update.,$cid),chan) == $2) { ; free hash table hfree $+(ibl-update.,$cid) ; stop raw haltdef ; check setting if ($ibl-update.conf.show == 1) { ; more then 1 ban if ($ibl($2,0) > 1) { ; echo some info echo -ti2 $2 * IBL updated ( $+ $ibl($2,0) bans, newest $ibl($2,1) by $gettok($ibl($2,1).by,1,33) at $asctime($ibl($2,1).ctime, ddd dd mmm yyyy) ( $+ $gettok($duration($calc($ctime - $ibl($2,1).ctime)),1-2,32) ago) $+ ) } ; 1 ban elseif ($ibl($2,0) == 1) { ; echo some info echo -ti2 $2 * IBL updated ( $+ $ibl($2,0) ban, $ibl($2,1) by $gettok($ibl($2,1).by,1,33) at $asctime($ibl($2,1).ctime, ddd dd mmm yyyy) ( $+ $gettok($duration($calc($ctime - $ibl($2,1).ctime)),1-2,32) ago) $+ ) } ; 0 bans else { ; echo some info echo -ti2 $2 * IBL updated (0 bans) } } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DISCONNECT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:disconnect:{ ; check hash table if ($hget($+(ibl-update.,$cid))) { ; free hash table hfree $+(ibl-update.,$cid) } }