/* * Ban related stuff for TekNap * * Author: Brian Weiss - 2000, 2001 * * Last modified: 9/16/01 (bmw) */ alias admin { switch ($0) { (banlist) { @ delarray(banlist) raw 615 } (*) {//admin $*} } } alias ban (ban, reason) { if (ban) { fe ($sar(g/,/ /$ban)) xx { raw 612 $xx \"$reason\" } }{ xecho -b Usage: /ban [reason] } } alias bankill (nick, reason) { if (nick) { fe ($sar(g/,/ /$nick)) newnick { raw 612 $newnick \"$reason\" raw 610 $newnick \"$reason\" } }{ xecho -b Usage: /bankill [reason] } } alias banlist (void) { @ delarray(banlist) raw 615 } alias bans banlist alias bk (nick, reason) { if (nick) { raw 422 $C $nick \"$reason\" raw 829 $C $nick \"$reason\" }{ xecho -b Usage: /bk [reason] xecho -b - Bans then kicks from the current channel } } alias cban (chan, ban, reason) { if (chan && ban) { raw 422 $chan $ban \"$reason\" }{ xecho -b Usage: /cban [reason] } } alias cbanclear (chan, void) { if (chan) { raw 424 $chan }{ xecho -b Usage: /cbanclear } } alias cbanlist (chan default "$C", void) { if (chan) { @ delarray(cbanlist) raw 420 $chan }{ xecho -b You must be in a channel to use this feature. } } alias cbans cbanlist alias ctban (chan default "$C", void) { if (chan) { /* * This is a bit of a hack, but is needed because the scope of local * variables doesn't extend to /input */ @ CHANNEL = chan cbanlist $chan input "Which ban(s) to remove? (1, 2-5, ...) " if ([$0]) { fe ($*) bannum { @ :tban1 = before(- $bannum) @ :tban2 = after(- $bannum) if (tban1 < tban2 && tban1 < numitems(cbanlist) && tban2 <= numitems(cbanlist)) { for (@ count = tban1, count <= tban2, @ count++) { @ :ban = word(0 $getitem(cbanlist ${count - 1})) raw 423 $CHANNEL $ban } }{ if (bannum <= numitems(cbanlist)) { @ :ban = word(0 $getitem(cbanlist ${bannum - 1})) raw 423 $CHANNEL $ban } } } } wait @ CHANNEL = [] }{ xecho -b You must be in a channel to use this feature. } } alias cunban (chan, ban) { if (chan && ban) { fe ($ban) uban { raw 423 $chan $uban } }{ xecho -b Usage: /cunban [ban2] ... } } alias tban (void) { banlist input "Which ban(s) to remove? (1, 2-5, ...) " if ([$0]) { fe ($*) bannum { @ :tban1 = before(- $bannum) @ :tban2 = after(- $bannum) if (tban1 < tban2 && tban1 < numitems(banlist) && tban2 <= numitems(banlist)) { for (@ count = tban1, count <= tban2, @ count++) { @ :ban = word(0 $getitem(banlist ${count - 1})) raw 614 $ban } }{ if (bannum <= numitems(banlist)) { @ :ban = word(0 $getitem(banlist ${bannum - 1})) raw 614 $ban } } } } } alias tempban (time, ban, reason) { if (time && ban) { raw 612 $ban \"$reason\" timer $time raw 614 $ban }{ xecho -b Usage: /tempban [reason] xecho -b - Bans for } } alias unban (bans) { if (bans) { fe ($bans) ban { raw 614 $ban } }{ xecho -b Usage: /unban [ban2] [ban3].. } } /* * End of channel ban list. Display contents of the cbanlist array. */ on ^420 "*" { if (numitems(cbanlist)) { ^local count xecho -- # SETBY DATE BAN for (@ count = [0], numitems(cbanlist) > count, @ count++) { ^local ban,bannum,bantime,reason,setby @ ban = word(0 $getitem(cbanlist $count)) @ bannum = count + 1 @ bantime = word(3 $getitem(cbanlist $count)) @ reason = word(2 $getitem(cbanlist $count)) @ setby = word(1 $getitem(cbanlist $count)) echo $cparse([%W$[3]bannum%n]) $[10]setby $[8]strftime($bantime %x) $ban \"$reason\" } }{ xecho -b No bans for this channel. } } /* * Channel ban list entry. Store in the cbanlist array. */ on ^421 "*" { @ setitem(cbanlist $numitems(cbanlist) $*) } /* * End of server ban list. Display contents of the banlist array. */ on ^615 "*" { if (numitems(banlist)) { ^local count xecho -- # SETBY DATE BAN for (@ count = [0], numitems(banlist) > count, @ count++) { ^local ban,bannum,bantime,reason,setby @ ban = word(0 $getitem(banlist $count)) @ bannum = count + 1 @ bantime = word(3 $getitem(banlist $count)) @ reason = word(2 $getitem(banlist $count)) @ setby = word(1 $getitem(banlist $count)) echo $cparse([%W$[3]bannum%n]) $[10]setby $[8]strftime($bantime %x) $ban \"$reason\" } }{ xecho -b No bans for this server. } } /* * Server ban list entry. Store in the banlist array. */ on ^616 "*" { @ setitem(banlist $numitems(banlist) $*) } /* bmw '01 */