dialog AutoJoin {
  title "kanal ayarları"
  size -1 -1 263 260
  box "Kanallar:",2, 5 60 253 160
  box "Auto Join ayarları",3, 5 5 253 50
  edit "", 4, 29 80 121 22, autohs, read
  edit "", 7, 29 105 121 22, autohs, read
  edit "", 8, 29 130 121 22, autohs, read
  edit "", 9, 29 155 121 22, autohs, read
  edit "", 10, 29 180 121 22, autohs, read
  text "Sürekli kullandığınız kanalları listeye ekleyiniz", 6,12 25 240 20
  text "1.", 11,10 82 10 20
  text "2.", 12,10 107 10 20
  text "3.", 13,10 132 10 20
  text "4.", 14,10 157 10 20
  text "5.", 15,10 182 10 20
  button "Ayarla", 16, 168 80 70 20
  button "Ayarla", 17, 168 105 70 20
  button "Ayarla", 18, 168 130 70 20
  button "Ayarla", 19, 168 155 70 20
  button "Ayarla", 20, 168 180 70 20
  button "Kapat", 200, 92 234 70 20, ok
}
alias autojoin { if ($dialog(autojoin)) { echo -a 9,1 Auto Join Zaten Açık | halt } | dialog -m autojoin autojoin | $lchk }
on 1:DIALOG:autojoin:*:*: {
  if ($devent == init) {
    did -a autojoin 4 %ajchan1
    did -a autojoin 7 %ajchan2
    did -a autojoin 8 %ajchan3
    did -a autojoin 9 %ajchan4
    did -a autojoin 10 %ajchan5
  }
  if ($devent == sclick) {
    if ($did == 16) { setajchan1 }
    if ($did == 17) { setajchan2 }
    if ($did == 18) { setajchan3 }
    if ($did == 19) { setajchan4 }
    if ($did == 20) { setajchan5 }
  }
}
alias setajchan1 { dialog -m setchan1 setchan1 | halt }
alias setajchan2 { dialog -m setchan2 setchan2 | halt }
alias setajchan3 { dialog -m setchan3 setchan3 | halt }
alias setajchan4 { dialog -m setchan4 setchan4 | halt }
alias setajchan5 { dialog -m setchan5 setchan5 | halt }

dialog setchan1 {
  title "Auto join ayarı"
  size -1 -1 263 205
  box "Channel 1.",1, 5 5 253 85
  edit "", 2, 120 25 121 22, autohs
  edit "", 3, 120 50 121 22, autohs
  text "      Kanal adı:", 4,35 28 80 15
  text "Kanal şifresi:", 5,40 53 80 15
  check "Otomatik gir" 6, 65 105 120 20
  check "Kanal şifresi " 7, 65 130 130 20
  box "",9, 5 160 253 40
  button "Kapat", 200, 93 173 70 20, ok
}
dialog setchan2 {
  title "Auto join ayarı"
  size -1 -1 263 205
  box "Kanal 2.",1, 5 5 253 85
  edit "", 2, 120 25 121 22, autohs
  edit "", 3, 120 50 121 22, autohs
  text "      Kanal adı:", 4,35 28 80 15
  text "Kanal şifresi:", 5,40 53 80 15
  check "Otomatik gir" 6, 65 105 120 20
  check "Kanal şifresi " 7, 65 130 130 20
  box "",9, 5 160 253 40
  button "Kapat", 200, 93 173 70 20, ok
}
dialog setchan3 {
  title "Auto join ayarı"
  size -1 -1 263 205
  box "Kanal 3.",1, 5 5 253 85
  edit "", 2, 120 25 121 22, autohs
  edit "", 3, 120 50 121 22, autohs
  text "      Kanal adı:", 4,35 28 80 15
  text "Kanal şifresi:", 5,40 53 80 15
  check "Otomatik gir" 6, 65 105 120 20
  check "Kanal şifresi " 7, 65 130 130 20
  box "",9, 5 160 253 40
  button "Kapat", 200, 93 173 70 20, ok
}
dialog setchan4 {
  title "Auto join ayarı"
  size -1 -1 263 205
  box "Kanal 4.",1, 5 5 253 85
  edit "", 2, 120 25 121 22, autohs
  edit "", 3, 120 50 121 22, autohs
  text "      Kanal adı:", 4,35 28 80 15
  text "Kanal şifresi:", 5,40 53 80 15
  check "Otomatik gir" 6, 65 105 120 20
  check "Kanal şifresi " 7, 65 130 130 20
  box "",9, 5 160 253 40
  button "Kapat", 200, 93 173 70 20, ok
}
dialog setchan5 {
  title "Auto join ayarı"
  size -1 -1 263 205
  box "Kanal 5.",1, 5 5 253 85
  edit "", 2, 120 25 121 22, autohs
  edit "", 3, 120 50 121 22, autohs
  text "    Kanal adı:", 4,35 28 80 15
  text "Kanal şifresi:", 5,40 53 80 15
  check "Otomatik gir" 6, 65 105 120 20
  check "Kanal şifresi " 7, 65 130 130 20
  box "",9, 5 160 253 40
  button "Kapat", 200, 93 173 70 20, ok
}
on 1:DIALOG:setchan1:*:*: {
  if ($devent == init) {
    did -a setchan1 2 %ajchan1
    did -a setchan1 3 %ajpass1 
    if (%autojoin1 == ON) did -c setchan1 6 %autojoin1
    if (%ajID1 == ON) did -c setchan1 7 %ajID1
  }
  if ($devent == edit) {
    if ($did == 2) { set %ajchan1 $did(2) | if (%ajchan1 == $null) /set %ajchan1 #Empty | did -ra autojoin 4 %ajchan1 }
    if ($did == 3) { set %ajpass1 $did(3) | if (%ajpass1 == $null) /set %ajpass1 Optional }
  }
  if ($devent == sclick) {
    if ($did == 6) {  
      if (%autojoin1 == ON) { set %autojoin1 OFF | halt }
      if (%autojoin1 == OFF) { set %autojoin1 ON | halt }
    }
    if ($did == 7) { 
      if (%ajID1 == ON) { set %ajID1 OFF | halt }
      if (%ajID1 == OFF) { set %ajID1 ON | if (%ajpass1 == Optional) { error No Channel Pass entered! | halt } }
    }
  }
}
on 1:DIALOG:setchan2:*:*: {
  if ($devent == init) {
    did -a setchan2 2 %ajchan2
    did -a setchan2 3 %ajpass2 
    if (%autojoin2 == ON) did -c setchan2 6 %autojoin2
    if (%ajID2 == ON) did -c setchan2 7 %ajID2
  }
  if ($devent == edit) {
    if ($did == 2) { set %ajchan2 $did(2) | if (%ajchan2 == $null) /set %ajchan2 #Empty | did -ra autojoin 7 %ajchan2 }
    if ($did == 3) { set %ajpass2 $did(3) | if (%ajpass2 == $null) /set %ajpass2 Optional }
  }
  if ($devent == sclick) {
    if ($did == 6) {  
      if (%autojoin2 == ON) { set %autojoin2 OFF | halt }
      if (%autojoin2 == OFF) { set %autojoin2 ON | halt }
    }
    if ($did == 7) { 
      if (%ajID2 == ON) { set %ajID2 OFF | halt }
      if (%ajID2 == OFF) { set %ajID2 ON | if (%ajpass2 == Optional) { error No Channel Pass entered! | halt } }
    }
  }
}
on 1:DIALOG:setchan3:*:*: {
  if ($devent == init) {
    did -a setchan3 2 %ajchan3
    did -a setchan3 3 %ajpass3 
    if (%autojoin3 == ON) did -c setchan3 6 %autojoin3
    if (%ajID3 == ON) did -c setchan3 7 %ajID3
  }
  if ($devent == edit) {
    if ($did == 2) { set %ajchan3 $did(2) | if (%ajchan3 == $null) /set %ajchan3 #Empty | did -ra autojoin 8 %ajchan3 }
    if ($did == 3) { set %ajpass3 $did(3) | if (%ajpass3 == $null) /set %ajpass3 Optional }
  }
  if ($devent == sclick) {
    if ($did == 6) {  
      if (%autojoin3 == ON) { set %autojoin3 OFF | halt }
      if (%autojoin3 == OFF) { set %autojoin3 ON | halt }
    }
    if ($did == 7) { 
      if (%ajID3 == ON) { set %ajID3 OFF | halt }
      if (%ajID3 == OFF) { set %ajID3 ON | if (%ajpass3 == Optional) { error No Channel Pass entered! | halt } }
    }
  }
}
on 1:DIALOG:setchan4:*:*: {
  if ($devent == init) {
    did -a setchan4 2 %ajchan4
    did -a setchan4 3 %ajpass4 
    if (%autojoin4 == ON) did -c setchan4 6 %autojoin4
    if (%ajID4 == ON) did -c setchan4 7 %ajID4
  }
  if ($devent == edit) {
    if ($did == 2) { set %ajchan4 $did(2) | if (%ajchan4 == $null) /set %ajchan4 #Empty | did -ra autojoin 9 %ajchan4 }
    if ($did == 3) { set %ajpass4 $did(3) | if (%ajpass4 == $null) /set %ajpass4 Optional }
  }
  if ($devent == sclick) {
    if ($did == 6) {  
      if (%autojoin4 == ON) { set %autojoin4 OFF | halt }
      if (%autojoin4 == OFF) { set %autojoin4 ON | halt }
    }
    if ($did == 7) { 
      if (%ajID4 == ON) { set %ajID4 OFF | halt }
      if (%ajID4 == OFF) { set %ajID4 ON | if (%ajpass4 == Optional) { error No Channel Pass entered! | halt } }
    }
  }
}
on 1:DIALOG:setchan5:*:*: {
  if ($devent == init) {
    did -a setchan5 2 %ajchan5
    did -a setchan5 3 %ajpass5 
    if (%autojoin5 == ON) did -c setchan5 6 %autojoin5
    if (%ajID5 == ON) did -c setchan5 7 %ajID5
  }
  if ($devent == edit) {
    if ($did == 2) { set %ajchan5 $did(2) | if (%ajchan5 == $null) /set %ajchan5 #Empty | did -ra autojoin 10 %ajchan5 }
    if ($did == 3) { set %ajpass5 $did(3) | if (%ajpass5 == $null) /set %ajpass5 Optional }
  }
  if ($devent == sclick) {
    if ($did == 6) {  
      if (%autojoin5 == ON) { set %autojoin5 OFF | halt }
      if (%autojoin5 == OFF) { set %autojoin5 ON | halt }
    }
    if ($did == 7) { 
      if (%ajID5 == ON) { set %ajID5 OFF | halt }
      if (%ajID5 == OFF) { set %ajID5 ON | if (%ajpass5 == Optional) { error No Channel Pass entered! | halt } }
    }
  }
}
