;=================== badword ==================
alias swear { 
  dialog -m swear swear
  if ($dialog(swear) != $null) {
    set %stemp 2
    :start
    inc %stemp 2
    dialog -s swear $dialog(swear).x $dialog(swear).y %stemp 245
    if (%stemp >= 240) { goto done }
    goto start 
    :done
  }
}
dialog swear {
  title "Metal [X]Primitive Badword"
  size -1 -1 250 240
  edit "", 1, 5 5 150 25
  list 2, 5 35 150 220, sort
  button "&Add", 3, 160 5 75 25, flat
  button "&Remove", 4, 160 35 75 25, flat
  button "&OK", 5, 160 65 75 25, OK flat
  check "&Kick",6, 160 140 85 20
  check "&Ban",7,160 160 85 20
  text "Ban time" ,8,160 185 50 20
  edit "",9,160 205 40 20
  text "Secs",10, 200 210 50 20
}
on *:dialog:swear:init:*: {
  set -u0 %swear $lines(swear.txt)
  if (%swkick == on) { .did -c swear 6 }
  if (%swban == on) { .did -c swear 7 } 
  did -ra swear 9 %swbtime
  if (%swear == 0) || (%swear == $null) { goto end }
  :loop
  did -a swear 2 $read -l [ $+ [ %swear ] ] swear.txt
  dec %swear
  if (%swear =< 0) { goto end }
  goto loop
  :end
}
on *:dialog:swear:sclick:*: {
  if ($did == 3) && ($len($did(1).text) > 0) && ($swearin($did(1).text) == $false) { splay -w reload.wav | did -a swear 2 $did(1).text | write swear.txt $did(1).text | did -r swear 1 | write swear.txt $did(1).text }
  if ($did == 4) && ($did(2,1).sel > 0) { swearrem $did(2,$did(2,1).sel).text | did -d swear 2 $did(2,1).sel }
  if ($did == 5) { %swbtime = $did(9) | .timer -mo 1 1 fade_out $dname | halt }
  if ($did == 6) {
    if ($did(6).state == 1) { %swkick = on }
    if ($did(6).state == 0) { %swkick = off }
  }
  if ($did == 7) {
    if ($did(7).state == 1) { %swban = on }
    if ($did(7).state == 0) { %swban = off }
  }
}
alias swearin set -u0 %swear $lines(swear.txt) | if (%swear == 0) || (%swear == $null) { return $false | goto end } | :loop | if ($1- == $read -l [ $+ [ %swear ] ] swear.txt) { return $true | goto end } | dec %swear | if (%swear =< 0) { return $false | goto end } | goto loop | :end
alias swearrem set -u0 %swear $lines(swear.txt) | if (%swear == 0) || (%swear == $null) { goto end } | :loop | if ($1- == $read -l [ $+ [ %swear ] ] swear.txt) { write -dl [ $+ [ %swear ] ] swear.txt | goto end } | dec %swear | if (%swear <= 0) { goto end } | goto loop | :end
alias fswear set -u0 %swear $lines(swear.txt) | set -u0 %swearn 0 | :loop | set -u0 %sweart $read -l [ $+ [ %swear ] ] swear.txt | inc %swearn $wildtok($1-, %sweart, 0, 32) | dec %swear | if (%swear == 0) { return %swearn | halt } | if (%swear > 0) { goto loop }
on *:text:*:#: ksw  $nick # $1-
on *:action:*:#: ksw $nick # $1-
on *:notice:*:#: ksw  $nick # $1-
alias ksw {
  if ($1 isop $2) halt 
  if ($nick isvo #) && (%kickvop == »Ô´) { goto end }
  if ($fswear($3-) > 0) {
    if (%swkick == on) { kick # $nick $logopro1 text "5 $+ $3- $+ 7" bad $logopro2 }
    if (%swban == on) { ban -u $+ %swbtime $2 $1 3 }
  }
  :end
}
