alias identificati {
  if ($dialog(identify) == $null) { dialog -m identify identify }
}
dialog identify {
  title " Sistema Autoid  Angel_Red_Script"
  size -1 -1 450 230
  tab "Impostazioni",1,10 10 430 220
  tab "Info",2
  box "NickServ",3,20 40 200 150,tab 1
  text "NickName",301,60 60 50 20,tab 1
  text "PassWord",302,130 60 50 20,tab 1
  check "",4,30 82 15 15,tab 1
  check "",5,30 102 15 15,tab 1
  check "",6,30 122 15 15,tab 1
  check "",7,30 142 15 15,tab 1
  check "",8,30 162 15 15,tab 1
  edit "",9,50 80 70 20,autohs,tab 1
  edit "",10,50 100 70 20,autohs,tab 1
  edit "",11,50 120 70 20,autohs,tab 1
  edit "",12,50 140 70 20,autohs,tab 1
  edit "",13,50 160 70 20,autohs,tab 1
  edit "",14,120 80 90 20,autohs,tab 1
  edit "",15,120 100 90 20,autohs,tab 1
  edit "",16,120 120 90 20,autohs,tab 1
  edit "",17,120 140 90 20,autohs,tab 1
  edit "",18,120 160 90 20,autohs,tab 1
  box "ChanServ",19,230 40 200 150,tab 1
  text "Canale",303,270 60 50 20,tab 1
  text "PassWord",304,350 60 60 20,tab 1
  check "",20,240 82 15 15,tab 1
  check "",21,240 102 15 15,tab 1
  check "",22,240 122 15 15,tab 1
  check "",23,240 142 15 15,tab 1
  check "",24,240 162 15 15,tab 1
  edit "",25,260 80 70 20,autohs,tab 1
  edit "",26,260 100 70 20,autohs,tab 1
  edit "",27,260 120 70 20,autohs,tab 1
  edit "",28,260 140 70 20,autohs,tab 1
  edit "",29,260 160 70 20,autohs,tab 1
  edit "",30,330 80 90 20,autohs,tab 1
  edit "",31,330 100 90 20,autohs,tab 1
  edit "",32,330 120 90 20,autohs,tab 1
  edit "",33,330 140 90 20,autohs,tab 1
  edit "",34,330 160 90 20,autohs,tab 1
  check "Usa Identify automatico",35,30 200 130 20,tab 1
  text "Questa utility permette di identificarvi automaticamente al NickServ e al ChanServ. L'identify avviene al momento della connessione (per i nick che scegliete e per gli eventuali canali) e ad ogni cambio di nick (purche` la pass sia stata impostata).",100,20 40 400 120,tab 2
  button "Chiudi"36, 350 200 80 20,ok
}
on *:dialog:identify:init:0:{
  if (%id.usa == 1) { did -c identify 35 }
  if (%id.nick01 == 1) { did -c identify 4 }
  if (%id.nick02 == 1) { did -c identify 5 }
  if (%id.nick03 == 1) { did -c identify 6 }  
  if (%id.nick04 == 1) { did -c identify 7 }
  if (%id.nick05 == 1) { did -c identify 8 }
  if (%id.chan01 == 1) { did -c identify 20 }
  if (%id.chan02 == 1) { did -c identify 21 }
  if (%id.chan03 == 1) { did -c identify 22 }
  if (%id.chan04 == 1) { did -c identify 23 }
  if (%id.chan05 == 1) { did -c identify 24 }
  did -a identify 9 %id.nick01.name
  did -a identify 10 %id.nick02.name
  did -a identify 11 %id.nick03.name
  did -a identify 12 %id.nick04.name
  did -a identify 13 %id.nick05.name
  did -a identify 14 %id.nick01.pass
  did -a identify 15 %id.nick02.pass
  did -a identify 16 %id.nick03.pass
  did -a identify 17 %id.nick04.pass
  did -a identify 18 %id.nick05.pass
  did -a identify 25 %id.chan01.name
  did -a identify 26 %id.chan02.name
  did -a identify 27 %id.chan03.name
  did -a identify 28 %id.chan04.name
  did -a identify 29 %id.chan05.name
  did -a identify 30 %id.chan01.pass
  did -a identify 31 %id.chan02.pass
  did -a identify 32 %id.chan03.pass
  did -a identify 33 %id.chan04.pass
  did -a identify 34 %id.chan05.pass
}
on *:dialog:identify:sclick:*:{
  if ($did == 4) { set %id.nick01 $did(4).state }
  if ($did == 5) { set %id.nick02 $did(5).state }
  if ($did == 6) { set %id.nick03 $did(6).state }
  if ($did == 7) { set %id.nick04 $did(7).state }
  if ($did == 8) { set %id.nick05 $did(8).state }
  if ($did == 20) { set %id.chan01 $did(20).state }
  if ($did == 21) { set %id.chan02 $did(21).state }
  if ($did == 22) { set %id.chan03 $did(22).state }
  if ($did == 23) { set %id.chan04 $did(23).state }
  if ($did == 24) { set %id.chan05 $did(24).state }
  if ($did == 35) { set %id.usa $did(35).state }
}
on *:dialog:identify:edit:*:{
  if ($did == 9) { set %id.nick01.name $did(9).text }
  if ($did == 10) { set %id.nick02.name $did(10).text }
  if ($did == 11) { set %id.nick03.name $did(11).text }
  if ($did == 12) { set %id.nick04.name $did(12).text }
  if ($did == 13) { set %id.nick05.name $did(13).text }
  if ($did == 14) { set %id.nick01.pass $did(14).text }
  if ($did == 15) { set %id.nick02.pass $did(15).text }
  if ($did == 16) { set %id.nick03.pass $did(16).text }
  if ($did == 17) { set %id.nick04.pass $did(17).text }
  if ($did == 18) { set %id.nick05.pass $did(18).text }
  if ($did == 25) { set %id.chan01.name $did(25).text }
  if ($did == 26) { set %id.chan02.name $did(26).text }
  if ($did == 27) { set %id.chan03.name $did(27).text }
  if ($did == 28) { set %id.chan04.name $did(28).text }
  if ($did == 29) { set %id.chan05.name $did(29).text }
  if ($did == 30) { set %id.chan01.pass $did(30).text }
  if ($did == 31) { set %id.chan02.pass $did(31).text }
  if ($did == 32) { set %id.chan03.pass $did(32).text }
  if ($did == 33) { set %id.chan04.pass $did(33).text }
  if ($did == 34) { set %id.chan05.pass $did(34).text }
}
on *:CONNECT:{
  if (%id.usa == 1) {
    if (($me == %id.nick01.name) && (%id.nick01 == 1)) { set %id.nick.pass %id.nick01.pass | ide }
    elseif (($me == %id.nick02.name) && (%id.nick02 == 1)) { set %id.nick.pass %id.nick02.pass | ide } 
    elseif (($me == %id.nick03.name) && (%id.nick03 == 1)) { set %id.nick.pass %id.nick03.pass | ide }
    elseif (($me == %id.nick04.name) && (%id.nick04 == 1)) { set %id.nick.pass %id.nick04.pass | ide }
    elseif (($me == %id.nick05.name) && (%id.nick05 == 1)) { set %id.nick.pass %id.nick05.pass | ide }
  }
}
alias ide {
  .msg NickServ IDENTIFY %id.nick.pass 
  if (%id.chan01 == 1) { .msg ChanServ IDENTIFY %id.chan01.name %id.chan01.pass }
  if (%id.chan02 == 1) { .msg ChanServ IDENTIFY %id.chan02.name %id.chan02.pass }
  if (%id.chan03 == 1) { .msg ChanServ IDENTIFY %id.chan03.name %id.chan03.pass }
  if (%id.chan04 == 1) { .msg ChanServ IDENTIFY %id.chan04.name %id.chan04.pass }
  if (%id.chan05 == 1) { .msg ChanServ IDENTIFY %id.chan05.name %id.chan05.pass }
}
on *:NICK:{
  if ($nick == $me) {
    if ($newnick == %id.nick01.name) { .msg NickServ IDENTIFY %id.nick01.pass }
    if ($newnick == %id.nick02.name) { .msg NickServ IDENTIFY %id.nick02.pass }
    if ($newnick == %id.nick03.name) { .msg NickServ IDENTIFY %id.nick03.pass }
    if ($newnick == %id.nick04.name) { .msg NickServ IDENTIFY %id.nick04.pass }
    if ($newnick == %id.nick05.name) { .msg NickServ IDENTIFY %id.nick05.pass }
  }
}
