;Internal ban list script, JesseR (v. 1.2 - nov 29 1998) ;Whenever someone is banned in a channel you're on, their nick is orange (automatically disabled in large channels) ;Adds /unban alias (can be used on a mask, nick (looks up their mask), or a number of bans) on 1:START: .ial on ON !1:JOIN:#:checkban $chan $nick ON 1:JOIN:#:if ( $nick == $me ) { unset %bans. $+ $chan } ON 1:PART:#:if ( $nick == $me ) { unset %bans. $+ $chan } ON 1:KICK:#:if ( $knick == $me ) { unset %bans. $+ $chan } on 1:BAN:#:banadded $chan $banmask on 1:UNBAN:#:banremoved $chan $banmask ON 1:DISCONNECT:unset %bans.* ON 1:NICK:{ ;If someone changes their nick, check if they're banned. set %i 1 :next set %c $comchan($newnick,%i) if ( %c == $null ) { return } checkban %c $newnick inc %i goto next } ;ban list ("/mode #chan +b" stuff) RAW 367:*:if ( $2 ischan ) { banadded $2 $3 } ;end of names (mirc always does /names after joining a channel) - get the ban list, and /who the channel RAW 366:*:if ( $2 ischan ) { if ( $nick($2,0) < 50) { mode $2 +b $+ $chr(10) $+ who $2 } } ;end of who reply - check everyone's userhost against bans IFF the who was on a channel ;RAW 315:*:if ( $2 ischan ) { checkallbans $2 } ;single who reply (may get triggered when it shouldn't, but no big deal) RAW 352:*:if ( $2 ischan ) { checkban $2 $6 } ;these are triggered whenever an event sees a ban getting placed or removed. alias -l banadded { set %bans. $+ $1 $addtok(%bans. [ $+ [ $1 ] ] ,$2,32) if ( $nick($1,0) > 50 ) { return } set %i 1 :loop set %n $nick($1,%i) | if ( %n == $null ) { goto out } set %m $address(%n,5) if ( %m != $null ) { if ( $2 iswm %m ) { cline 7 $1 %n } } inc %i goto loop :out } alias -l banremoved { set %bans. $+ $1 $remtok(%bans. [ $+ [ $1 ] ] ,$2,32) if ( $nick($1,0) > 50 ) { return } set %i 1 :loop set %n $nick($1,%i) | if ( %n == $null ) { goto out } set %m $address(%n,5) if ( %m != $null ) { if ( $2 iswm %m ) { checkban $1 %n } } inc %i goto loop :out } ; /checkban #chan nick - looks at a nick on a channel, sees if it's banned, and changes the color (orange = banned) alias checkban { set %ci 1 set %cr $false set %cg %bans. [ $+ [ $1 ] ] set %ch $address($2,5) | if ( %ch == $null ) { return } :loop set %cb $gettok(%cg,%ci,32) | if ( %cb == $null ) { goto out } if ( %cb iswm %ch ) { set %cr $true | goto out } inc %ci goto loop :out if ( %cr ) { cline 7 $1 $2 } else { cline 1 $1 $2 } unset %cr %ci %cb %ch %ch } ;loops through nicks AND bans on a channel, making sure everything is the right color alias checkallbans { set %c $$1 set %i 0 :loop inc %i set %n $nick(%c,%i) | if ( %n == $null ) { return } checkban %c %n goto loop } ; /unbanthese #channel ban ban ban - unbans each ban, six at a time (this works on dalnet, might have to go to 3 for efnet.) alias unbanthese { unset %u %j set %i 1 :loop inc %i | inc %j set %m $ [ $+ [ %i ] ] | if ( %m == $null ) { goto out } set %u %u %m if ( %j == 6 ) { mode $$1 -bbbbbb %u | unset %j %u } goto loop :out if ( %u != $null ) { mode $$1 - $+ $str(b,$gettok(%u,0,32)) %u } } ;user commands (must be typed in a channel window) alias banlist { set %u %bans. [ $+ [ $$chan ] ] if ( %u == $null ) { echo 7 -a No bans on $chan $+ . | halt } echo 7 -a Ban list for $chan $+ : %u } alias bancount { set %u %bans. [ $+ [ $$chan ] ] if ( %u == $null ) { echo 7 -a There are no bans on $chan $+ . | halt } set %n $gettok(%u,0,32) if ( %n == 1 ) { echo 7 -a There is 1 ban on $chan $+ . | halt } echo 7 -a There are %n bans on $chan $+ . } ;big alias with lots of different syntaxes. channel name is optional. alias unban { set %a $1 | set %c # if ( $1 ischan ) { set %c $1 | set %a $2 } if ( $me !isop %c ) { echo 4 -a You're not an op on %c $+ . } set %v %bans. [ $+ [ %c ] ] set %w $gettok(%v,0,32) if ( %a == $null ) { set %a 1 } ; /unban [chan] number = unban the last # bans that were set (assuming order is correct) if ( %a == 0 ) { set %a 99 } if ( %a isnum ) { if ( %a > %w ) { unbanthese %c %v | halt } unbanthese %c $gettok(%v, [ [ $calc(%w - %a + 1) ] $+ - $+ [ %w ] ] ,32) | halt } ; /unban [chan] nick!user@host (or mask) = unban all bans matching "in either direction" ; $chr(42) = * if ( @ isin %a ) { unbanmask %c %a | halt } if ( $chr(42) isin %a ) { unbanmask %c %a | halt } ; /unban [chan] nick = unban nick from channel. ; if the nick is in my internal address list, do an /unbanmask on his full n!u@h. set %m $address(%a,5) if ( %m != $null ) { unbanmask %c %m | halt } ; do a userhost on the nick, then /unbanmask it set -u6 %unban.n %a set -u6 %unban.c %c userhost %a } ;userhost reply - for /unban nick RAW 302:*:{ ;extract n!u@h from userhost :/ if ( %unban.c !ischan ) { return } set %n $gettok($2,1,61) if ( $chr(42) isin %n ) { set %n $left(%n,$calc($len(%n) - 1)) } if ( %n != %unban.n ) { return } set %h $mid($gettok($2,2,61),2,100) set %z %n $+ ! $+ %h unbanmask %unban.c %z halt } alias unbanmask { ; this removes any bans that match the given mask (either way) ;examples: /unban * = all bans, /unban n!u@h = all bans that would stop this person set %c $$1 set %m $$2 set %v %bans. [ $+ [ %c ] ] set %i 1 unset %u echo 7 %c Unbanning %m :next set %b $gettok(%v,%i,32) | if ( %b == $null ) { goto out } if ((%b iswm %m) || (%m iswm %b)) { set %u %u %b } inc %i goto next :out if ( %u == $null ) { echo 7 -a No bans would stop or match %m $+ . | halt } unbanthese %c %u halt }