Basic — File Browser

Basicv23042002 / Basicv23042002 / basic / sys / dialog.mrc

dialog.mrc — 58.46 KB — Download this file

; ###################################
;
;  Basic v23042002
;  blue-elf, belf@mircscripter.com
;
;  dialog routines
;
; ###################################
dialog _entry {
  title "title"
  size -1 -1 200 31
  option dbu
  text "Entry:", 1, 4 5 23 8
  combo 2, 29 3 168 70, result edit drop
  button "&Ok", 3, 67 17 32 12, ok
  button "&Cancel", 4, 101 17 32 12, cancel
}
; $_entry(Title,Data,M,-3|-1)
alias _entry {
  set -u %_sys.entry.title $1
  set -u %_sys.entry.data  $2
  if ($4) {
    set -u %_sys.entry.loop $true
    set -u %_sys.entry.center $4
  }
  else set -u %_sys.entry.center $iif($3,$3,$iif($2,$2,-1))
  return $dialog($+(_entry.,$ticks),_entry,%_sys.entry.center)
}
on *:dialog:_entry.*:init:*:{
  if (%_sys.entry.title != $null) .timer -m 1 0 dialog -t $dname $ifmatch
  if (%_sys.entry.data  != $null) {
    did -a $dname 2 $ifmatch
    did -c $dname 2 1
  }
  if ((%_sys.entry.loop) && (*!*@* iswm %_sys.entry.data)) {
    var %i = 0
    while (%i <= 19) {
      did -a $dname 2 $mask(%_sys.entry.data,%i)
      inc %i
    }
  }
}
; channel
dialog cset {
  title "Channel Options"
  size -1 -1 244 206
  option dbu
  button "&Ok", 1, 112 190 30 12, ok
  button "&Cancel", 2, 144 190 30 12, cancel
  button "&Help", 3, 208 190 30 12
  button "&Apply", 4, 176 190 30 12
  text "Network:", 5, 6 3 25 8
  combo 6, 33 2 55 50, drop
  button "Add...", 8, 91 1 25 11
  button "Rem...", 9, 119 1 25 11
  text "Channel:", 10, 5 15 25 8
  combo 11, 33 15 55 50, drop
  button "Add...", 12, 91 13 25 11
  button "Rem...", 17, 119 13 25 11
  text "Defaults:", 18, 155 3 25 8, right
  combo 19, 183 2 55 50, drop
  text "Option:", 20, 155 15 25 8, right
  combo 21, 183 14 55 50, drop
  tab "General", 30, -30 -30 499 499
  box "General protection:", 31, 5 28 233 109, tab 30
  check "Nethack protection after ...", 32, 18 51 77 7, tab 30
  check "Filterkick on ban.", 37, 18 39 57 7, tab 30
  check "Ban repeat offender after...", 43, 18 64 77 7, tab 30
  edit "", 44, 100 61 16 11, tab 30
  text "kicks under...", 46, 118 63 34 7, tab 30
  edit "", 47, 156 61 15 11, tab 30
  text "minutes.", 48, 173 63 22 7, tab 30
  check "Trigger caps kick if...", 50, 18 77 67 7, tab 30
  edit "", 56, 100 74 16 11, tab 30 autohs
  text "% of the text is uppercase.", 67, 118 76 68 7, tab 30
  button "Action...", 68, 190 71 30 11, tab 30
  check "An excessive long word is...", 69, 18 89 78 7, tab 30
  edit "", 70, 100 86 16 11, tab 30 autohs
  text "characters.", 71, 118 88 30 7, tab 30
  button "Action...", 72, 190 84 30 11, tab 30
  check "Kick if control codes are..", 73, 18 101 73 7, tab 30
  edit "", 80, 100 98 16 11, tab 30
  text "% of the text.", 81, 118 100 42 7, tab 30
  button "Action...", 82, 190 97 30 11, tab 30
  check "Limit maximum of...", 95, 18 112 62 7, tab 30
  text "clones per user.", 96, 118 112 43 7, tab 30
  edit "", 97, 100 110 16 11, tab 30
  box "Word triggers:", 180, 5 137 233 49, tab 30
  check "Bad nick/hostmask.", 84, 18 147 60 8, tab 30
  check "Swear kick.", 86, 18 160 53 8, tab 30
  check "Invite protection.", 88, 18 124 56 8, tab 30
  check "Spam protection.", 90, 18 173 56 8, tab 30
  button "Words...", 91, 100 171 30 11, tab 30
  button "Words...", 89, 100 158 30 11, hide tab 30
  button "Words...", 87, 100 158 30 11, tab 30
  button "Words...", 85, 100 145 30 11, tab 30
  button "Action...", 126, 190 145 30 11, tab 30
  button "Action...", 127, 190 158 30 11, tab 30
  button "Action...", 128, 190 123 30 11, tab 30
  button "Action...", 129, 190 171 30 11, tab 30
  button "Action...", 183, 190 110 30 11, tab 30
  edit "", 189, 100 48 16 11, tab 30
  text "minute(s) of netsplit.", 190, 119 50 57 8, tab 30
  tab "Flood", 22
  check "Text flood after...", 7, 11 36 60 10, tab 22
  edit "", 13, 73 35 20 11, tab 22
  text "lines or", 14, 96 37 25 8, tab 22
  edit "", 15, 167 35 15 11, tab 22
  text "secs.", 16, 184 37 16 8, tab 22
  button "Action...", 130, 202 34 32 12, tab 22
  check "Massdeop flood after...", 131, 11 143 65 10, tab 22
  edit "", 132, 92 142 20 11, tab 22
  text "deops in...", 133, 115 144 35 8, tab 22
  edit "", 134, 167 142 15 11, tab 22
  text "secs.", 135, 184 144 16 8, tab 22
  button "Action...", 136, 202 141 32 12, tab 22
  check "Join flood after...", 137, 11 129 65 10, tab 22
  edit "", 138, 92 128 20 11, tab 22
  text "joins in...", 139, 115 130 35 8, tab 22
  edit "", 140, 167 128 15 11, tab 22
  text "secs.", 141, 184 130 16 8, tab 22
  button "Action...", 142, 202 127 32 12, tab 22
  check "Notice flood after...", 143, 11 50 60 10, tab 22
  edit "", 144, 73 49 20 11, tab 22
  text "lines or", 145, 96 51 25 8, tab 22
  edit "", 146, 167 49 15 11, tab 22
  text "secs.", 147, 184 51 16 8, tab 22
  button "Action...", 148, 202 48 32 12, tab 22
  check "Repeat flood after...", 149, 11 115 65 10, tab 22
  edit "", 150, 92 114 20 11, tab 22
  text "lines in...", 151, 115 116 35 8, tab 22
  edit "", 152, 167 114 15 11, tab 22
  text "secs.", 153, 184 116 16 8, tab 22
  button "Action...", 154, 202 113 32 12, tab 22
  check "CTCP flood after...", 155, 11 64 60 10, tab 22
  edit "", 156, 73 63 20 11, tab 22
  text "ctcps or", 157, 96 65 25 8, tab 22
  edit "", 158, 167 63 15 11, tab 22
  text "secs.", 159, 184 65 16 8, tab 22
  button "Action...", 160, 202 62 32 12, tab 22
  check "Nick flood after...", 161, 11 101 65 10, tab 22
  edit "", 162, 92 100 20 11, tab 22
  text "changes in...", 163, 115 102 35 8, tab 22
  edit "", 164, 167 100 15 11, tab 22
  text "secs.", 165, 184 102 16 8, tab 22
  button "Action...", 166, 202 99 32 12, tab 22
  check "Masskick flood after...", 167, 11 157 65 10, tab 22
  edit "", 168, 92 156 20 11, tab 22
  text "kicks in...", 169, 115 158 35 8, tab 22
  edit "", 170, 167 156 15 11, tab 22
  text "secs.", 171, 184 158 16 8, tab 22
  button "Action...", 172, 202 155 32 12, tab 22
  check "Massban flood after...", 173, 11 171 65 10, tab 22
  edit "", 174, 92 170 20 11, tab 22
  text "bans in...", 175, 115 172 35 8, tab 22
  edit "", 176, 167 170 15 11, tab 22
  text "secs.", 177, 184 172 16 8, tab 22
  button "Action...", 178, 202 169 32 12, tab 22
  box "Flood 2:", 27, 5 92 234 95, tab 22
  edit "", 120, 123 35 20 11, tab 22
  edit "", 123, 123 49 20 11, tab 22
  text "chars in", 124, 145 37 21 8, tab 22
  text "chars in", 125, 145 51 21 8, tab 22
  box "Flood 1:", 184, 4 26 234 65, tab 22
  edit "", 185, 123 63 20 11, tab 22
  text "chars in", 186, 145 65 21 8, tab 22
  button "Action...", 83, 202 76 32 12, tab 22
  text "secs.", 92, 184 79 16 8, tab 22
  edit "", 93, 167 77 15 11, tab 22
  text "chars in", 94, 145 79 21 8, tab 22
  edit "", 98, 123 77 20 11, tab 22
  text "quits or", 179, 96 79 25 8, tab 22
  edit "", 181, 73 77 20 11, tab 22
  check "Quit flood after...", 182, 11 78 58 10, tab 22
  tab "Botnet", 28
  check "Text", 23, 23 44 28 10, tab 28
  edit "", 24, 69 44 15 10, tab 28
  text "lines in....", 25, 90 45 35 8, tab 28
  edit "", 26, 139 44 17 10, tab 28
  text "secs.", 33, 159 45 15 8, tab 28
  check "Notice", 34, 23 64 28 10, tab 28
  edit "", 35, 69 64 15 10, tab 28
  text "notices in...", 36, 90 65 35 8, tab 28
  edit "", 38, 139 64 17 10, tab 28
  text "secs.", 39, 159 65 15 8, tab 28
  check "Nick", 40, 23 84 28 10, tab 28
  edit "", 41, 69 84 15 10, tab 28
  text "changes in...", 42, 90 85 35 8, tab 28
  edit "", 45, 139 84 17 10, tab 28
  text "secs.", 49, 159 85 15 8, tab 28
  check "Join", 51, 23 104 28 10, tab 28
  edit "", 52, 69 104 15 10, tab 28
  text "joins in...", 53, 90 105 35 8, tab 28
  edit "", 54, 139 104 17 10, tab 28
  text "secs.", 55, 159 105 15 8, tab 28
  check "CTCP", 57, 23 124 28 10, tab 28
  edit "", 58, 69 124 15 10, tab 28
  text "requests in...", 59, 90 125 35 8, tab 28
  edit "", 60, 139 124 17 10, tab 28
  text "secs.", 61, 159 125 15 8, tab 28
  check "Invite", 62, 23 144 28 10, tab 28
  edit "", 63, 69 144 15 10, tab 28
  text "invites in...", 64, 90 145 35 8, tab 28
  edit "", 65, 139 144 17 10, tab 28
  text "secs.", 66, 159 145 15 8, tab 28
  box "Botnet flood:", 29, 5 29 234 156, tab 28
  check "Quit", 74, 23 164 28 10, tab 28
  edit "", 75, 69 164 15 10, tab 28
  text "quits in...", 76, 90 165 35 8, tab 28
  edit "", 77, 139 164 17 10, tab 28
  text "secs.", 78, 159 165 15 8, tab 28
  button "Action...", 79, 188 43 32 12, tab 28
  button "Action...", 191, 188 63 32 12, tab 28
  button "Action...", 192, 188 83 32 12, tab 28
  button "Action...", 193, 188 103 32 12, tab 28
  button "Action...", 194, 188 123 32 12, tab 28
  button "Action...", 195, 188 143 32 12, tab 28
  button "Action...", 196, 188 163 32 12, tab 28
  tab "Misc", 99
  box "Exempted users:", 100, 5 35 233 48, tab 99
  check "Channel owners.", 101, 22 44 52 10, tab 99
  check "Channel operators", 102, 22 56 60 10, tab 99
  check "Helpers or half-ops.", 103, 22 68 64 10, disable, tab 99
  check "Voiced users.", 104, 127 44 45 10, tab 99
  check "Any non-regular user.", 105, 127 56 63 10, tab 99
  check "Detected IRCop.", 106, 127 68 54 10, disable, tab 99
  box "Set these modes on join if channel is empty:", 107, 5 84 233 101, tab 99
  check "Secret.", 108, 22 96 50 10, tab 99
  check "Private.", 109, 22 108 50 10, tab 99
  check "Invite only.", 110, 22 121 50 10, tab 99
  check "Only ops can change the topic.", 111, 22 133 86 10, tab 99
  check "No external messages.", 112, 22 146 70 10, tab 99
  check "Moderated.", 113, 126 96 50 10, tab 99
  check "Limit users...", 114, 126 120 41 10, tab 99
  check "Use password...", 115, 126 108 50 10, tab 99
  check "Other modes...", 116, 126 132 50 10, tab 99
  edit "", 117, 182 106 40 11, tab 99 autohs
  edit "", 118, 182 118 40 11, tab 99 autohs
  edit "", 119, 182 130 40 11, tab 99 autohs
  check "Change topic to...", 121, 22 170 57 10, tab 99
  edit "", 122, 80 170 142 11, tab 99
  button "&Enable all", 187, 5 190 30 12
  button "&Disable all", 188, 38 190 30 12
}
alias cset { _opendlg cset }
alias -l i { return $_sysgetopt(Default,%sys.cset.chan,$1,%sys.cset.net) }
on *:dialog:cset:init:*:{
  dialog -t cset $dialog(cset).title
  if ($_(Misc,ChanLastSel)) {
    var %s = $ifmatch
    .timer -m 1 0 _csel %s
    .timer -m 1 0 did -c cset 21 %s
  }
  ; network and channel
  did -a cset 6,11 Default
  didtok -a cset 6 32 $_sysread(MainList,Networks)
  didtok -a cset 11 32 $_sysread(MainList,Channels)
  did -c cset 6,11 1
  ; setting type
  didtok -a cset 19 32 Custom Lenient Normal
  didtok -a cset 21 46 General.Normal Flood.Floodnet.Miscellaneous
  ; #change this for custom/lenient,etc settings
  did -c cset 19,21 1
  _cset.init $did(6,$did(6).sel) $did(11,$did(11).sel)
  set %sys.cset.last.net $did(6).sel
  set %sys.cset.last.chan $did(11).sel
}
on *:dialog:cset:sclick:3:{
  _bld cset
  var %d = $dialog(cset).tab 
  if (%d == 28) bhelp floodnet
  if (%d == 30) bhelp general protection
  if (%d == 22) bhelp flood protection
  if (%d == 99) bhelp miscellaneous
}
on *:dialog:cset:sclick:6:_csetsel
on *:dialog:cset:sclick:11:_csetsel
alias -l _csetsel {
  if ((%sys.cset.last.net == $did(cset,11).sel) && (%sys.cset.last.chan == $did(cset,6).sel)) return
  set %sys.cset.last.net $did(cset,6).sel
  set %sys.cset.last.chan $did(cset,11).sel
  var %net = $did(cset,6,$did(cset,6).sel), %chan = $did(cset,11,$did(cset,11).sel)
  if ($ini(sys\channels.ini,$+(%net,.,%chan))) _cset.init %net %chan
}
alias -l _cset.init {
  set -u %sys.cset.net $1
  set -u %sys.cset.chan $2
  var %a = did -ra cset, %c = did -c cset
  did -u cset 7,143,155,182,131,137,149,161,167
  ; for now, did -a dname id $null value seems to be okay. hope this works out in later versions of mIRC.
  if ($i(TextFlood    )) %c   7 | %a  13 $i(TextFloodMax    ) | %a  15 $i(TextFloodSec    ) | %a 120 $i(TextFloodLen  )
  if ($i(NoticeFlood  )) %c 143 | %a 144 $i(NoticeFloodMax  ) | %a 146 $i(NoticeFloodSec  ) | %a 123 $i(NoticeFloodLen)
  if ($i(CTCPFlood    )) %c 155 | %a 156 $i(CTCPFloodMax    ) | %a 158 $i(CTCPFloodSec    ) | %a 185 $i(CTCPFloodLen  )
  if ($i(QuitFlood    )) %c 182 | %a 181 $i(QuitFloodMax    ) | %a  93 $i(QuitFloodSec    ) | %a  98 $i(QuitFloodLen  )
  if ($i(MassDeopFlood)) %c 131 | %a 132 $i(MassDeopFloodMax) | %a 134 $i(MassDeopFloodSec)
  if ($i(JoinFlood    )) %c 137 | %a 138 $i(JoinFloodMax    ) | %a 140 $i(JoinFloodSec    )
  if ($i(RepeatFlood  )) %c 149 | %a 150 $i(RepeatFloodMax  ) | %a 152 $i(RepeatFloodSec  )
  if ($i(NickFlood    )) %c 161 | %a 162 $i(NickFloodMax    ) | %a 164 $i(NickFloodSec    )
  if ($i(MassKickFlood)) %c 167 | %a 168 $i(MassKickFloodMax) | %a 170 $i(MassKickFloodSec)
  if ($i(MassBanFlood )) %c 173 | %a 174 $i(MassBanFloodMax ) | %a 176 $i(MassBanFloodSec )
  ; botnet
  did -u cset 23,34,40,51,57,62,74
  if ($i(BotNetText  )) %c 23 | %a 24 $i(BotNetTextMax  ) | %a 26 $i(BotNetTextSec  )
  if ($i(BotNetNotice)) %c 34 | %a 35 $i(BotNetNoticeMax) | %a 38 $i(BotNetNoticeSec)
  if ($i(BotNetNick  )) %c 40 | %a 41 $i(BotNetNickMax  ) | %a 45 $i(BotNetNickSec  )
  if ($i(BotNetJoin  )) %c 51 | %a 52 $i(BotNetJoinMax  ) | %a 54 $i(BotNetJoinSec  )
  if ($i(BotNetCTCP  )) %c 57 | %a 58 $i(BotNetCTCPMax  ) | %a 60 $i(BotNetCTCPSec  )
  if ($i(BotNetInvite)) %c 62 | %a 63 $i(BotNetInviteMax) | %a 65 $i(BotNetInviteSec)
  if ($i(BotNetQuit  )) %c 74 | %a 75 $i(BotNetQuitMax  ) | %a 77 $i(BotNetQuitSec  )  
  ; general
  did -u cset 32,37,43,50,69,73,84,86,88,90
  if ($i(NetHack)) %c 32 | %a 189 $i(NetHackMax)
  if ($i(FilterKickOnBan)) %c 37
  if ($i(BanRepeatOffender)) %c 43 | %a 44 $i(BanRepeatOffenderMax) | %a 47 $i(BanRepeatOffenderSec)
  if ($i(CapsKick)) %c 50 | %a 56 $i(CapsMax)
  if ($i(LongWord)) %c 69 | %a 70 $i(LongWordMax)
  if ($i(CtrlKick)) %c 73 | %a 80 $i(CtrlKickMax)
  if ($i(BadNick   )) %c 84
  if ($i(SwearKick )) %c 86
  if ($i(InviteKick)) %c 88
  if ($i(SpamKick  )) %c 90
  ; clones
  did -u cset 95,98
  ; if ($i(CloneWarn)) %c 210 | %a 93 $i(CloneWarnMax)
  if ($i(CloneKBan)) %c 95  | %a 97 $i(CloneKbanMax)
  if ($i(CloneChanLock)) %c 98
  ; exempt
  ; w = owner, o = op, h = halfop, v = voice, n = non-regular user, i = ircop
  var %l = $i(ExemptedList), %i = 1
  while ($mid(%l,%i,1)) {
    did -u cset 10 $+ $pos(wohvni,%i)
    did -c cset 10 $+ $pos(wohvni,$ifmatch)
    inc %i
  }
  ; autochanmodes
  var %l, %m = $i(AutoChanModesDefault), %i = 1
  while ($mid(%m,%i,1)) {
    %l = $ifmatch
    did $iif(%l isincs spitnmlk,-c,-u) cset $calc($pos(spitnmlk,%l) + 107)
    inc %i
  }
  var %n = $i(AutoChanModesLimit)
  if ((%n isnum) && (%n > 0)) did -a cset 118 $int(%n)
  if ($i(AutoChanModesKey) != $null) did -a cset 117 $ifmatch
  if ($i(AutoChanModesOther) != $null) did -a cset 119 $ifmatch
  if ($i(AutoChanModesOtherS)) did -c cset 116
  else did -u cset 116
  _showdlg cset
}
on *:dialog:cset:sclick:1:_cset.apply 0
on *:dialog:cset:sclick:4:_cset.apply 1
alias -l _cset.apply {
  var %c = _cset $+($did(6,$did(6).sel),.,$did(11,$did(11).sel))
  %c CloneKBan $did(95).state
  %c CloneKBanMax  $did(97)
  ; normal flood
  %c TextFlood     $did(  7).state | %c TextFloodMax     $did( 13) | %c TextFloodSec     $did( 15) | %c TextFloodLen   $did(120)
  %c NoticeFlood   $did(143).state | %c NoticeFloodMax   $did(144) | %c NoticeFloodSec   $did(146) | %c NoticeFloodLen $did(123)
  %c CTCPFlood     $did(155).state | %c CTCPFloodMax     $did(156) | %c CTCPFloodSec     $did(158) | %c CTCPFloodLen   $did(185)
  %c QuitFlood     $did(182).state | %c QuitFloodMax     $did(181) | %c QuitFloodSec     $did( 93) | %c QuitFloodLen   $did( 98)
  %c MassDeopFlood $did(131).state | %c MassDeopFloodMax $did(132) | %c MassDeopFloodSec $did(134)
  %c JoinFlood     $did(137).state | %c JoinFloodMax     $did(138) | %c JoinFloodSec     $did(140)
  %c RepeatFlood   $did(149).state | %c RepeatFloodMax   $did(150) | %c RepeatFloodSec   $did(152)
  %c NickFlood     $did(161).state | %c NickFloodMax     $did(162) | %c NickFloodSec     $did(164)
  %c MassKickFlood $did(167).state | %c MassKickFloodMax $did(168) | %c MassKickFloodSec $did(170)
  %c MassBanFlood  $did(173).state | %c MassBanFloodMax  $did(174) | %c MassBanFloodSec  $did(176)
  ; floodnet
  %c BotNetText   $did(23).state | %c BotNetTextMax   $did(24) | %c BotNetTextSec   $did(26)
  %c BotNetNotice $did(34).state | %c BotNetNoticeMax $did(35) | %c BotNetNoticeSec $did(38)
  %c BotNetNick   $did(40).state | %c BotNetNickMax   $did(41) | %c BotNetNickSec   $did(45)
  %c BotNetJoin   $did(51).state | %c BotNetJoinMax   $did(52) | %c BotNetJoinSec   $did(54)
  %c BotNetCTCP   $did(57).state | %c BotNetCTCPMax   $did(58) | %c BotNetCTCPSec   $did(60)
  %c BotNetInvite $did(62).state | %c BotNetInviteMax $did(63) | %c BotNetInviteSec $did(65)
  %c BotNetQuit   $did(74).state | %c BotNetQuitMax   $did(75) | %c BotNetQuitSec   $did(77)
  ; general
  %c NetHack              $did(32).state
  %c NetHackMax           $did(189)
  %c FilterKickOnBan      $did(37).state
  %c BanRepeatOffender    $did(43).state
  %c BanRepeatOffenderMax $did(44)
  %c BanRepeatOffenderSec $did(47)
  %c CapsKick    $did(50).state
  %c CapsMax     $did(56)
  %c LongWord    $did(69).state
  %c LongWordMax $did(70)
  %c CtrlKick    $did(73).state
  %c CtrlKickMax $did(80)
  %c BadNick     $did(84).state
  %c SwearKick   $did(86).state
  %c InviteKick  $did(88).state
  %c SpamKick    $did(90).state
  ; exempt
  var %x = 100, %tmp
  while (%x <= 106) {
    %tmp = %tmp $+ $iif($did(%x).state,$mid(wohvni,$calc(%x - 100),1))
    inc %x
  }
  %c ExemptedList %tmp
  ; automodes
  var %f, %i = 108
  while (%i <= 115) {
    %f = %f $+ $iif($did(%i).state,$mid(spitnmlk,$calc(%i - 107),1))
    inc %i
  }
  %c AutoChanModesDefault %f
  var %n = $did(118)
  if ((%n isnum) && (%n > 0)) %c AutoChanModesLimit $int(%n)
  elseif (%n == $null) %c AutoChanModesLimit
  %c AutoChanModesKey $did(117)
  %c AutoChanModesOther $did(119)
  %c AutoChanModesOtherS $did(116).state
  ; load the wordlists into a hash table
  _loadwords
  ; save networks
  _savenc 6 MainList Networks
  ; save channels
  _savenc 11 MainList Channels
  if (!$1) unset %sys.cset.*
  else did -b cset 4
}
on *:dialog:cset:sclick:2:unset %sys.cset.*
on *:dialog:cset:sclick:21:_csel $did(21).sel
on *:dialog:cset:sclick:19:{
  var %d = $did(19,$did(19).sel)
  if ($ini(sys\channels.ini,$+(%d,.,%d))) {
    _ctoggle -u
    _cset.init %d %d
  }
}
on *:dialog:cset:sclick:8:_adnc 6 network Networks List
on *:dialog:cset:sclick:9:_remnc 6
on *:dialog:cset:sclick:12:_adnc 11 channel Channels List
on *:dialog:cset:sclick:17:_remnc 11
alias -l _adnc {
  if ($input(Enter a $2 to add,1,$3-)) {
    did -a cset $1 $ifmatch
    did -c cset $1 $didwm(cset,$1,$ifmatch,1)
  }
  _showdlg cset
}
alias -l _remnc {
  if (($did(cset,$1).sel) && ($did(cset,$1,$ifmatch) != Default)) {
    var %x = $ifmatch
    if ($input(Are you sure you want to remove %x from the list?,136,$2)) {
      did -d cset $1 $didwm(cset,$1,%x,1)
      did -c cset $1 1
    }
  }
  _showdlg cset
}
alias -l _savenc {
  var %i = 1, %l
  while ($did(cset,$1,%i)) {
    if ($ifmatch != Default) %l = %l $ifmatch
    inc %i
  }
  _cset $2- %l
}
alias -l _csel {
  _set Misc ChanLastSel $1
  if ($replace($1,2,22,3,28,1,30,4,99)) did -c cset $ifmatch
}
alias -l _ctoggle { did $1 cset 37,32,43,50,69,73,95,88,84,86,90,7,143,155,182,161,149,137,131,167,173,23,34,40,51,57,62,74 }
on *:dialog:cset:sclick:187:_ctoggle -c
on *:dialog:cset:sclick:188:_ctoggle -u
; actions and wordlist
on *:dialog:cset:sclick:*:{
  var %d = $did
  if (%d ==  68) _a CapsKick
  if (%d ==  72) _a LongWord
  if (%d ==  82) _a ControlCodes
  if (%d == 130) _a TextFlood
  if (%d == 136) _a MassDeopFlood
  if (%d == 142) _a JoinFlood
  if (%d == 148) _a NoticeFlood
  if (%d == 154) _a RepeatFlood
  if (%d == 160) _a CTCPFlood
  if (%d == 166) _a NickFlood
  if (%d == 172) _a MassKick
  if (%d == 178) _a MassBan
  if (%d == 183) _a Clone
  if (%d ==  83) _a QuitFlood
  if (%d == 126) _a BadUserHost
  if (%d == 127) _a Swear
  if (%d == 128) _a Invite
  if (%d == 129) _a Spam
  if ($istok(85 87 89 91,%d,32)) wordlist %d $did(6) $+ $chr(1) $+ $did(11)
  ; botnet
  if ((%d == 79) || (%d isnum 191-196)) botact %d $did(cset,6) $did(cset,11)
}
alias -l _a .timer -m 1 0 act $did(cset,6) $did(cset,11) $1
alias -l wordlist {
  var %d = wordlist, %t
  if ($1) {
    %t = : $replace($1,85,Bad nick or userhost,87,Swear Kick,89,Invites,91,Spam)
    var %d = $+(%d,.,$2,.,$_datfile($+(words_,$replace($1,85,hosts,87,swear,89,invite,91,spam),.txt)))
  }
  _opendlg %d wordlist
  .timer -m 1 0 dialog -t %d Word list %t
}
; word triggers
dialog wordlist {
  title "Word list"
  size -1 -1 110 127
  option dbu
  list 1, 1 16 70 109, size extsel hsbar vsbar
  button "&Add", 2, 76 2 32 12, default
  button "&Edit", 3, 76 27 32 12
  button "&Remove", 4, 76 41 32 12
  button "&Import  >>", 7, 76 55 32 12
  button "&Ok", 5, 76 98 32 12, ok
  button "&Cancel", 6, 76 112 32 12, cancel
  edit "", 8, 1 3 70 11, autohs

  box "Import:", 9, 112 15 73 99
  text "Network:", 10, 116 73 23 8
  text "Channel:", 11, 116 85 22 8
  combo 12, 142 72 40 50, size drop
  combo 13, 142 85 40 50, size drop
  text "The list of banned or trigger words for the network and channel selected below will be imported to the current list.", 14, 116 25 65 43
  button "&Done", 15, 150 99 32 12
}
on *:dialog:wordlist.*:*:*:{
  var %e = $devent, %txt = Type a word here to add.
  goto %e
  :init
  did -fa $dname 8 %txt
  did -c $dname 8 1 1 $calc($len(%txt) +1)
  var %h = $replace($gettok($dname,2,46),,.), %f = $gettok($dname,3-,46), %i = 1, %x = 1
  if ($readini(%f,$gettok(%h,1,46),$gettok(%h,2,46)) != $null) didtok -a $dname 1 32 $ifmatch
  while ($ini(%f,%i)) {
    did -a $dname 12 $ifmatch
    while ($ini(%f,%i,%x)) {
      did -a $dname 13 $ifmatch
      inc %x
    }
    inc %i
  }
  return
  :sclick
  if ($did(8) == %txt) did -rf $dname 8
  var %d = $did
  if (%d isin 56) {
    if (%d == 5) {
      if ($did(1).lines) {
        var %l = $ifmatch, %h = $replace($gettok($dname,2,46),,.), %net = $gettok(%h,1,46), %chan = $gettok(%h,2,46), %f = $gettok($dname,3-,46), %list
        remini %f %net %chan
        flushini %f
        while ($did(1,%l) != $null) {
          %list = %list $ifmatch
          dec %l
        }
        if (%list != $null) writeini -n %f %net %chan %list
      }
    }
    _showdlg cset
  }
  if ((%d == 2) && (!$didwm(1,$did(8),1))) {
    if ($did(8) != $null) {
      did -za $dname 1 $ifmatch
      did -r $dname 8
    }
  }
  if ((%d == 3) && ($did(1).sel)) {
    var %l = $ifmatch
    did -ra $dname 8 $did(1,%l)
    did -d $dname 1 %l
  }
  if (%d == 4) if ($did(1).sel) did -d $dname 1 $ifmatch
  if (%d == 7) dialog -s $dname $dialog($dname).x $dialog($dname).y 375 $dialog($dname).ch
  if (%d == 15) {
    var %n = $gettok($dname,2,46), %net = $did(12,$did(12).sel), %chan = $did(13,$did(13).sel), %f = $gettok($dname,3-,46)
    if ((%net != $gettok(%n,1,1)) && (%chan != $gettok(%n,2,1))) { if ($readini(%f,%net,%chan) != $null) didtok -a $dname 1 32 $ifmatch }
    dialog -s $dname $dialog($dname).x $dialog($dname).y 220 $dialog($dname).ch
  }
  :%e
}
; action
dialog act {
  title "Action"
  size -1 -1 170 147
  option dbu
  button "&Close", 1, 46 131 37 12, ok
  combo 3, 34 3 60 90, drop
  text "Instance:", 4, 5 4 25 8
  tab "General", 5, 4 15 161 99
  check "Warn user with message:", 6, 13 37 71 10, tab 5
  combo 7, 88 50 72 90, tab 5 drop
  text "...and send warning as...:", 8, 20 51 65 8, tab 5
  edit "", 9, 88 36 72 11, tab 5 autohs
  check "Kick user with message:", 10, 13 63 72 10, tab 5
  edit "", 11, 88 63 72 11, tab 5 autohs
  check "Ban user with mask:", 12, 13 78 61 10, tab 5
  combo 13, 88 77 72 90, tab 5 hsbar drop
  text "...ban user for...:", 14, 41 94 46 8, tab 5
  edit "", 15, 88 92 16 11, tab 5
  text "seconds.", 16, 107 94 25 8, tab 5
  tab "Custom", 2
  check "Perform custom command.", 30, 14 35 77 10, tab 2
  edit "", 31, 21 46 127 11, tab 2 autohs
  box "Legend:", 32, 12 60 146 47, tab 2
  text "!nick", 33, 18 70 25 8, tab 2
  text "!chan", 34, 18 82 25 8, tab 2
  text "!address", 35, 18 94 25 8, tab 2
  text "returns the actual nick of the offender.", 36, 55 70 96 8, tab 2
  text "returns the channelname.", 37, 55 82 96 8, tab 2
  text "returns the address of the offender.", 38, 55 94 96 8, tab 2
  tab "Other", 17
  box "Ignore:", 18, 9 31 152 33, tab 17
  check "Ignore user with masktype:", 19, 14 39 74 10, tab 17
  combo 20, 90 38 65 90, tab 17 drop
  text "..and ignore for...:", 21, 40 52 47 8, tab 17
  edit "", 22, 90 51 14 11, tab 17
  text "seconds.", 23, 106 52 22 8, tab 17
  box "Miscellaneous:", 24, 9 65 153 46, tab 17
  check "Beep or play this sound:", 25, 14 75 69 10, tab 17
  button "...", 26, 85 74 64 12, tab 17
  button "!", 27, 151 74 8 12, tab 17
  check "Flash mIRC if it is not the active application.", 28, 14 86 116 10, tab 17
  check "Warn me of this event (echo in active window).", 29, 14 97 123 10, tab 17
  button "cancel", 666, 1 1 1 1, hide cancel
  button "&Help", 39, 86 131 37 12, disable
  check "Use default values for undefined options.", 40, 30 117 109 10
}
alias act {
  var %d = act. $+ $1 $+ . $+ $2 $+ . $+ $3
  _opendlg %d act
  dialog -t %d $dialog(%d).title for $$3 protection.
}
on *:dialog:act.*:init:*:{
  didtok -a $dname 3 44 First offence,Second offence,Third offence,Fourth offence,Fifth offence
  did -c $dname 3 1
  ; warning
  didtok -a $dname 7 44 notice,private message,channel message
  did -c $dname 7 2
  ; ban = 13, ignore = 20
  var %i = 1
  while (%i <= 19) {
    did -a $dname 13,20 $mask(nick!ident@sum-66-m.host.com,%i)
    inc %i
  }
  actinit $dname 1
}
on *:dialog:act.*:sclick:40:_cset Option UseDefaults $did(40).state
on *:dialog:act.*:sclick:3:actinit $dname $did(3).sel
; Yes, the following lines below show repetitive coding.
; I want to be able to look back at this 10 months from now and not get confused.
; editboxes
on *:dialog:act.*:edit:9: .timer $+ $dname $+  9 1 1 _cset $gettok($dname,2-,46) WarnMsg. $+ $did(3).sel $did( 9)
on *:dialog:act.*:edit:11:.timer $+ $dname $+ 11 1 1 _cset $gettok($dname,2-,46) KickMsg. $+ $did(3).sel $did(11)
on *:dialog:act.*:edit:15:.timer $+ $dname $+ 15 1 1 _cset $gettok($dname,2-,46) BanTime. $+ $did(3).sel $did(15)
on *:dialog:act.*:edit:22:.timer $+ $dname $+ 22 1 1 _cset $gettok($dname,2-,46) IgnoreT. $+ $did(3).sel $did(22)
on *:dialog:act.*:edit:31:.timer $+ $dname $+ 31 1 1 _cset $gettok($dname,2-,46) CustomC. $+ $did(3).sel $did(31)
; combo boxes
on *:dialog:act.*:sclick:7: if ($did( 7).sel) _cset $gettok($dname,2-,46) WarnSnd. $+ $did(3).sel $ifmatch
on *:dialog:act.*:sclick:13:if ($did(13).sel) _cset $gettok($dname,2-,46) BanType. $+ $did(3).sel $ifmatch
on *:dialog:act.*:sclick:20:if ($did(20).sel) _cset $gettok($dname,2-,46) IgnoreM. $+ $did(3).sel $ifmatch
; checkboxes
on *:dialog:act.*:sclick:6: _cset $gettok($dname,2-,46) Warn.   $+ $did(3).sel $did(6 ).state
on *:dialog:act.*:sclick:10:_cset $gettok($dname,2-,46) Kick.   $+ $did(3).sel $did(10).state
on *:dialog:act.*:sclick:12:_cset $gettok($dname,2-,46) Ban.    $+ $did(3).sel $did(12).state
on *:dialog:act.*:sclick:19:_cset $gettok($dname,2-,46) Ignore. $+ $did(3).sel $did(19).state
on *:dialog:act.*:sclick:25:_cset $gettok($dname,2-,46) Beep.   $+ $did(3).sel $did(25).state
on *:dialog:act.*:sclick:28:_cset $gettok($dname,2-,46) Flash.  $+ $did(3).sel $did(28).state
on *:dialog:act.*:sclick:29:_cset $gettok($dname,2-,46) WarnMe. $+ $did(3).sel $did(29).state
on *:dialog:act.*:sclick:30:_cset $gettok($dname,2-,46) Custom. $+ $did(3).sel $did(30).state
; sound
on *:dialog:act.*:sclick:26:{
  if ($shortfn($did(26)) == $shortfn($insound($gettok($did(26),-1,46)).fname)) splay stop
  if (($did(26) == ...) && ($sfile(\*.mp3;*.wav;*.mid,Select a sound file for warning.,&Ok))) did -o $dname 26 1 %tmp $ifmatch
  else did -o $dname 26 1 ...
  _cset $gettok($dname,2-,46) Sound. $+ $did(3).sel $did(26)
  _showdlg $dname
}
on *:dialog:act.*:sclick:27:_dsplay $did(26)
; close button
on *:dialog:act.*:sclick:*:{
  if (($did == 1) || ($did == 666)) {
    var %f = sys\channels.ini, %h = $gettok($dname,2-,46), %i = 5
    while (%i) {
      var %x = 1, %y = Kick Ban Warn Custom Ignore Beep Flash WarnMe, %z
      while ($gettok(%y,%x,32)) {
        if ($_sysread(%h,$+($ifmatch,.,%i))) %z = 1
        inc %x
      }
      if (%z) {
        _cset %h MaxOffence %i
        break
      }
      dec %i
    }
    _showdlg cset
    _previewstop
  }
}
alias -l g { return $_repc($readini(sys\channels.ini,n,%act.offence,$+($1,.,$2))) }
; /actinit <dname> <offence num>
alias -l actinit {
  set -u %act.offence $gettok($1,2-,46)
  did $iif($readini(sys\channels.ini,n,Option,UseDefaults),-c,-u) $1 40
  ; warning
  did $iif($g(Warn,$2),-c,-u) $1 6
  if ($g(WarnSnd,$2)) did -c $1 7 $ifmatch
  else did -u $1 7
  if ($g(WarnMsg,$2)) did -ra $1 9 $ifmatch
  else did -r $1 9
  ; kick
  did $iif($g(Kick,$2),-c,-u) $1 10
  if ($g(KickMsg,$2)) did -ra $1 11 $ifmatch
  else did -r $1 11
  ; ban
  did $iif($g(Ban,$2),-c,-u) $1 12
  if ($g(BanType,$2)) did -c $1 13 $ifmatch
  else did -u $1 13
  if ($g(BanTime,$2)) did -ra $1 15 $ifmatch
  else did -r $1 15
  ; ignore
  did $iif($g(Ignore,$2),-c,-u) $1 19
  did -c $1 20 $g(IgnoreM,$2)
  if ($g(IgnoreT,$2)) did -ra $1 22 $ifmatch
  else did -r $1 22
  ; misc
  did $iif($g(Beep,$2),-c,-u) $1 25
  did $iif($g(Flash,$2),-c,-u) $1 28
  did $iif($g(WarnMe,$2),-c,-u) $1 29
  if ($g(Sound,$2)) did -o $1 26 1 $ifmatch
  else did -o $1 26 1 ...
  ; custom
  did $iif($g(Custom,$2),-c,-u) $1 30
  if ($g(CustomC,$2)) did -ra $1 31 $ifmatch
  else did -r $1 31
  if ($istok(Clone JoinFlood NickFlood QuitFlood Spam BadUserHost Invite,$gettok(%act.offence,-1,46),32)) {
    did -b $1 3,4,6,7,8,9
    did -cb $1 10
    writeini -n sys\channels.ini $gettok($1,2-,46) Kick.1 1
  }
}
; botnet action
dialog botact {
  title "Action"
  size -1 -1 169 143
  option dbu
  button "&Ok", 1, 31 127 32 12, ok
  button "&Cancel", 2, 66 127 32 12, cancel
  button "&Help", 3, 101 127 32 12, disable
  tab "General", 39, 2 3 164 119
  check "Set mode +m (moderated)", 4, 11 28 73 10, tab 39
  box "Modes:", 21, 6 18 158 60, tab 39
  check "Set mode +i (invite only)", 5, 11 40 73 10, tab 39
  check "Set mode +l (limit users)", 6, 11 52 73 10, tab 39
  check "Other modes:", 7, 11 64 44 10, tab 39
  edit "", 8, 58 64 20 10, tab 39 autohs
  text "..undo after", 12, 88 65 36 10, tab 39
  text "..undo after", 11, 88 53 36 10, tab 39
  text "..undo after", 10, 88 41 36 10, tab 39
  text "..undo after", 9, 87 29 37 10, tab 39
  edit "", 13, 127 28 15 10, tab 39
  text "min(s).", 17, 144 29 17 10, tab 39
  text "min(s).", 18, 144 41 17 10, tab 39
  edit "", 14, 127 40 15 10, tab 39
  edit "", 15, 127 52 15 10, tab 39
  text "min(s).", 19, 144 53 17 10, tab 39
  edit "", 16, 127 64 15 10, tab 39
  text "min(s).", 20, 144 65 17 10, tab 39
  box "Ignore:", 22, 6 80 158 38, tab 39
  check "CTCPs", 23, 11 90 32 10, tab 39
  check "Remove ignore after...", 27, 11 103 67 10, tab 39
  check "Queries", 24, 50 90 32 10, tab 39
  check "Notices", 25, 87 90 32 10, tab 39
  edit "", 28, 86 103 15 10, tab 39
  text "seconds.", 29, 104 104 25 8, tab 39
  check "DCCs", 26, 126 90 32 10, tab 39
  tab "Other", 40
  box "Other:", 30, 6 21 158 96, tab 40
  edit "", 32, 19 46 138 11, tab 40 autohs
  check "Perform custom command:", 31, 11 35 75 10, tab 40
  check "Clear channel (/clear to minimize screen lag).", 33, 11 62 122 10, tab 40
  check "Flash mIRC if it is not the active application.", 34, 11 75 129 10, tab 40
  check "Always warn me (echo the event in active window).", 35, 11 89 135 10, tab 40
  check "Beep or play this sound:", 36, 11 102 69 10, tab 40
  button "...", 37, 83 101 69 12, tab 40
  button "!", 38, 154 101 7 12, tab 40
}
alias -l botact {
  set -u %botak $1
  _opendlg $+(botak.,$2,.,$3) botact
}
alias -l ^b { return $readini(sys\channels.ini,n,$+(%sys.bot.net,.,%sys.bot.chan,.,%sys.bot.type),$1) }
on *:dialog:botak.*:init:*:{
  var %y, %t = Action for BotNet Protection
  if (%botak) %y = $+($replace(%botak,79,Text,191,Notice,192,Nick,193,Join,194,CTCP,195,Invite,196,Quit),Flood)
  if (%y) {
    %t = $instok(%t,%y,3,32)
    .timer -m 1 0 dialog -t $dname %t
  }
  if (!$dialog(cset)) halt
  set -u %sys.bot.net  $did(cset,11,$did(cset,11).sel)
  set -u %sys.bot.chan $did(cset,6,$did(cset,6).sel)
  set -u %sys.bot.type $+($gettok(%t,4,32),$gettok(%t,3,32))
  var %f = $^b(ModesFinal)
  ; modes
  if (m isincs %f) did -c $dname 4
  if (i isincs %f) did -c $dname 5
  if (l isincs %f) did -c $dname 6
  if ($^b(ModesOtherS)) did -c $dname 7
  did -a $dname 8 $^b(ModesOtherM)
  ; undo modes
  if ($^b(UndoMode+m)) %a 13 $calc($ifmatch / 60)
  if ($^b(UndoMode+i)) %a 14 $calc($ifmatch / 60)
  if ($^b(UndoMode+l)) %a 15 $calc($ifmatch / 60)
  if ($^b(UndoMode+o)) %a 16 $calc($ifmatch / 60)
  ; ignore
  var %c = did -c $dname, %a = did -a $dname
  if ($^b(IgCTCP)) %c 23
  if ($^b(IgPMsg)) %c 24
  if ($^b(IgNtcs)) %c 25
  if ($^b(IgDCCs)) %c 26
  if ($^b(IgUndo)) %c 27
  %a 28 $^b(IgnoreUSec)
  if ($^b(CustomTog)) %c 31
  %a 32 $_repc($^b(CustomCom))
  if ($^b(Clear)) %c 33
  if ($^b(Flash)) %c 34
  if ($^b(Warn)) %c 35
  if ($^b(Beep)) %c 36
  if ($_isfile($^b(Sound))) did -o $dname 37 1 $ifmatch
}
on *:dialog:botak.*:sclick:*:{
  var %d = $did
  if (%d == 38) _dsplay $did(37)
  if (%d == 37) {
    if (($did(%d) == ...) && ($sfile(\*.mid;*.mp3;*.wav;*.ogg,Select a file as warning file.,&Ok))) did -o $dname %d 1 $ifmatch
    else did -o $dname %d 1 ...
    _showdlg $dname
  }
  if (%d == 1) {
    var %modes, %title = $dialog($dname).title, %com = _cset $+($gettok($dname,2-,46),.,$gettok(%title,4,32),$gettok(%title,3,32))
    ; modes
    if ($did(4).state) %modes = m
    if ($did(5).state) %modes = %modes $+ i
    if ($did(6).state) %modes = %modes $+ l
    %com ModesOtherS $did(7).state
    if ($did(8)) %com ModesOtherM $did(8)
    if ($+(%modes,$iif($did(7).state,$did(8)))) %com ModesFinal $ifmatch
    ; undo modes
    %com UndoMode+m $calc($did(13) * 60)
    %com UndoMode+i $calc($did(14) * 60)
    %com UndoMode+l $calc($did(15) * 60)
    %com UndoMode+o $calc($did(16) * 60)
    ; ignore
    %com IgCTCP $did(23).state
    %com IgPMsg $did(24).state
    %com IgNtcs $did(25).state
    %com IgDCCs $did(26).state
    %com IgUndo $did(27).state
    if (($did(28) isnum) && ($did(28) > 0)) %com IgnoreUSec $did(28)
    ; others
    %com CustomTog $did(31).state
    %com CustomCom $_repc($did(32))
    %com Clear $did(33).state
    %com Flash $did(34).state
    %com Warn  $did(35).state
    %com Beep  $did(36).state
    %com Sound $did(37)
  }
  if (%d isnum 1-2) {
    _showdlg cset
    _previewstop
  }
}
alias _dsplay {
  if ($shortfn($1-) == $shortfn($insound($gettok($1-,-1,46)).fname)) _previewstop
  elseif ($isfile($1-)) {
    splay " $+ $1- $+ "
    set %_sys.dsplay $shortfn($1-)
  }
}
alias _previewstop {
  if (%_sys.dsplay) splay stop
  unset %_sys.dsplay
}
; general settings
dialog basic {
  title "Script Options"
  size 27 45 215 177
  option dbu
  list 1, 4 14 56 143, size
  text "Category:", 2, 4 5 25 8
  button "Ok", 3, 85 162 30 12, ok
  button "Cancel", 4, 118 162 30 12, cancel
  button "Help", 5, 151 162 30 12
  tab "General", 6, -30 -30 298 298
  box "IRC:", 7, 64 0 145 81, tab 6
  check "Auto-cycle empty channels.", 8, 71 7 79 10, tab 6
  check "Recall last server on start.", 9, 71 16 74 10, tab 6
  check "Dedicated notice window.", 10, 71 26 74 10, tab 6
  check "CTCP cloaking.", 11, 71 37 51 10, tab 6
  check "Update IAL only if channel users are less...", 12, 71 47 111 10, tab 6
  edit "", 13, 186 46 18 11, tab 6 autohs
  box "Close query windows on:", 14, 64 81 145 47, tab 6
  check "Chat session begin.", 15, 71 89 61 10, tab 6
  check "User quit.", 16, 71 98 50 10, tab 6
  check "Unotify.", 17, 71 107 50 10, tab 6
  check "Delay closing of query for...", 18, 71 116 76 10, tab 6
  combo 19, 150 115 33 50, tab 6 size drop
  text "secs.", 39, 187 116 14 8, tab 6
  box "DNS:", 72, 64 128 145 29, tab 6
  check "Show results in separate window.", 87, 71 135 93 10, tab 6
  check "Calculate lookup duration.", 96, 71 145 78 10, tab 6
  check "Auto regain permanent nick...", 164, 71 68 81 10, tab 6
  edit "", 165, 154 67 50 11, tab 6 autohs
  check "Always show channel IAL status.", 179, 71 57 93 10, tab 6
  tab "Away settings", 97
  check "Autoaway after...", 20, 69 6 56 10, tab 97
  edit "", 21, 139 4 22 11, tab 97
  text "minutes idle.", 22, 164 6 38 8, tab 97
  check "Log messages.", 23, 69 40 50 10, tab 97
  check "Open away window.", 24, 69 51 63 10, tab 97
  box "Away method:", 25, 69 108 133 29, tab 97
  radio "Silent.", 26, 77 116 50 10, group tab 97
  radio "Verbose except in...", 27, 77 125 59 10, tab 97
  edit "", 28, 138 124 61 11, tab 97 autohs
  text "Default away message:", 29, 69 138 58 8, tab 97
  edit "", 30, 69 146 134 11, tab 97 autohs
  button "", 31, 79 96 113 11, tab 97
  button "!", 32, 194 96 7 11, tab 97
  check "Enable away pager, and use file for pager sound...", 33, 69 85 130 10, tab 97
  check "Anti-idle every...", 34, 69 17 51 10, tab 97
  edit "", 35, 139 16 22 11, tab 97
  text "seconds.", 36, 164 18 25 8, tab 97
  check "Always use away nick...", 37, 69 29 70 10, tab 97
  edit "", 38, 139 28 62 11, tab 97 autohs
  check "Flash on new queries, and play sound...", 178, 69 62 131 10, tab 97
  button "", 180, 79 73 113 11, tab 97
  button "!", 181, 194 73 7 11, tab 97
  tab "Personal protection", 98
  edit "", 40, 64 16 16 11, tab 98
  text "CTCPs in", 41, 83 18 25 8, tab 98
  edit "", 42, 110 16 16 11, tab 98
  text "secs, ignore for", 43, 129 18 40 8, tab 98
  edit "", 44, 171 16 16 11, tab 98
  text "secs.", 45, 190 18 17 8, tab 98
  edit "", 46, 64 28 16 11, tab 98
  text "DCCs in", 47, 83 30 25 8, tab 98
  edit "", 48, 110 28 16 11, tab 98
  text "secs, ignore for", 49, 129 30 40 8, tab 98
  edit "", 50, 171 28 16 11, tab 98
  text "secs.", 51, 190 30 17 8, tab 98
  edit "", 52, 64 40 16 11, tab 98
  text "Queries in", 53, 83 42 25 8, tab 98
  edit "", 54, 110 40 16 11, tab 98
  text "secs, ignore for", 55, 129 42 40 8, tab 98
  edit "", 56, 171 40 16 11, tab 98
  text "secs.", 57, 190 42 17 8, tab 98
  edit "", 58, 64 52 16 11, tab 98
  text "Notices in", 59, 83 54 25 8, tab 98
  edit "", 60, 110 52 16 11, tab 98
  text "secs, ignore for", 61, 129 54 40 8, tab 98
  edit "", 62, 171 52 16 11, tab 98
  text "secs.", 63, 190 54 17 8, tab 98
  box "If being flooded...:", 64, 65 70 142 84, tab 98
  check "kickban flooder from all channels.", 65, 75 83 93 10, tab 98
  check "add flooder to permanent ignore list.", 66, 75 93 110 10, tab 98
  check "close all query and DCC windows of flooder.", 67, 75 103 116 10, tab 98
  check "flash mIRC if it is not active.", 68, 75 113 79 10, tab 98
  check "beep or play alert sound if away.", 69, 75 124 106 10, tab 98
  button "", 70, 84 135 100 12, tab 98
  button "!", 71, 187 135 9 12, tab 98
  tab "Request filter", 103
  box "Filter...:", 73, 65 4 141 45, tab 103
  check "Messages.", 74, 72 14 43 10, tab 103
  check "Notices.", 75, 72 25 41 10, tab 103
  check "DCC sends.", 76, 72 36 42 10, tab 103
  check "DCC chats.", 77, 144 13 40 10, tab 103
  check "All requests.", 78, 144 25 41 10, tab 103
  box "Options:", 79, 65 49 141 34, tab 103
  check "Hide filter window.", 80, 72 58 56 10, tab 103
  check "Send auto-reply.", 81, 72 69 52 10, tab 103
  box "Exempt list:", 82, 65 83 141 74, tab 103
  list 83, 67 91 104 54, tab 103 size hsbar vsbar
  button "Add...", 84, 173 98 30 11, tab 103
  button "Edit...", 85, 173 110 30 11, tab 103
  button "Remove...", 86, 173 122 30 11, tab 103
  check "Enable exempt list.", 107, 69 146 63 10, tab 103
  edit "", 163, 125 68 77 11, tab 103 autohs
  tab "Quit messages", 105
  list 88, 67 17 140 84, tab 105 size hsbar vsbar
  box "Quit messages:", 89, 65 8 145 111, tab 105
  box "The X message:", 90, 65 120 144 23, tab 105
  combo 91, 68 128 139 150, tab 105 edit drop
  check "Random quit message if no quit message is given.", 92, 71 146 132 10, tab 105
  button "Add...", 93, 106 103 33 11, tab 105
  button "Remove...", 94, 140 103 33 11, tab 105
  button "Edit...", 95, 174 103 33 11, tab 105
  tab "Function keys", 106
  list 99, 67 19 40 55, tab 106 size vsbar
  button "Add...", 101, 129 143 37 11, tab 106
  list 102, 67 88 52 65, tab 106 sort size vsbar
  button "Remove...", 104, 169 143 37 11, tab 106
  box "F-keys:", 100, 64 11 145 67, tab 106
  text "F1", 134, 112 23 12 8, tab 106
  text "Shift+F1", 135, 112 41 24 8, tab 106
  text "Ctrl+F1", 136, 112 59 21 8, tab 106
  combo 137, 140 58 65 100, tab 106 sort drop
  combo 138, 140 40 65 100, tab 106 sort drop
  combo 139, 140 22 65 100, tab 106 sort drop
  box "Commands:", 140, 64 80 145 78, tab 106
  text "Select a command from the list to view its description.", 141, 129 87 76 54, tab 106
  tab "Titlebar", 108
  box "Show in titlebar:", 109, 65 11 143 101, tab 108
  list 110, 73 23 42 81, tab 108 size
  button "Add ->", 111, 117 44 30 12, tab 108
  button "<- Rem", 112, 117 59 30 12, tab 108
  list 113, 149 23 42 81, tab 108 size
  scroll "", 114, 195 48 8 15, tab 108 range 10 
  check "Update titlebar every...", 117, 66 122 67 10, tab 108
  edit "", 118, 146 121 19 11, tab 108
  text "second(s).", 119, 168 123 28 8, tab 108
  check "Show this if not connected...", 115, 66 136 79 10, tab 108
  edit "", 116, 146 135 56 11, tab 108 autohs
  tab "Event Sounds", 120
  box "Play sound on...:", 121, 64 3 147 154, tab 120
  check "Start", 122, 73 13 35 10, tab 120
  check "Connect", 123, 73 26 35 10, tab 120
  check "Join", 124, 73 39 35 10, tab 120
  check "Part", 125, 73 52 35 10, tab 120
  check "Quit", 126, 73 65 35 10, tab 120
  check "Nick", 127, 73 78 35 10, tab 120
  check "Op", 128, 73 91 35 10, tab 120
  check "Deop", 129, 73 104 35 10, tab 120
  check "Voice", 130, 73 117 35 10, tab 120
  check "Devoice", 131, 73 130 35 10, tab 120
  check "Kick", 132, 73 143 35 10, tab 120
  button "", 133, 110 12 85 11, tab 120
  button "", 142, 110 25 85 11, tab 120
  button "", 143, 110 38 85 11, tab 120
  button "", 144, 110 51 85 11, tab 120
  button "", 145, 110 64 85 11, tab 120
  button "", 146, 110 77 85 11, tab 120
  button "", 147, 110 90 85 11, tab 120
  button "", 148, 110 103 85 11, tab 120
  button "", 149, 110 116 85 11, tab 120
  button "", 150, 110 129 85 11, tab 120
  button "", 151, 110 142 85 11, tab 120
  button "!", 152, 197 12 8 11, tab 120
  button "!", 153, 197 25 8 11, tab 120
  button "!", 154, 197 38 8 11, tab 120
  button "!", 155, 197 51 8 11, tab 120
  button "!", 156, 197 64 8 11, tab 120
  button "!", 157, 197 77 8 11, tab 120
  button "!", 158, 197 90 8 11, tab 120
  button "!", 159, 197 103 8 11, tab 120
  button "!", 160, 197 116 8 11, tab 120
  button "!", 161, 197 129 8 11, tab 120
  button "!", 162, 197 142 8 11, tab 120
  tab "Kick Messages", 166
  list 167, 67 14 117 131, tab 166 size extsel
  button "Edit...", 168, 187 54 25 11, tab 166
  button "Default", 169, 187 66 25 11, tab 166
  check "Append kick information to custom messages.", 170, 67 147 134 10, tab 166
  list 176, 1 1 1 1, hide tab 166
  tab "CTCP Replies", 171
  list 172, 66 14 119 143, tab 171 size
  button "Add...", 173, 187 53 25 11, tab 171
  button "Edit...", 174, 187 65 25 11, tab 171
  button "Delete", 175, 187 77 25 11, tab 171
  list 177, 1 1 1 1, hide tab 171
  tab "Windows", 182
  box "Open these windows on desktop:", 183, 63 12 149 101, tab 182
  check "Script options", 184, 74 22 50 10, tab 182
  check "Channel options", 185, 74 33 50 10, tab 182
  check "Servers editor", 186, 74 44 50 10, tab 182
  check "Networks", 187, 74 55 50 10, tab 182
  check "Perform on start", 188, 74 66 50 10, tab 182
  check "Backup dialog", 189, 74 77 50 10, tab 182
  check "Clone scan", 190, 74 88 50 10, tab 182
  check "Who window", 191, 74 99 50 10, tab 182
  check "Userlist", 192, 151 22 50 10, tab 182
  check "DCC history", 193, 151 33 50 10, tab 182
  check "Failed sends", 194, 151 44 50 10, tab 182
  check "Display settings", 195, 151 55 50 10, tab 182
  check "Private requests", 196, 151 66 50 10, tab 182
  check "Away log", 197, 151 77 50 10, tab 182
  check "Notice window", 198, 151 88 50 10, tab 182
  check "DNS results", 199, 151 99 50 10, tab 182
  check "Close Status Windows on disconnect.", 200, 75 123 102 10, tab 182
  box "Other settings:", 201, 63 114 148 43, tab 182
  check "Autohide windows.", 202, 75 133 58 10, tab 182
  check "Open log for windows:", 203, 75 143 65 10, tab 182
  combo 204, 144 142 39 50, tab 182 size drop
}
alias nb _opendlg basic
alias tab {
  if ($1 == $null) return $chr(9)
  var %i = 1, %r
  while ($($+($,%i),2) != $null) {
    %r = $instok(%r,$ifmatch,0,9)
    inc %i
  }
  return %r
}
on *:dialog:basic:init:*:{
  didtok -a basic 1 44 General,Away Settings,Personal Protection,Request Filter,Quit Messages,Function Keys,Titlebar,Event Sounds,Kick Messages,CTCP Replies,Windows
  if ($group(#autocycle) == on) did -c basic 8
  if ($group(#recallserver) == on) did -c basic 9
  if ($group(#dnwin) == on) did -c basic 10
  if ($group(#ctcpcloak) == on) did -c basic 11
  if ($group(#ial.limit) == on) did -c basic 12
  if ($group(#autonickregain) == on) did -c basic 164
  if ($_(autonickregain,nick)) did -a basic 165 $ifmatch
  if ($_(IAL,Limit)) did -a basic 13 $ifmatch
  if ($_(IAL,ShowStatus)) did -c $dname 179
  ; query windows
  var %i = 1
  while (%i <= 20) {
    did -a basic 19 %i
    inc %i
  }
  if ($_(CloseQuery,Chat)) did -c basic 15
  if ($_(CloseQuery,Quit)) did -c basic 16
  if ($_(CloseQuery,Unot)) did -c basic 17
  if ($_(CloseQuery,Time)) did -c basic 18
  if ($_(CloseQuery,Secs)) did -c basic 19 $didwm(basic,19,$ifmatch,1)
  ; dns
  if ($_(DNS,Win)) did -c basic 87
  if ($_(DNS,Dur)) did -c basic 96
  ; away
  if ($_(Away,AutoAway)) did -c basic 20
  if ($_(Away,AutoAwayTime)) did -a basic 21 $ifmatch
  if ($_(Away,Log)) did -c basic 23
  if ($_(Away,Window)) did -c basic 24
  did -c basic $iif($_(Away,Method) == Silent,26,27)
  if ($_(Away,VerboseExcept)) did -a basic 28 $ifmatch
  if ($_(Away,Reason)) did -a basic 30 $_repc($ifmatch)
  if ($_(Away,Pager)) did -c basic 33
  if ($_(Away,PagerSound)) did -o basic 31 1 $ifmatch
  if ($_(Away,AntiIdle)) did -c basic 34
  if ($_(Away,AntiIdleTime)) did -a basic 35 $ifmatch
  if ($_(Away,UseAnick)) did -c basic 37
  if ($_(Away,AwayNick)) did -a basic 38 $ifmatch
  if ($_(Away,FlashOnQuery)) did -c $dname 178
  if ($_isfile($_(Away,FlashSound))) did -o $dname 180 1 $ifmatch
  ; personal protection
  var %a = did -a basic
  %a 40 $_(SelfProt,CTCPMax)
  %a 42 $_(SelfProt,CTCPSec)
  %a 44 $_(SelfProt,CTCPIgn)
  %a 46 $_(SelfProt,DCCMax)
  %a 48 $_(SelfProt,DCCSec)
  %a 50 $_(SelfProt,DCCIgn)
  %a 52 $_(SelfProt,MsgMax)
  %a 54 $_(SelfProt,MsgSec)
  %a 56 $_(SelfProt,MsgIgn)
  %a 58 $_(SelfProt,NoticeMax)
  %a 60 $_(SelfProt,NoticeSec)
  %a 62 $_(SelfProt,NoticeIgn)
  var %c = did -c basic
  if ($_(SelfProt,KickBan)) %c 65
  if ($_(SelfProt,PermIgnore)) %c 66
  if ($_(SelfProt,CloseWindows)) %c 67
  if ($_(SelfProt,FlashmIRC)) %c 68
  if ($_(SelfProt,BeepAlert)) %c 69
  if ($_isfile($_(SelfProt,AlertSound))) did -o basic 70 1 $ifmatch
  ; request filter
  var %i = 1, %l = Msg Ntc Snd Cht All Hah Hwn Rep
  while ($gettok(%l,%i,32)) {
    if ($_(Filter,$ifmatch)) did -c basic $calc(%i + 73)
    inc %i
  }
  if ($_(Filter,Ex)) did -c basic 107
  if ($lines($exmpt.dat)) filter -fo $exmpt.dat basic 83 *
  if ($_(Filter,ExAutoReply) != $null) did -a basic 163 $_repc($ifmatch)
  ; quit msgs
  if ($lines($quits.txt)) {
    filter -cfo $quits.txt basic 88 *
    filter -cfo $quits.txt basic 91 *
  }
  if ($_(Quit,RandMsg)) did -c basic 92
  if ($_(Quit,TheXMsg)) {
    var %m = $ifmatch
    did -a basic 91 $replace(%m,&b,,&u,,&k,,&o,)
    did -c basic 91 $didwm(basic,91,%m,1)
  }
  ; titlebar
  didtok -a basic 110 46 Date.Time.Current Nick.Usermode.Server.Away status.Channel.Self-lag.System uptime.Server uptime
  if ($_(titlebar,Connected)) didtok -a basic 113 46 $ifmatch
  if ($_(titlebar,Update)) did -c basic 117
  if ($_(titlebar,UpdateSec)) did -a basic 118 $ifmatch
  if ($_(titlebar,Disconnected)) did -c basic 115
  if ($_(titlebar,DisconnectedText)) did -a basic 116 $ifmatch
  if ($_(ScriptOptions,LastSelected)) {
    var %x = $ifmatch
    did -c basic 1 $ifmatch
    .timer -m 1 0 basicsel %x
  }
  else did -c basic 1 1
  ; ctcp replies
  ; no need to initialize because cprot.mrc also has a MDX init event for this dialog
  listview $dname 172 report rowselect showsel
  headersizes $dname 172 90 142
  headers $dname 172 $tab(Request,Reply)
  if ($_isfile($_datfile(ctcps.txt))) {
    filter -cfo $ifmatch $dname 177
    filter -cfo $ifmatch $dname 172
  }
  ; window settings
  var %i = 1, %list = $_dialogs PrivateRequests AwayLog DNWin DNSWin
  while ($gettok(%list,%i,32)) {
    if ($_(desktop,$ifmatch)) did -c $dname $calc(%i + 183)
    inc %i
  }
  if ($_(windows,closestatus)) did -c $dname 200
  if ($group(#autohide) == on) did -c basic 202
  if ($_(windows,_openlog)) did -c basic 203
  didtok -a basic 204 32 Channels Chats Both
  if ($_(windows,_openlogmethod)) did -c basic 204 $ifmatch
}
alias -l _dialogs { return basic cset spop networks pos backup clone whowin userlist dcchist sendfail display }
alias quit {
  if (!$server) return
  if ($1 == $null) !quit $iif($_(Quit,RandMsg) && $lines($quits.txt),$read($quits.txt))
  else !quit $1-
}
alias _sysQuitMessage {
  if (($_(Quit,RandMsg)) && ($lines($quits.txt))) return $read($quits.txt)
  ; if ($_(Quit,TheXMsg) != $null) return $ifmatch
  return Client exited.
}
on *:dialog:basic:sclick:5:_bld $dname | bhelp $did(1,$did(1).sel)
on *:dialog:basic:sclick:1:{
  if ($did(1).sel != $_(ScriptOptions,LastSelected)) _previewstop
  basicsel $did(1).sel
  _set ScriptOptions LastSelected $did(1).sel
}
alias -l basicsel {
  var %c = did -c basic
  if ($1 == 1) %c 6
  if ($1 == 2) %c 97
  if ($1 == 3) %c 98
  if ($1 == 4) %c 103
  if ($1 == 5) %c 105
  if ($1 == 6) %c 106
  if ($1 == 7) %c 108
  if ($1 == 8) %c 120
  if ($1 == 9) %c 166
  if ($1 == 10) %c 171
  if ($1 == 11) %c 182
}
on *:dialog:basic:sclick:31:_selsound 31 pager
on *:dialog:basic:sclick:32:_dsplay $did(31)

on *:dialog:basic:sclick:180:_selsound 180 new query
on *:dialog:basic:sclick:181:_dsplay $did(180)

; self-prot
on *:dialog:basic:sclick:70:_selsound 70 alert
on *:dialog:basic:sclick:71:_dsplay $did(70)

alias _selsound {
  if ($did(basic,$1)) {
    var %f = $ifmatch, %t = $gettok(%f,-1,46)
    if ($shortfn(%f) == $shortfn($($+($!in,$+(%t,$iif(%t == mid,i,$iif(%t == wav,e))),.fname),2))) splay stop
    did -r basic $1
  }
  elseif ($sfile(\*.wav;*.mid;*.mp3;*.ogg,Select a sound file for $2 sound.,&Select)) did -o basic $1 1 $ifmatch
  dialog -v basic
}

; request filter
on *:dialog:basic:sclick:78:did $iif($did(78).state,-b,-e) basic 74,75,76,77
on *:dialog:basic:sclick:84:{
  var %t = Enter a hostmask or nickname to be exempted from the filter. For example: $+ $str($crlf,2) $+ NickServ!*@* $+ $crlf $+ *!*@admin.mircscripts.org
  if ($input(%t,1,Request filter editor)) did -a basic 83 $ifmatch
  _showdlg basic
}
on *:dialog:basic:sclick:85:{
  if ($did(83).sel) {
    var %l = $ifmatch
    if ($input(Enter new entry:,1,Request filter editor,$did(83,%l))) did -o basic 83 %l $ifmatch
  }
  _showdlg basic
}
on *:dialog:basic:sclick:86:{
  if ($did(83).sel) {
    var %l = $ifmatch
    if ($input(Are you sure you want to remove $did(83,%l) from the list?,264,Remove from request filter exemption?)) did -d basic 83 %l
  }
  _showdlg basic
}
; quit messages
on *:dialog:basic:sclick:93:{
  if ($input(Enter a new quit message to be added:,1,Quit message editor)) did -a basic 88 $ifmatch
  _showdlg basic
}
on *:dialog:basic:sclick:94:{
  if ($did(88,$did(88).sel) != $null) {
    var %m = Are you sure you want to delete the quit message: $+ $str($crlf,2) $+ " $+ $ifmatch $+ "?
    if ($input(%m,264,Delete quit message)) did -d basic 88 $did(88).sel
  }
  _showdlg basic
}
on *:dialog:basic:sclick:95:{
  if ($did(88).sel) {
    var %ln = $ifmatch
    if ($input(Edit the following quit message:,1,Edit quit message,$did(88,%ln)) != $null) did -o basic 88 %ln $ifmatch
  }
  _showdlg basic
}
on *:dialog:basic:sclick:4:_previewstop
on *:dialog:basic:sclick:3:{
  $iif($did( 8).state,.enable,.disable) #autocycle
  $iif($did( 9).state,.enable,.disable) #recallserver
  $iif($did(10).state,.enable,.disable) #dnwin
  $iif($did(11).state,.enable,.disable) #ctcpcloak
  $iif($did(12).state,.enable,.disable) #ial.limit
  $iif($did(164).state,.enable,.disable) #autonickregain
  _set IAL Limit $did(13)
  _set IAL ShowStatus $did(179).state
  _set autonickregain nick $did(165)
  ; query
  _set CloseQuery Chat $did(15).state
  _set CloseQuery Quit $did(16).state
  _set CloseQuery Unot $did(17).state
  _set CloseQuery Time $did(18).state
  _set CloseQuery Secs $did(19)
  ; dns
  _set DNS Win $did(87).state
  _set DNS Dur $did(96).state
  ; away
  var %a = _set Away
  %a AutoAway      $did(20).state
  %a AutoAwayTime  $did(21)
  %a Log           $did(23).state
  %a Window        $did(24).state
  %a Method        $iif($did(26).state,Silent,Verbose)
  %a VerboseExcept $did(28)
  %a Pager         $did(33).state
  %a Reason        $_repc($did(30))
  %a PagerSound    $did(31)
  %a AntiIdle      $did(34).state
  %a AntiIdleTime  $did(35)
  %a UseANick      $did(37).state
  %a AwayNick      $did(38)
  %a FlashOnQuery  $did(178).state
  %a FlashSound    $did(180)
  if ($server) {
    if (!$away) AutoAwayEnable
    if (!$did(34).state) .timer. $+ $cid $+ .Sys.AntiIdle off
  }
  ; personal protection
  var %s = _set SelfProt
  %s CTCPMax $did(40)
  %s CTCPSec $did(42)
  %s CTCPIgn $did(44)
  %s DCCMax $did(46)
  %s DCCSec $did(48)
  %s DCCIgn $did(50)
  %s MsgMax $did(52)
  %s MsgSec $did(54)
  %s MsgIgn $did(56)
  %s NoticeMax $did(58)
  %s NoticeSec $did(60)
  %s NoticeIgn $did(62)
  %s KickBan      $did(65).state
  %s PermIgnore   $did(66).state
  %s CloseWindows $did(67).state
  %s FlashmIRC    $did(68).state
  %s BeepAlert    $did(69).state
  %s AlertSound   $did(70)
  ; request filter
  var %f = _set Filter
  %f Msg $did(74).state
  %f Ntc $did(75).state
  %f Snd $did(76).state
  %f Cht $did(77).state
  %f All $did(78).state
  %f HWn $did(80).state
  %f Rep $did(81).state
  %f Ex $did(107).state
  write -c $exmpt.dat
  if ($did(83).lines) filter -if basic 83 $exmpt.dat *
  if ($did(163) != $null) _set Filter ExAutoReply $_repc($ifmatch)
  _SysLoadFilterList
  ; quit messages
  filter -cif basic 88 $quits.txt *
  _set Quit RandMsg $did(92).state
  _set Quit TheXMsg $replace($did(91),,&b,,&u,,&k,,&o)
  ; titlebar
  var %i = 1, %t
  while (%i <= $did(113).lines) {
    %t = $addtok(%t,$did(113,%i),46)
    inc %i
  }
  _set titlebar Connected %t
  _set titlebar Disconnected $did(115).state
  _set titlebar DisconnectedText $did(116)
  _set titlebar Update $did(117).state
  _set titlebar UpdateSec $did(118))
  if (!$_connected) { if ($_(titlebar,Disconnected)) titlebar $_(titlebar,DisconnectedText) }
  else {
    if ($did(117).state) scid -a _SysTitleBarTimer $!cid
    else {
      .timer.SysTitleBarUpdate off
      .timer.*.SysSelfLag off
      titlebar
    }
  }
  _previewstop
  ; ctcp replies
  filter -cif $dname 177 $_datfile(ctcps.txt)
  ; windows
  var %i = 184, %list = $_dialogs
  while ($gettok(%list,$calc(%i - 183),32)) {
    _set desktop $ifmatch $did(%i).state
    inc %i
  }
  _set desktop PrivateRequests $did(196).state
  _set desktop AwayLog $did(197).state
  _set desktop DNWin $did(198).state
  _set desktop DNSWin $did(199).state
  _set windows closestatus $did(200).state
  $iif($did(202).state,.enable,.disable) #autohide
  if (!$did(202).state) scid -a unhidewindows
  _set windows _openlog $did(203).state
  _set windows _openlogmethod $did(204).sel

}

#autohide off
on *:active:*:scid -a autohidewindows $activecid
#autohide end
alias -l autohidewindows {
  var %i = 1, %w
  while ($window(*,%i)) {
    %w = $ifmatch
    if ($chr(32) isin %w) %w = $+(",%w,")
    if ($window(*,%i).cid == $1) window -w %w
    elseif (%w != "Status Window") window -h %w
    inc %i
  }
}
alias -l unhidewindows {
  var %i = 1, %w
  while ($window(*,%i)) {
    %w = $ifmatch
    if ($chr(32) isin %w) %w = $+(",%w,")
    window -w %w
    inc %i
  }
}
; titlebar routines
on *:dialog:basic:sclick:113:did -c basic 114 $did(113).sel
on *:dialog:basic:scroll:114:_dlgscroll basic 113 114
on *:dialog:basic:sclick:111:{
  if ($did(110).sel) {
    var %t = $ifmatch, %i = $did(110,%t)
    if (!$didwm(basic,113,%i,1)) did -a basic 113 %i
  }
}
on *:dialog:basic:sclick:112:if ($did(113).sel) did -d basic 113 $ifmatch

; ctcp replies
on *:dialog:basic:sclick:173:{
  var %text = Enter CTCP request and reply. For example: $+ $str($crlf,2) $+ TIME The time in my country is now $time
  if ($input(%text,1,Custom CTCP Reply)) {
    var %ctcp = $gettok($ifmatch,1,32) $+ $chr(9) $+ $gettok($ifmatch,2-,32)
    did -a $dname 177 %ctcp
    did -a $dname 172 %ctcp
  }
  _showdlg $dname
}
on *:dialog:basic:sclick:174:{
  if ($did(172).sel) {
    var %l = $ifmatch, %c = $did(177,$calc(%l - 1))
    tokenize 9 %c
    if ($input(Enter new reply for $1 $+ :,1,Custom CTCP Reply,$2-)) {
      did -o $dname 177 $calc(%l - 1) $1 $+ $chr(9) $+ $ifmatch
      did -o $dname 172 %l $1 $+ $chr(9) $+ $ifmatch
    }
    _showdlg $dname
  }
}
on *:dialog:basic:sclick:175:{
  if ($did(172).sel) {
    did -d $dname 172 $ifmatch
    did -d $dname 177 $calc($ifmatch - 1)
  }
}
on *:dialog:basic:sclick:*:if ($dialog($dname).tab == $did) did -c $dname 1 $didwm($dname,1,$did($did).text,1)
; would *YOU* have thought of this? >:P ----^

; undernet
dialog xban {
  title "X Ban"
  size -1 -1 160 81
  option dbu
  text "Channel:", 3, 24 3 24 8, right
  text "Nick or userhost:", 4, 3 15 45 8, right
  text "Duration:", 5, 21 27 27 8, right
  text "Level:", 6, 30 39 18 8, right
  text "Reason:", 7, 23 51 25 8, right
  edit "", 8, 50 50 105 11, autohs
  combo 9, 50 38 104 50, edit drop
  combo 10, 50 26 104 50, size edit drop
  combo 11, 50 14 104 50, size edit drop
  combo 12, 50 2 104 50, size edit drop
  button "&Ok", 13, 46 68 32 12, ok
  button "&Cancel", 14, 81 68 32 12, cancel
}
on *:dialog:xban:init:*:_xbaninit xban
on *:dialog:xban:sclick:13:if (($did(12)) && ($did(11))) x ban $did(12) $did(11) $gettok($did(10),1,32) $did(9) $did(8)
; EOF