ban {
;ban [-ejknqruN] [#channel] nickname [type]
;I haven't looked at the -(u)ek and -(u)rk combos yet
;Will not work for more than 4 type j, or otherwise more than 12 nicks
if ($left($1,1) == $chr(45)) {
;there is a switch
if (*u* iswmcs $1) {
;To take the uN off the end
var %notuswitches = $gettok($1,1,117)
;To get the time to unban out
var %unban = $gettok($1,2,117)
if (*k* iswmcs $1) {
;To take the k out
var %notkswitches = $gettok(%notuswitches,1,107) $+ $gettok(%notuswitches,2,107)
}
if (*r* !iswmcs $1) {
;To put the r in
var %laterswitches = -r $+ $gettok(%notkswitches,1,45)
}
else {
;To take the r out, ie remove a ban/except now, then put it back later
var %laterswitches = - $+ $gettok(%notkswitches,1,114) $+ $gettok(%notkswitches,2,114)
}
;To undo the immediate thing
.timer 1 %unban ban %laterswitches $2-
}
if (*e* iswmcs $1) {
;Adding/removing exceptions
var %mainmode = e
var %minormode = b
}
else {
;Adding/removing bans
;These settings by default
var %mainmode = b
var %minormode = e
}
if (*r* iswmcs $1) {
;removing exceptions/bans
var %exceptsign = +
var %bansign = -
}
else {
;adding exceptions/bans
;These settings by default
var %exceptsign = -
var %bansign = +
}
if ($left($2,1) == $chr(35)) {
;there is a channel
if ($calc($4) != 0) {
;there is a bantype
var %chans = $2, %nicks = $3, %bantype = $4, %reason = $5-
if (*j* iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %nick = $gettok(%nicks,%counter,58)
var %modes = %modes $+ %bansign $+ %mainmode $+ %minormode $+ %minormode
var %params = %params $address(%nick,%bantype) ~n: $+ $address(%nick,%bantype) ~q: $+ $address(%nick,%bantype)
inc %counter
}
}
if (*n* iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1
var %extban = ~n:
while (%counter <= %total) {
var %nick = $gettok(%nicks,%counter,58)
var %modes = %modes $+ %bansign $+ %mainmode
var %params = %params %extban $+ $address(%nick,%bantype)
inc %counter
}
}
if (*q* iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1
var %extban ~q:
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params %extban $+ $address(%nick,%bantype)
inc %counter
}
}
if (*j* !iswmcs $1) {
if (*n* !iswmcs $1) {
if (*q* !iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params $address(%nick,%bantype)
inc %counter
}
}
}
}
}
else {
;there is not a bantype
var %chans = $2, %nicks = $3, %bantype = 2, %reason = $4-
if (*j* iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %nick = $gettok(%nicks,%counter,58)
var %modes = %modes $+ %bansign $+ %mainmode $+ %minormode $+ %minormode
var %params = %params $address(%nick,%bantype) ~n: $+ $address(%nick,%bantype) ~q: $+ $address(%nick,%bantype)
inc %counter
}
}
if (*n* iswmcs $1) {
var %total $numtok(%nicks,58)
var %counter = 1
var %extban = ~n:
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params %extban $+ $address(%nick,%bantype)
inc %counter
}
}
if (*q* iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1
var %extban = ~q:
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params %extban $+ $address(%nick,%bantype)
inc %counter
}
}
if (*j* !iswmcs $1) {
if (*n* !iswmcs $1) {
if (*q* !iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params $address(%nick,%bantype)
inc %counter
}
}
}
}
}
}
else {
;there is not a channel
if ($calc($3) != 0) {
;there is a bantype
var %chans = $chan, %nicks = $2, %bantype = $3, %reason = $4-
if (*j* iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %nick = $gettok(%nicks,%counter,58)
var %modes = %modes $+ %bansign $+ %mainmode $+ %minormode $+ %minormode
var %params = %params $address(%nick,%bantype) ~n: $+ $address(%nick,%bantype) ~q: $+ $address(%nick,%bantype)
inc %counter
}
}
if (*n* iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1, %bantype = $3, %extban ~n:
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params %extban $+ $address(%nick,%bantype)
inc %counter
}
}
if (*q* iswmcs $1) {
var %total $numtok(%nicks,58)
var %counter = 1, %bantype = $3, %extban = ~q:
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params %extban $+ $address(%nick,%bantype)
inc %counter
}
}
if (*j* !iswmcs $1) {
if (*n* !iswmcs $1) {
if (*q* !iswmcs $1) {
var %total = $numtok(%nicks,58), %counter = 1, %bantype = $3
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params $address(%nick,%bantype)
inc %counter
}
}
}
}
}
else {
;there is not a bantype
var %chans = $chan, %nicks = $2, %bantype = 2, %reason = $3-
if (*j* iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %nick = $gettok(%nicks,%counter,58)
var %modes = %modes $+ %bansign $+ %mainmode $+ %minormode $+ %minormode
var %params = %params $address(%nick,%bantype) ~n: $+ $address(%nick,%bantype) ~q: $+ $address(%nick,%bantype)
inc %counter
}
}
if (*n* iswmcs $1) {
var %total $numtok(%nicks,58)
var %counter = 1, %extban ~n:
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params %extban $+ $address(%nick,%bantype)
inc %counter
}
}
if (*q* iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1, %extban = ~q:
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params %extban $+ $address(%nick,%bantype)
inc %counter
}
}
if (*j* !iswmcs $1) {
if (*n* !iswmcs $1) {
if (*q* !iswmcs $1) {
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params $address(%nick,%bantype)
inc %counter
}
}
}
}
}
}
}
else {
;there is not a switch
var %mainmode = b, %minormode = e, %exceptsign = -, %bansign = +
if ($left($1,1) == $chr(35)) {
;there is a channel
if ($calc($3) != 0) {
;there is a bantype
var %chans = $1, %nicks = $2, %bantype = $3
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params $address(%nick,%bantype)
inc %counter
}
}
else {
;there is not a bantype
var %chans = $1, %nicks = $2, %bantype = 2
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params $address(%nick,%bantype)
inc %counter
}
}
}
else {
;there is not a channel
if ($calc($2) != 0) {
;there is a bantype
var %chans = $chan, %nicks = $1, %bantype = $2
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %modes %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params $address(%nick,%bantype)
inc %counter
}
}
else {
;there is not a bantype
var %chans = $chan, %nicks = $1, %bantype = 2
var %total = $numtok(%nicks,58)
var %counter = 1
while (%counter <= %total) {
var %modes = %modes $+ %bansign $+ %mainmode
var %nick = $gettok(%nicks,%counter,58)
var %params = %params $address(%nick,%bantype)
inc %counter
}
}
}
}
mode %chans %modes %params
if ($left($1,1) == $chr(45)) {
;If there is a switch
if (*k* iswmcs $1) kick %chans %nicks %reason
}
}
kick {
;seperate targets with a :
var %kick.chan.total $numtok($1,58)
var %kick.nick.total $numtok($2,58)
var %kick.nick.counter 1
while (%kick.nick.counter <= %kick.nick.total) {
var %kick.chan.counter 1
while (%kick.chan.counter <= %kick.chan.total) {
kick $gettok($1,%kick.chan.counter,58) $gettok($2,%kick.nick.counter,58) $iif($3,$3-,15Scatter 14...13Senbonzakura!)
inc %kick.chan.counter
}
inc %kick.nick.counter
}
}
mode {
;seperate targets with a :
var %mode.chan.total $numtok($1,58)
var %mode.chan.counter 1
while (%mode.chan.counter <= %mode.chan.total) {
mode $gettok($1,%mode.chan.counter,58) $2-
inc %mode.chan.counter
}
}