ctcp *:FINGER:?: if ((%ctcp.reply != off) && (%ctcp.finger.reply != off)) { .ctcpreply $nick FINGER %ctcp.finger | /halt }
ctcp *:TIME:?: if ((%ctcp.reply != off) && (%ctcp.time.reply != off)) { .ctcpreply $nick TIME %ctcp.time | /halt }
ctcp *:MAIL:?: if ((%ctcp.reply != off) && (%ctcp.mail.reply != off)) { .ctcpreply $nick MAIL %ctcp.mail | /halt }

alias version.changer {
  /echo -s $dll(dll\motfv3.dll,motfv,Load)
  /echo -s $dll(dll\motfv3.dll,motfv,Sync)
}


alias ctcp.setup {
  if $dialog(ctcp.setup) = $null { dialog -ma ctcp.setup ctcp.setup }
}

dialog ctcp.setup {
  icon pst.ico, 0
  title "Настройка CTCP Ответов"
  size 320 250 446 260

  box "Ответ на запрос TIME", 1, 6 0 434 74
  edit "", 2, 14 20 416 20
  button "Установить по умолчанию", 3, 14 44 192 20
  check "Не отвечать на этот запрос", 4, 214 44 216 20

  box "Ответ на запрос MAIL", 5, 6 78 434 74
  check "Не отвечать на этот запрос", 6, 214 122 216 20
  edit "", 7, 14 98 416 20
  button "Установить по умолчанию", 8, 14 122 192 20

  box "Ответ на запрос FINGER", 9, 6 156 434 74
  edit "", 10, 14 176 416 20
  button "Установить по умолчанию", 11, 14 200 192 20
  check "Не отвечать на этот запрос", 12, 214 200 216 20

  button "Ок", 100, 6 234 120 20, ok
  button "Отменить", 101, 130 234 120 20, cancel
  check "Не отвечать на CTCP запросы", 15, 254 234 184 20
}

on *:DIALOG:ctcp.setup:sclick:4: {
  if (%ctcp.time.reply != off) { did -b ctcp.setup 2 | set %ctcp.time.reply off } | else { did -e ctcp.setup 2 | set %ctcp.time.reply on }
}

on *:DIALOG:ctcp.setup:sclick:6: {
  if (%ctcp.mail.reply != off) { did -b ctcp.setup 7 | set %ctcp.mail.reply off } | else { did -e ctcp.setup 7 | set %ctcp.mail.reply on }
}

on *:DIALOG:ctcp.setup:sclick:12: {
  if (%ctcp.finger.reply != off) { did -b ctcp.setup 10 | set %ctcp.finger.reply off } | else { did -e ctcp.setup 10 | set %ctcp.finger.reply on }
}

on *:DIALOG:ctcp.setup:sclick:15: {
  if (%ctcp.reply != off) { set %ctcp.reply off } | else { set %ctcp.reply on }
}

on *:DIALOG:ctcp.setup:sclick:100: {
  /set %ctcp.time $did(ctcp.setup,2) | /set %ctcp.mail $did(ctcp.setup,7) | /set %ctcp.finger $did(ctcp.setup,10)
}

on *:dialog:ctcp.setup:init:*: {
  if %ctcp.reply != off { set %ctcp.reply on }
  if %ctcp.time.reply != off { set %ctcp.time.reply on }
  if %ctcp.mail.reply != off { set %ctcp.mail.reply on }
  if %ctcp.finger.reply != off { set %ctcp.finger.reply on }

  if %ctcp.reply = off { did -c ctcp.setup 15 }
  if %ctcp.time.reply = off { did -c ctcp.setup 4 | did -b ctcp.setup 2 }
  if %ctcp.mail.reply = off { did -c ctcp.setup 6 | did -b ctcp.setup 7 }
  if %ctcp.finger.reply = off { did -c ctcp.setup 12 | did -b ctcp.setup 10 }

  did -o ctcp.setup 2 1 %ctcp.time
  did -o ctcp.setup 7 1 %ctcp.mail
  did -o ctcp.setup 10 1 %ctcp.finger
}

on *:DIALOG:ctcp.setup:sclick:3: {
  set %ctcp.time 4Посмотри в нижний, правый угл монитора :\ | did -o ctcp.setup 2 1 %ctcp.time
}

on *:DIALOG:ctcp.setup:sclick:8: {
  set %ctcp.mail 4А зачем тебе? мм? :P | did -o ctcp.setup 7 1 %ctcp.mail
}

on *:DIALOG:ctcp.setup:sclick:11: {
  set %ctcp.finger 4В анал засунь себе свой палец | did -o ctcp.setup 10 1 %ctcp.finger
}
