alias Suoni_c { dialog -m suoni_c suoni_c }
dialog Suoni_c {
  title "Suoni"
  size -1 -1 75 130
  option dbu
  box "Abilita/Disabilita", 3, 5 5 65 100
  check "On NetSplit", 21, 16 25 50 10
  check "On Join Me", 1, 16 35 50 10
  check "On Ban/Kick/Deop", 2, 16 45 52 10
  check "On Notice/Invite", 4, 16 55 50 10
  check "On CTCP", 16, 16 65 50 10
  check "On Clone", 18, 16 75 50 10 
  check "Ti Cercano", 19, 16 85 50 10 
  button "Ok", 5, 22 113 32 12, ok
}
on *:DIALOG:suoni_c:sclick:1: { Set %c1 $did(1) }
on *:DIALOG:suoni_c:sclick:2: { Set %c2 $did(2) }
on *:DIALOG:suoni_c:sclick:4: { Set %c4 $did(4) }
on *:DIALOG:suoni_c:sclick:16: { Set %c3 $did(16) }
on *:DIALOG:suoni_c:sclick:21: { Set %c5 $did(21) }
on *:DIALOG:suoni_c:sclick:18: { Set %c10 $did(18) }
on *:DIALOG:suoni_c:sclick:19: { Set %c19 $did(19) }
on *:dialog:suoni_c:init:*: {
  if %c1 = ON { did -c suoni_c 1 }  
  if %c2 = ON { did -c suoni_c 2 } 
  if %c3 = ON { did -c suoni_c 16 }
  if %c4 = ON { did -c suoni_c 4 }
  if %c5 = ON { did -c suoni_c 21 }
  if %c10 = ON { did -c suoni_c 18 }
  if %c19 = ON { did -c suoni_c 19 }
}

on *:dialog:suoni_c:sclick:5: { 
  if ($did(suoni_c,1).state = 1) { %c1 = on } | else { %c1 = off }
  if ($did(suoni_c,2).state = 1) { %c2 = on } | else { %c2 = off }
  if ($did(suoni_c,4).state = 1) { %c4 = on } | else { %c4 = off }
  if ($did(suoni_c,16).state = 1) { %c3 = on } | else { %c3 = off }
  if ($did(suoni_c,21).state = 1) { %c5 = on } | else { %c5 = off }
  if ($did(suoni_c,18).state = 1) { %c10 = on } | else { %c10 = off }
  if ($did(suoni_c,19).state = 1) { %c19 = on } | else { %c19 = off }
}

on ^1:NOTICE:*:#:{ if ( %c4 == on ) { splay sounds\notice.wav | haltdef }
}
on ^1:NOTICE:*:?:{ if ( %c4 == on ) { splay sounds\notice.wav | haltdef }
}
on ^1:INVITE:#: { if ( %c4 == on ) { splay sounds\notice.wav | haltdef }
}
on ^1:INVITE:?: { if ( %c4 == on ) { splay sounds\notice.wav | haltdef }
}
on ^*:JOIN:#:{ if ($nick == $me) && (%c1 == on ) {  splay sounds\tink.wav | haltdef }
}
ctcp 1:*:{
  if ( %c3 == on ) { splay sounds\ctcp.wav }
}
on *:BAN:#:{
  if ($banmask iswm $address($me,6)) && ($nick != $me)  && ($active = #) && ( %c2 == on ) { splay sounds\alert.wav
  }
  if ($banmask iswm $address($me,6)) && ($nick != $me)  && ($active != #) && ( %c2 == on ) { splay sounds\alert.wav }
}

on ^1:KICK:*: {
  If ( $knick == $me ) && ( %c2 == on ) { splay  sounds\alert.wav }
} 



on ^1:DEOP:*: {
  If ($opnick == $me) && ( %c2 == on ) { splay sounds\alert.wav }
}


on 1:JOIN:#:{
  if ($ialchan($address($nick,2),$chan,0) >= 2 ) { set %tmp.cloni1 0
    :ciclo1 | inc %tmp.cloni1
    if ($ialchan($address($nick,2),$chan,%tmp.cloni1)) { set %tmp.cloni2 %tmp.cloni2 $ialchan($address($nick,2),$chan,%tmp.cloni1).nick }
    if (%tmp.cloni1 < $ialchan($address($nick,2),$chan,0)) goto ciclo1  
    unset %tmp.cloni*
    if ($nick isprotect) goto fine
    if (%c10 == on ) splay sounds\join.wav
  }
  if (%ok.clone.kick == ON) && ($me isop $chan) {
    if ($ialchan($address($nick,2),$chan,0) = %ok.clone.kick.num ) { ban $chan $address($nick,2) | kick $chan $ialchan($address($nick,2),$chan,2).nick %ok.clone.kick.msg }
  }
  :fine
}
on *:action:*:#:{
  if ($me isin $1-) && ($away == $true) && (%c19 == on) { splay sounds\a.wav  } 
  if ($me isin $1-) && ($active != #) && ($away == $false) && (%c19 == on) { splay sounds\a.wav } 
}
on *:TEXT:*:#:{
  if ($me isin $1-) && ($away == $true) && (%c19 == on) { splay sounds\a.wav  } 
  if ($me isin $1-) && ($active != #) && ($away == $false) && (%c19 == on) { splay sounds\a.wav } 
}
