alias swear {
  set %stardust $dialog(swear)
  if (%stardust) unset %stardust
  else dialog -m swear swear
}

dialog swear {
  title "Protezioni: SwearKick"
  size -1 -1 300 382
  box "Lista Offese", 3, 9 48 136 272
  box "", 20, 9 -2 240 47
  box "", 21, 148 41 100 280 
  button "Aggiungi", 2, 153 57 88 24
  button "Togli", 5, 153 81 88 24
  check "On / Off", 6, 170 303 56 13
  button "Chiudi", 7, 170 273 56 24, cancel
  button "Ok", 8, 170 249 56 24, ok
  button "Antispam", 9, 153 105 88 24
  text "S w e a r k i c k  S y s t e m" 4, 23 14 239 34
  icon 11, 185 145 36 35, $shortfn($mircdir\Graphic\Sith_icons\guardia2.ico)
  box "Punizione", 13, 9 328 240 48
  radio " Ignora", 14, 17 349 48 13
  radio " Kick", 16, 73 349 40 13
  radio " Ban/kick", 17, 121 349 64 13
  edit "Inserisci parola", 19, 16 72 122 26, multi return center
  text "sec", 15, 224 349 17 13
  edit "", 18, 187 344 34 22, multi return
  list 1, 16 104 124 202, size
}

on *:DIALOG:swear:init:0: {
  did -ca swear 18 %swearbansecond
  /dll mdx SetMircVersion $version
  /dll mdx MarkDialog $dname
  /dll mdx SetBorderStyle $dname 2,5,7,8,9 staticedge
  /dll mdx SetBorderStyle $dname 3,13 staticedge
  /dll  mdx SetColor $dname 13,14,15,16,17 text $rgb(0,0,0)
  /dll mdx SetFont $dname 3,13 +a 13 800 Tahoma
  /dll mdx SetFont $dname 4 +ai 20 800 Arial  
  /dll  mdx SetColor $dname 4 text $rgb(100,100,100)
  /dll mdx SetDialog $dname icon 0 $mircdir\Graphic\Sith_icons\guardia2.ico
  /dll mdx SetFont $dname 7,8 +a 12 600 tahoma
  /dll mdx SetControlMDX $dname 1  ListView report flatsb single grid > views.mdx
  did -i $dname 1 1 headerdims 103
  did -i $dname 1 1 headertext L i s t a  P a r o l e $chr(9)
  did -i $dname 1 1 setbkg url tile $mircdir\Graphic\Sith_skin\sfondo1.jpg 
  did -i $dname 1 1 settxt bgcolor $rgb(208,224,240)
  did -i $dname 1 1 seticon list 0 $mircdir\Graphic\Sith_icons\foglio.ico  

  if (%volg.parole) { volg.parole }
  if (%swear == off) { did -u swear 6  |  /did -b swear 1 }
  if (%swear == on) { did -c swear 6  |  /did -e swear 1 }
  if (%azioneswear2 == ignore) { did -c swear 14 }
  if (%azioneswear2 == kick) { did -c swear 16 }
  if (%azioneswear2 == ban) { did -c swear 17 }
}

on *:dialog:swear:sclick:2:aggiungi.parola | /splay sounds/tlak

on *:dialog:swear:sclick:5:togli.parola | /splay sounds/tlak

on *:dialog:swear:sclick:9: { /splay sounds/CLICK | dialog -m antispam antispam }


on *:dialog:swear:sclick:6: {   
  if (%swear == on) { set %swear off  | /did -b swear 1 | .disable #swear }   
  elseif (%swear == off) { set %swear on | /did -e swear 1 | .enable #swear }
  /splay sounds/Click2 
}

on *:dialog:swear:sclick:14: { set %azioneswear1 ignore -u120  | set %azioneswear2 ignore | /splay sounds/Click2  }

on *:dialog:swear:sclick:16: { set %azioneswear1 kick | set %azioneswear2 kick | /splay sounds/Click2 }

on *:dialog:swear:sclick:17: { set %azioneswear1 ban -u $+ %swearbansecond $+  |  set %azioneswear2 ban | /splay sounds/Click2 }

on *:dialog:swear:edit:18:  { set %swearbansecond $did(18) } 

alias aggiungi.parola  {
  if ($did(swear,19).text) && ($findtok(%volg.parole,$did(swear,19).text,0,44) < 1) && ($chr(46) !isin $did(swear,19).text) { 
    %volg.parole = $addtok(%volg.parole,$did(swear,19).text,44) 
    did -a swear 1 $did(swear,19).text 
    did -r swear 19
  }
}
alias togli.parola  {
  if ($did(swear,1).sel) {
    :loop 
    %volg.parole = $remtok(%volg.parole,$did(swear,1,$did(swear,1).sel).text,44) 
    did -d swear 1 $did(swear,1).sel 
    if ($did(swear,1,0).sel > 0) { 
      goto loop
    } 
  }
}

alias -l volg.parole {
