zIRCk Final Project — File Browser

zIRCkFinalProjectv2.5 / zIRCkFinalProjectv2.5 / System / script5.mrc

script5.mrc — 33.98 KB — Download this file

[SCRIPT]
NAME=Script Configuration
VERSION=2.5

; ## Script Configuration
; ## [AFX] 2005

; ## Configuration aliases

alias cfg_isstate { if ($1-) { return $iif($gettok($1-,5,32) = 2,on,off) } }

; ## Call config dialog

alias config { dodialog config }

; ## Button style

alias cfg_button {
  if ($1) {
    var %c
    if ($1 = 1) { %c = Border }
    elseif ($1 = 2) { %c = Clientedge }
    elseif ($1 = 3) { %c = Dlgmodal }
    elseif ($1 = 4) { %c = Dlgframe }
    elseif ($1 = 5) { %c = Staticedge }
    elseif ($1 = 6) { %c = Windowedge }
    return %c
  }
}

; ## Refresh nickLUST setup icons

alias cfg_nicklust {
  if ($dialog(config)) {
    did -r config 40
    did -i config 40 1 clearicons normal
    did -i config 40 1 seticon list $rconf(NickLust,Normal)
    did -i config 40 1 seticon list $rconf(NickLust,Voice)
    did -i config 40 1 seticon list $rconf(NickLust,Channel)
    did -i config 40 1 seticon list $rconf(NickLust,Half)
    did -i config 40 1 seticon list $rconf(NickLust,User)
    did -i config 40 1 seticon list $rconf(NickLust,Super)
    did -i config 40 1 seticon list $rconf(NickLust,Owner)
    did -a config 40 0 1 Normal user
    did -a config 40 0 2 Voiced user
    did -a config 40 0 3 Channel operator
    did -a config 40 0 4 Half operator
    did -a config 40 0 5 User operator
    did -a config 40 0 6 Super operator
    did -a config 40 0 7 Owner
  }
}

; ## Refresh switchbar setup icons

alias cfg_switchbar {
  if ($dialog(config)) {
    did -r config 51
    did -i config 51 1 clearicons normal
    did -i config 51 1 seticon list $rconf(Switchbar,Status)
    did -i config 51 1 seticon list $rconf(Switchbar,Channel)
    did -i config 51 1 seticon list $rconf(Switchbar,Query)
    did -i config 51 1 seticon list $rconf(Switchbar,Custom)
    did -i config 51 1 seticon list $rconf(Switchbar,DCCChat)
    did -i config 51 1 seticon list $rconf(Switchbar,DCCSend)
    did -i config 51 1 seticon list $rconf(Switchbar,DCCGet)
    did -a config 51 0 1 Status window
    did -a config 51 0 2 Channel window
    did -a config 51 0 3 Query window
    did -a config 51 0 4 Custom window
    did -a config 51 0 5 DCC chat
    did -a config 51 0 6 DCC send
    did -a config 51 0 7 DCC get
  }
}

; ## Load favourite servers list

alias loadfservs {
  if ([*] iswm $1) { set %topic $remove($1,[,]) } 
  else { 
    did -a config 62 0 + 0 0 $gettok($1-,3,42) %topic $chr(9) $gettok($1-,1,61) $chr(9) $gettok($1-,2,42)
  }
}

; ## Check VERSION reply stuff

alias ctcp_vcheck {
  if ($gettok($read($_doc(CTCPs),w,*VERSION*),2,42) = version) && ($gettok($read($_doc(CTCPs),w,*VERSION*),1,42) = 2) { vspoof $gettok($read($_doc(CTCPs),w,*VERSION*),3,42) }
  elseif ($gettok($read($_doc(CTCPs),w,*VERSION*),2,42) != version) || ($gettok($read($_doc(CTCPs),w,*VERSION*),1,42) = 1) || (!$gettok($read($_doc(CTCPs),w,*VERSION*),2,42)) {  vspoof -halt } 
}

; ## Load CTCP replies

alias cfg_ctcps {
  if ($dialog(config)) {
    did -r config 73
    set %inc 2
    .filter -k $_doc(CTCPs) cfg_ctcpadd
    unset %inc
  }
}

alias cfg_ctcpadd {
  did -a config 73 $gettok($1-,2,42) $chr(9) $gettok($1-,3-,42)
  did -o config 73 %inc 0 0 0 $iif($gettok($1-,1,42) = 2,2,1) $gettok($did(config,73,%inc),6-,32))
  inc %inc
}

; ## Save CTCP replies states

alias cfg_ctcpstates { 
  if ($dialog(config)) {
    set %inc 2
    filter -k $_doc(CTCPs) cfg_ctcpcheckstates
    unset %inc
  }
}

alias cfg_ctcpcheckstates {
  whilefix
  if ($gettok($did(config,73,%inc),5,32) = 2) {
    write -l $+ $calc(%inc -1) $_doc(CTCPs) $replace($1-,1,2)
  }
  elseif ($gettok($did(config,73,%inc),5,32) = 1) {
    write -l $+ $calc(%inc -1) $_doc(CTCPs) $replace($1-,2,1)
  }
  inc %inc
}

; ## Load function key bindings

alias cfg_fkeys {
  if ($dialog(config)) {
    did -r config 77
    filter -k $_doc(Fkeys) cfg_fkeyadd
  }
}

alias cfg_fkeyadd {
  did -a config 77 $gettok($1-,1,42) $chr(9) $gettok($1-,2-,42) 
}

; ## Load bad words

alias cfg_badwords {
  if ($dialog(config)) {
    did -r config 80
    filter -k $_doc(Badwords) cfg_addbadwords
  }
}

alias cfg_addbadwords { 
  did -a config 80 $1-
}

; ## Load quit messages

alias cfg_quits {
  if ($dialog(config)) {
    did -r config 87
    filter -k $_doc(Quits) cfg_addquits
  }
}

alias cfg_addquits {
  did -a config 87 $1-
}

; ## Default nickLUST icons

alias def_nicklust {
  var %c = conf Nicklust
  %c Normal $shortfn($scriptdirIcons\nrm.ico)
  %c Voice $shortfn($scriptdirIcons\voice.ico)
  %c Channel $shortfn($scriptdirIcons\op.ico)
  %c Half $shortfn($scriptdirIcons\hop.ico)
  %c User $shortfn($scriptdirIcons\usr.ico)
  %c Super $shortfn($scriptdirIcons\spr.ico) 
  %c Owner $shortfn($scriptdirIcons\ownr.ico)
  if ($dialog(config)) { cfg_nicklust }
}

; ## Default switchbar icons

alias def_switchbar {
  var %c = conf Switchbar
  %c Status $+(0,$chr(44),$shortfn($scriptdirIcons\Switchbar.icl))
  %c Channel $+(1,$chr(44),$shortfn($scriptdirIcons\Switchbar.icl))
  %c Query $+(2,$chr(44),$shortfn($scriptdirIcons\Switchbar.icl))
  %c Custom $+(3,$chr(44),$shortfn($scriptdirIcons\Switchbar.icl))
  %c DCCChat $+(4,$chr(44),$shortfn($scriptdirIcons\Switchbar.icl))
  %c DCCSend $+(5,$chr(44),$shortfn($scriptdirIcons\Switchbar.icl))
  %c DCCGet $+(6,$chr(44),$shortfn($scriptdirIcons\Switchbar.icl))
  if ($dialog(config)) { cfg_switchbar }
  bbar_refresh
}

; ## List networks/servers

alias servers {
  if ($dialog(mserv)) {
    if ($1 = -s) && ($2) {
      did -ra mserv 7 Listing servers...
      var %a = $server(0).group
      while (%a) { 
        whilefix
        if ($2 isin $server(%a).group) { did -a mserv 3 $server(%a).group $chr(9) $server(%a) $chr(9) $server(%a).port }
        dec %a
      }
      did -ra mserv 7 $calc($did(mserv,3).lines -1) servers listed
    }
    elseif ($1 = -a) {
      did -ra mserv 7 Listing servers...
      var %a = 1
      while (%a <= $server(0)) {
        whilefix
        did -a mserv 3 $server(%a).group $chr(9) $server(%a) $chr(9) $server(%a).port
        inc %a
      }
      did -ra mserv 7 $calc($did(mserv,3).lines -1) servers listed
    }
    elseif ($1 = -g) {
      var %a = 1
      while (%a <= $server(0)) {
        whilefix
        if ($server(%a).group != $did(mserv,2,$did(mserv,2).lines)) { did -a mserv 2 $server(%a).group }
        inc %a
      }
    }
  }
}

; ## Call listing networks dialog 

alias mserv_wait { $iif(!$dialog(mservw),dialog -mo mservw mservw,dialog -v mserv) }

; ## Load Configuration settings

alias load.config {
  if ($dialog(config)) {
    did -ra config 11 $scid($activecid).me
    did -ra config 12 $scid($activecid).anick
    did -ra config 13 $fullname
    did -ra config 14 $email

    $iif($rconf(General,ConfigStart) = on,did -c config 16)
    $iif($rconf(General,CheckUpdates) = on,did -c config 17)
    $iif($rconf(General,LoadBar) = on,did -c config 22)
    $iif($rconf(General,CUpdateTime),did -a config 102 $v1)

    did -o config 30 2 0 0 0 $iif($rconf(Display,Toolbar) = on,2,1) $gettok($did(config,30,2),6-,32))
    did -o config 30 3 0 0 0 $iif($rconf(Display,BBar) = on,2,1) $gettok($did(config,30,3),6-,32))
    did -o config 30 4 0 0 0 $iif($rconf(Display,SidePane) = on,2,1) $gettok($did(config,30,4),6-,32))
    did -o config 30 5 0 0 0 $iif($rconf(Display,NickLust) = on,2,1) $gettok($did(config,30,5),6-,32))
    did -o config 30 6 0 0 0 $iif($rconf(Display,XPBkg) = on,2,1) $gettok($did(config,30,6),6-,32))
    did -o config 30 7 0 0 0 $iif($rconf(Display,XPBscheme) = on,2,1) $gettok($did(config,30,7),6-,32))
    did -o config 30 8 0 0 0 $iif($rconf(Display,BandMeter) = on,2,1) $gettok($did(config,30,8),6-,32))
    did -o config 30 9 0 0 0 $iif($rconf(Display,NotifyWin) = on,2,1) $gettok($did(config,30,9),6-,32))

    didtok config 32 32 Border Clientedge Dlgmodal Dlgframe Staticedge Windowedge
    did -c config 32 $iif($rconf(Display,ButtonSel),$v1,6)

    var %i = 1,%a = $calc($findfile($shortfn($scriptdirIcons\Engine),*.icl,0))
    while %i <= %a {
      if (MP3 !isin $findfile($shortfn($scriptdirIcons\),*.icl,%i)) {
        did -i config 34 1 seticon 0 4, $+ $findfile($shortfn($scriptdirIcons\Engine),*.icl,%i)
        did -a config 34 %i %i 0 0 $nopath($findfile($shortfn($scriptdirIcons\Engine),*.icl,%i))
      }
      inc %i
    }
    $iif($rconf(Display,IclSel),did -c config 34 $v1)
    $iif($rconf(NickLust,Icons) = off,did -c config 44)
    $iif($rconf(Switchbar,ShowDCCs) = on,did -c config 56)

    didtok config 72 42 CTCP replies*Function key bindings*Message blocker*Quit messages
    did -c config 72 1
    didtok config 84 42 Close window*Block user*Both
    $iif($rconf(Misc,BadWordMethod) = Close,did -c config 84 1,$iif($rconf(Misc,BadWordMethod) = Block,did -c config 84 2,did -c config 84 3)))
    $iif($rconf(Misc,CTCPs) = on,did -c config 101)  
    didtok config 104 42 Engine files*Other updates
    did -c config 104 1
  }
}

; ## Import or add other server to favourite servers list

alias fspop {
  popup New fs 16 16
  popup SetMetrics fs iconpad 1 0 contentpad 0 0 spacing 0 0
  popup AddItem fs end + Add server manually $cr dodialog addserv
  popup AddItem fs end + Import from servers.ini $cr fspop_ms
  pop1 fs $mouse.dx $mouse.dy
}

alias fspop_ms { mserv_wait | dodialog mserv }

; ## Configuration dialog table/events

dialog config {
  title "zIRCk Configuration"
  size -1 -1 259 155
  option dbu
  icon $icl, 2
  list 1, 2 3 74 129, size
  tab "General", 2, -31 -24 292 189
  text "", 3, 84 3 172 28, tab 2
  text "General Settings", 4, 87 5 135 8, tab 2
  text "- configure basic IRC information here such as your           nickname, alternate nickname, and startup options.", 5, 87 14 135 15, tab 2
  list 6, 231 7 21 20, disable tab 2 size
  text "Nickname:", 7, 85 39 34 8, tab 2
  text "Alternate:", 8, 85 52 35 8, tab 2
  text "Full name:", 9, 85 64 35 8, tab 2
  text "E-mail address:", 10, 85 76 43 8, tab 2
  edit "", 11, 161 38 95 10, tab 2 autohs
  edit "", 14, 161 75 95 10, tab 2 autohs
  edit "", 13, 161 63 95 10, tab 2 autohs
  edit "", 12, 161 51 95 10, tab 2 autohs
  box "", 15, 85 88 171 4, tab 2
  check "Show Configuration on startup", 16, 84 96 87 10, tab 2
  check "Check for updates every", 17, 84 106 71 10, tab 2
  check "Show loading bar on startup", 22, 84 116 83 10, tab 2
  button "Edit tips...", 24, 219 119 37 12, tab 2
  edit "", 102, 218 107 20 10, tab 2 center
  text "min(s)", 103, 240 110 16 8, tab 2
  tab "Display", 25
  text "", 26, 84 3 172 28, tab 25
  text "Display Settings", 27, 87 5 135 8, tab 25
  text "- configure how you want zIRCk's overall appearance to   look like.", 28, 87 14 135 15, tab 25
  list 29, 231 7 21 20, disable tab 25 size
  list 30, 83 38 173 61, tab 25 size
  text "Button style:", 31, 85 104 45 8, tab 25
  combo 32, 184 103 72 50, tab 25 size drop
  text "Overall icon package:", 33, 85 118 68 8, tab 25
  combo 34, 184 117 72 50, tab 25 size
  tab "NickLUST", 35
  text "", 39, 84 3 172 28, tab 35
  text "NickLUST Settings", 36, 87 5 135 8, tab 35
  text "- configure how you would like to see your nicklist here.    Custom nicklist powered by nickLUST3.dll.", 37, 87 14 135 15, tab 35
  list 38, 231 7 21 20, disable tab 35 size
  list 40, 83 38 173 60, tab 35 size
  text "Icon path:", 41, 83 103 38 8, tab 35
  edit "", 42, 122 102 117 10, tab 35 autohs
  button "!", 43, 242 101 14 12, disable tab 35
  check "Don't show icons in nicklist", 44, 83 121 109 10, tab 35
  button "Default icons", 45, 219 120 37 12, tab 35
  tab "Switchbar", 46
  text "", 47, 84 3 172 28, tab 46
  text "Switchbar Settings", 48, 87 5 135 8, tab 46
  text "- configure the custom switchbar icons here. You can        also find a few more options in the Display section.", 49, 87 14 135 15, tab 46
  list 50, 231 7 21 20, disable tab 46 size
  list 51, 83 38 173 60, tab 46 size
  text "Icon path:", 52, 83 103 38 8, tab 46
  edit "", 53, 122 102 117 10, tab 46 autohs
  button "!", 54, 242 101 14 12, disable tab 46
  button "Default icons", 55, 219 120 37 12, tab 46
  check "Don't show DCC sends/gets on switchbar", 56, 83 121 111 10, tab 46
  tab "Favourite Servers", 57
  text "", 60, 84 3 172 28, tab 57
  text "Favourite Servers", 58, 87 5 135 8, tab 57
  text "- add your favourite IRC server addresses here, which     appear beside the connect icon and the status popup", 59, 87 14 135 15, tab 57
  list 61, 231 7 21 20, disable tab 57 size
  list 62, 83 38 173 78, tab 57 size
  button "Add", 63, 177 120 37 12, tab 57
  button "Delete", 64, 219 120 37 12, tab 57
  box "", 65, 216 117 1 15, tab 57
  tab "Misc", 66
  text "", 67, 84 3 172 28, tab 66
  text "Miscellaneous Settings", 68, 87 5 135 8, tab 66
  text "- configure other small settings like CTCP replies, query     blocker, function key bindings, and other items", 69, 87 14 135 15, tab 66
  list 70, 231 7 21 20, disable tab 66 size
  text "Settings to edit:", 71, 83 38 53 8, tab 66
  combo 72, 173 36 83 50, tab 66 size drop
  list 73, 83 52 173 64, tab 66 size
  button "Add", 74, 177 120 37 12, tab 66
  button "Delete", 75, 219 120 37 12, tab 66
  box "", 76, 216 117 1 15, tab 66
  text "Double click on key to change bind command", 78, 83 118 88 14, hide disable tab 66
  button "Unset key", 79, 219 120 37 12, hide tab 66
  list 77, 83 52 173 64, hide tab 66 size
  list 80, 83 52 173 53, hide tab 66 size
  text "Word(s)", 81, 83 108 25 8, hide tab 66
  edit "", 82, 111 107 145 10, hide tab 66
  text "Method:", 83, 83 123 27 8, hide tab 66
  combo 84, 111 121 47 50, hide tab 66 size drop
  button "Add", 85, 177 120 37 12, hide tab 66
  button "Delete", 86, 219 120 37 12, hide tab 66
  list 87, 83 52 173 53, hide tab 66 size
  edit "", 88, 116 107 140 10, hide tab 66 autohs
  button "Add", 89, 177 120 37 12, hide tab 66
  button "Delete", 90, 219 120 37 12, hide tab 66
  text "Message:", 91, 83 108 31 8, hide tab 66
  check "", 101, 164 38 8 10, tab 66
  tab "Updates", 92
  text "", 93, 84 3 172 28, tab 92
  text "zIRCk Updates", 94, 87 5 135 8, tab 92
  text "- this is where you update the script so you have the        latest script files for better usage", 95, 87 14 135 15, tab 92
  list 96, 231 7 21 20, disable tab 92 size
  list 97, 83 38 173 78, tab 92 size
  button "Get selected", 98, 219 120 37 12, tab 92
  button "Refresh", 99, 177 120 37 12, tab 92
  box "", 100, 216 117 1 15, tab 92
  combo 104, 83 120 68 50, tab 92 size drop
  box "", 21, 79 1 1 131
  button "Done", 19, 177 140 37 12, ok
  button "Cancel", 18, 219 140 37 12, cancel
  box "", 20, 216 137 1 15
  box "", 23, -13 132 277 4
  list 105, 83 38 173 78, tab 92 hide size
}

on *:dialog:config:init:0: {
  mdx MarkDialog $dname
  mdxbutton config 18,19,24,43,45,54,55,63,64,74,75,79,85,86,89,90,98,99
  mdx SetBorderStyle $dname 1,3,26,39,47,60,67,93 staticedge 
  mdx SetBorderStyle $dname 6,29,38,50,61,70,96
  mdx SetFont $dname 4,7,8,9,10,22,27,31,33,36,40,41,48,52,58,68,71,81,83,91,94 -11 700 Tahoma
  mdx SetFont $dname 78 -10 700 Tahoma
  mdx SetFont $dname 5,11,12,13,14,15,16,17,22,28,30,40,42,43,44,45,49,51,53,54,55,56,59,62,63,64,69,72,73,74,75,77,79,80,82,84,85,86,87,88,89,90,95,97,98,99,101,102,103,104,105 -11 400 Tahoma
  mdx SetColor $dname 3,4,5,6,26,27,28,29,36,37,38,39,47,48,49,50,58,59,60,61,67,68,69,70,93,94,95,96 background $rgb(154,154,154)
  mdx SetColor $dname 4,5,27,28,36,37,48,49,58,59,68,69,94,95 textbg $rgb(154,154,154)
  mdx SetColor $dname 4,27,36,48,58,68,94 text $rgb(255,255,255)
  mdx SetControlMDX $dname 1 Treeview fullrowselect singleexpand nohscroll showsel > $views
  mdx SetControlMDX $dname 6,29,38,50,61,70,96 Toolbar flat wrap nodivider list > $bars
  mdx SetControlMDX $dname 30 Listview report single rowselect checkboxes noheader > $views
  mdx SetControlMDX $dname 62,73 Listview report single rowselect checkboxes > $views
  mdx SetControlMDX $dname 34 ComboBoxEx drop > $views
  mdx SetControlMDX $dname 40,51 Listview icon single noheader > $views
  mdx SetControlMDX $Dname 77,97,105 Listview report single rowselect > $views
  did -i $dname 1 1 setitemheight 26 
  did -a $dname 1 $chr(160) General Settings
  did -a $dname 1 $chr(160) Display Settings
  did -a $dname 1 $chr(160) NickLUST Settings
  did -a $dname 1 $chr(160) Switchbar Settings
  did -a $dname 1 $chr(160) Favourite Servers
  did -a $dname 1 $chr(160) Miscellaneous
  did -a $dname 1 $chr(160) Updates
  did -c $dname 1 2
  did -i $dname 6,29,38,50,61,70,96 1 bmpsize 32 32
  did -i $dname 6 1 setimage icon large 10, $+ $icl
  did -a $dname 6 +a 1 $chr(9) $+ Nothing
  did -i $dname 29 1 setimage icon large 11, $+ $icl
  did -a $dname 29 +a 1 $chr(9) $+ Nothing
  did -i $dname 38 1 setimage icon large 12, $+ $icl
  did -a $dname 38 +a 1 $chr(9) $+ Nothing
  did -i $dname 50 1 setimage icon large 13, $+ $icl
  did -a $dname 50 +a 1 $chr(9) $+ Nothing
  did -i $dname 61 1 setimage icon large 14, $+ $icl
  did -a $dname 61 +a 1 $chr(9) $+ Nothing
  did -i $dname 70 1 setimage icon large 15, $+ $icl
  did -a $dname 70 +a 1 $chr(9) $+ Nothing
  did -i $dname 96 1 setimage icon large 16, $+ $icl
  did -a $dname 96 +a 1 $chr(9) $+ Nothing
  did -i $dname 30 1 headerdims 130 320
  did -a $dname 30 Enable toolbar $chr(9) Use the scripts' custom 32x32 toolbar
  did -a $dname 30 Enable bottom bar $chr(9) Features a custom switchbar, a statusbar, and custom shortcuts
  did -a $dname 30 Enable sidepanel $chr(9) A panel which features a notify list and a DCC send/get list, and can also be docked on the left or right side of zIRCk
  did -a $dname 30 Enable nickLUST $chr(9) Enhances nicklist appearance by adding icons and nickname grouping (by user status)
  did -a $dname 30 Toolbar XP background scheme $chr(9) The toolbar will have a creamy background
  did -a $dname 30 Toolbar XP button scheme $chr(9) The toolbar will have a creamy button scheme
  did -a $dname 30 Toolbar bandwidth monitor $chr(9) $+ The toolbar will show a bandwidth meter in the top right corner
  did -a $dname 30 Use script notify popup $chr(9) $+ Shows small MSN-like popups on certain events
  did -i $dname 30 1 headerdims auto:all auto:all  
  did -i $dname 34 1 iconsize small
  did -i $dname 62 1 headerdims 120 130 85
  did -i $dname 62 1 headertext Network $chr(9) Address $chr(9) Port
  did -i $dname 73 1 headerdims 110 230
  did -i $dname 73 1 headertext CTCP $chr(9) Reply
  did -i $dname 77 1 headerdims 96 240
  did -i $dname 77 1 headertext Key $chr(9) Bind command
  did -i $dname 97,105 1 headerdims 100 75 240
  did -i $dname 97,105 1 headertext Update $chr(9) Filename $chr(9) Updates
  cfg_nicklust
  cfg_switchbar
  filter -k $+(",$scriptdirFavourites.ini,") loadfservs
  cfg_ctcps
  cfg_fkeys
  cfg_badwords
  cfg_quits

  load.config
}

on *:dialog:config:sclick:1: {
  var %c = $branch($dname,1)
  if %c = $chr(160) General Settings { did -f $dname 2 | did -h $dname 3 | did -v $dname 3 }
  elseif %c = $chr(160) Display Settings { did -f $dname 25 | did -h $dname 26 | did -v $dname 26 }
  elseif %c = $chr(160) NickLUST Settings { did -f $dname 35 | did -h $dname 39 | did -v $dname 39 }
  elseif %c = $chr(160) Switchbar Settings { did -f $dname 46 | did -h $dname 47 | did -v $dname 47 }
  elseif %c = $chr(160) Favourite Servers { did -f $dname 57 | did -h $dname 60 | did -v $dname 60 }
  elseif %c = $chr(160) Miscellaneous { did -f $dname 66 | did -h $dname 67 | did -v $dname 67 }
  elseif %c = $chr(160) Updates { did -f $dname 92 | did -h $dname 93 | did -v $dname 93 }
}

on *:dialog:config:sclick:2: { did -c config 1 2 | did -h $dname 3,6 | did -v $dname 3,6 }

on *:dialog:config:sclick:19: {
  $iif($did($dname,11).text,$iif($me != $ifmatch,.nick $did($dname,11).text),.nick zIRCkUser)
  $iif($did($dname,12).text,$iif($anick != $ifmatch,.anick $did($dname,12).text),.anick zIRCkUser2)
  $iif($did($dname,13).text,.fullname $v1,.fullname zIRCk Script user)
  $iif($did($dname,14).text,.emailaddr $v1,.emailaddr zIRCk Script user)
  conf General ConfigStart $iif($did($dname,16).state = 1,on,off)
  conf General CheckUpdates $iif($did($dname,17).state = 1,on,off)
  conf General LoadBar $iif($did($dname,22).state = 1,on,off)
  conf General CUpdateTime $iif($did($dname,102),$v1,25)
  $iif($rconf(General,CheckUpdates) = on && $rconf(General,CUpdateTime),.timerzupdates 0 $calc($rconf(General,CUpdateTime) *60) zfastupdates) 
  $iif($rconf(General,CheckUpdates) = off && $timer(zupdates),.timerzupdates off)
  conf Display Toolbar $iif($cfg_isstate($did($dname,30,2)) = on,on,off)
  conf Display BBar $iif($cfg_isstate($did($dname,30,3)) = on,on,off)
  conf Display SidePane $iif($cfg_isstate($did($dname,30,4)) = on,on,off)
  conf Display NickLust $iif($cfg_isstate($did($dname,30,5)) = on,on,off)
  conf Display XPBkg $iif($cfg_isstate($did($dname,30,6)) = on,on,off)
  conf Display XPBscheme $iif($cfg_isstate($did($dname,30,7)) = on,on,off)
  conf Display BandMeter $iif($cfg_isstate($did($dname,30,8)) = on,on,off)
  conf Display NotifyWin $iif($cfg_isstate($did($dname,30,9)) = on,on,off)

  conf Display ButtonSel $iif($did($dname,32).sel,$v1,6)
  conf Display ButtonStyle $iif($did($dname,32).seltext,$v1,Windowedge)
  conf Display IclSel $iif($did($dname,34).sel,$v1)
  conf NickLust Icons $iif($did($dname,44).state = 1,off,on)
  conf Switchbar ShowDCCs $iif($did($dname,56).state = 1,on,off)

  conf Misc BadWordMethod $iif($did($dname,84).sel = 1,Close,$iif($did($dname,84).sel = 2,Block,Both)))

  cfg_ctcpstates
  ctcp_vcheck
  if ($rconf(Display,Toolbar) = on) {
    $iif($rconf(Display,MiniTb) = on && $rconf(Display,MiniZ) = off && $dialog(bbar),minitb on,$iif($rconf(Display,MiniZ) = on && $rconf(Display,MiniTb) = off,miniz on,dodialog tb))
    hdock -hidetb
  }
  elseif ($rconf(Display,Toolbar) = off) && (dialog(tb)) {
    tb_close
    $iif($dialog(bbar) && $rconf(Display,MiniTb) = on && $rconf(Display,MiniZ) = off,minitb off,$iif($dialog(bbar) && $rconf(Display,MiniZ) = on && $rconf(Display,MiniTb) = off,miniz off))
  }
  tb_refresh
  $iif($rconf(Display,Sidepane) = on,sidepane,sidepane_close)
  $iif($rconf(Display,NickLust) = off,dll -u nicklust3.dll)
  $iif($rconf(Display,BBar) = on && !$dialog(bbar),dodialog bbar,$iif($rconf(Display,BBar) = off && $dialog(bbar),bbar_close))
  $iif($rconf(Display,BBar) = off && $timer(sbdata),.timersbdata off)
}

on *:dialog:config:sclick:24: { run notepad $_doc(Tips) }

on *:dialog:config:sclick:25: { did -c config 1 3 | did -h $dname 26,29 | did -v $dname 26,29 }

on *:dialog:config:sclick:35: { did -c $dname 1 4 | did -h $dname 38,39 | did -v $dname 38,39 } 

on *:dialog:config:sclick:40: {
  var %s = $did($dname,40).sel
  if %s = 2 { did -ra $dname 42 $rconf(NickLust,Normal) | did -e $dname 43 }
  elseif %s = 3 { did -ra $dname 42 $rconf(NickLust,Voice) | did -e $dname 43  }
  elseif %s = 4 { did -ra $dname 42 $rconf(NickLust,Channel) | did -e $dname 43  }
  elseif %s = 5 { did -ra $dname 42 $rconf(NickLust,Half) | did -e $dname 43  }
  elseif %s = 6 { did -ra $dname 42 $rconf(NickLust,User) | did -e $dname 43  }
  elseif %s = 7 { did -ra $dname 42 $rconf(NickLust,Super) | did -e $dname 43  }
  elseif %s = 8 { did -ra $dname 42 $rconf(NickLust,Owner) | did -e $dname 43  }
  elseif !%s { did -r $dname 42 | did -b $dname 43 }
}

on *:dialog:config:sclick:43: {
  var %s = $did($dname,40).sel
  set %target $iif(%s = 2,Normal,$iif(%s = 3,Voice,$iif(%s = 4,Channel,$iif(%s = 5,Half,User))))
  var %sm_icon = $shortfn($sfile($iif(%smicodir,$ifmatch,C:\),Select icon to use,Select))
  if (.ico isin %sm_icon) && (%sm_icon) {
    set %smicodir $shortfn($nofile(%sm_icon))
    conf NickLust %target %sm_icon
    unset %target
    cfg_nicklust
    dialog -v config
  }
  elseif (.icl isin %sm_icon || .dll isin %sm_icon || .exe isin %sm_icon) { set %icl_ %sm_icon | set %icl_target nicklust | dodialog icon } 
}

on *:dialog:config:sclick:44: { if ($did($dname,44).state = 1) { var %x = $input(In order to show or hide the icons in the nicklists $+ $chr(44) you must /hop all of the channels you are on for the icons to show/hide,oi,nickLUST Settings) } }

on *:dialog:config:sclick:45: { def_nicklust }

on *:dialog:config:sclick:46: { did -c $dname 1 5 | did -h $dname 47,50 | did -v $dname 47,50 }

on *:dialog:config:sclick:51: {
  var %s = $did($dname,51).sel
  if %s = 2 { did -ra $dname 53 $rconf(Switchbar,Status) | did -e $dname 54 }
  elseif %s = 3 { did -ra $dname 53 $rconf(Switchbar,Channel) | did -e $dname 54 }
  elseif %s = 4 { did -ra $dname 53 $rconf(Switchbar,Query) | did -e $dname 54 }
  elseif %s = 5 { did -ra $dname 53 $rconf(Switchbar,Custom) | did -e $dname 54 }
  elseif %s = 6 { did -ra $dname 53 $rconf(Switchbar,DCCChat) | did -e $dname 54 }
  elseif %s = 7 { did -ra $dname 53 $rconf(Switchbar,DCCSend) | did -e $dname 54 }
  elseif %s = 8 { did -ra $dname 53 $rconf(Switchbar,DCCGet) | did -e $dname 54 }
  elseif !%s { did -r $dname 53 | did -b $dname 54 }
}

on *:dialog:config:sclick:54: {
  var %s = $did($dname,51).sel
  set %target $iif(%s = 2,Status,$iif(%s = 3,Channel,$iif(%s = 4,Query,$iif(%s = 5,Custom,$iif(%s = 6,DCCChat,$iif(%s = 7,DCCSend,DCCGet))))))
  var %sm_icon = $shortfn($sfile($iif(%smicodir,$ifmatch,C:\),Select icon to use,Select))
  if (.ico isin %sm_icon) && (%sm_icon) {
    set %smicodir $shortfn($nofile(%sm_icon))
    conf Switchbar %target %sm_icon
    unset %target
    cfg_switchbar
    bbar_refresh
    dialog -v config
  }
  elseif (.icl isin %sm_icon || .dll isin %sm_icon || .exe isin %sm_icon) { set %icl_ %sm_icon | set %icl_target switchbar | dodialog icon } 
}

on *:dialog:config:sclick:55: { def_switchbar }

on *:dialog:config:sclick:57: { did -c $dname 1 6 | did -h $dname 60,61 | did -v $dname 60,61 }

on *:dialog:config:sclick:62: {
  did -i config 62 1 page event
  if ($gettok($did(config,62,1),1,32) = stateclick) {
    var %l = $gettok($did(config,62,1),3,32),%n = $cell(config,62,%l,1),%s = $cell(config,62,%l,2),%p = $cell(config,62,%l,3)
    writeini $+(",$scriptdirFavourites.ini,") %n %s * $+ %p $+ * $+ $iif($gettok($did(config,62,%l),5,32) = 1,2,1)
  }
}

on *:dialog:config:sclick:63: { fspop }

on *:dialog:config:sclick:64: {
  if ($did($dname,62).sel) {
    var %l = $v1
    var %n = $cell(config,62,%l,1),%s = $cell(config,62,%l,2)
    if $ini($+(",$scriptdirFavourites.ini,"),%n,0) < 1) { 
      remini $+(",$scriptdirFavourites.ini,") %n
    }
    else {
      remini $+(",$scriptdirFavourites.ini,") %n %s
    }
    did -r config 62
    filter -k $+(",$scriptdirFavourites.ini,") loadfservs
  }
}

on *:dialog:config:sclick:66: { did -c $dname 1 7 | did -h $dname 67,70 | did -v $dname 67,70 }

on *:dialog:config:sclick:72: {
  var %s = $did($dname,72).sel
  if %s = 1 {
    did -u config 101
    $iif($rconf(Misc,CTCPs) = on,did -c config 101)
    did -h config 77,78,79,80,81,82,83,84,85,86,87,88,89,90,91
    did -v config 73,74,75,76
  }
  elseif %s = 2 {
    did -u config 101
    $iif($rconf(Misc,Fkeys) = on,did -c config 101)
    did -h config 73,74,75,76,80,81,82,83,84,85,86,87,88,89,90,91
    did -v config 77,78,79
  }
  elseif %s = 3 {
    did -u config 101
    $iif($rconf(Misc,MsgBlock) = on,did -c config 101)
    did -h config 73,74,75,77,78,79,87,88,89,90,91
    did -v config 76,80,81,82,83,84,85,86
  }
  elseif %s = 4 {
    did -u config 101
    $iif($rconf(Misc,Quits) = on,did -c config 101)
    did -h config 73,74,75,77,78,79,80,81,82,83,84,85,86
    did -v config 76,87,88,89,90,91
  }
}

on *:dialog:config:sclick:74: {
  var %c = $$?="Enter CTCP:",%d = $$?="Enter reply:"
  if (%c) && (%d) {
    write $_doc(CTCPs) $+(2,*,%c,*,%d)
    cfg_ctcps
  }
}

on *:dialog:config:sclick:75: {
  if ($did(config,73).sel) {
    var %s = $calc($v1 -1)
    write -dl $+ %s $_doc(CTCPs)
    cfg_ctcps
  }
}

on *:dialog:config:dclick:77: {
  if ($gettok($did($dname,77).seltext,6,32) = F1) || ($gettok($did($dname,77).seltext,6,32) = F2) {
    var %x = $input(zIRCk maintains this key for script purposes. Select another key.,oi,Function Key Bindings)
  }
  else { 
    var %c = $gettok($did($dname,77).seltext,6,32),%a = $$?="Enter command for $gettok($did(config,77).seltext,6,32) $+ :"
    $iif(%c && %a,.write -s $+ %c $_doc(Fkeys) %c * %a )
    cfg_fkeys
  }
}

on *:dialog:config:sclick:79: {
  var %c = $gettok($did($dname,77).seltext,6,32)
  if (%c = F1 || %c = F2) {
    var %x = $input(zIRCk maintains this key for script purposes. Select another key.,oi,Function Key Bindings)
  }
  else {
    .write -s $+ %c $_doc(Fkeys) %c * 
    cfg_fkeys
  }
}

on *:dialog:config:sclick:85: {
  if ($did($dname,82).text) {
    write $_doc(Badwords) $v1
    cfg_badwords
  }
}

on *:dialog:config:sclick:86: {
  if ($did($dname,80).sel) {
    write -dl $+ $v1 $_doc(Badwords)
    cfg_badwords
  }
}

on *:dialog:config:sclick:89: {
  if ($did($dname,88).text) {
    write $_doc(Quits) $v1
    cfg_quits
  }
}

on *:dialog:config:sclick:90: {
  if ($did($dname,87).sel) {
    write -dl $+ $v1 $_doc(Quits)
    cfg_quits
  }
}

on *:dialog:config:sclick:92: { did -c config 1 8 | did -h config 93,96 | did -v config 93,96 }

on *:dialog:config:sclick:98: {
  if ($did($dname,97).sel) {
    set %updatefile $cell(config,97,$v1,2)
    download -o z $+(http://www.coderscore.org/afx/zIRCk/,%updatefile) $+(",$scriptdir,")
    did -b config 97,98
  }
}

on *:dialog:config:sclick:99: { 
  if ($did($dname,104).sel = 1) {
    zupdates 
    did -b config 97,98 
  }
  else {
    zupdates_o
    did -b config 98,105
  }
}

on *:dialog:config:sclick:101: {
  var %s = $did(config,72).sel
  if (%s = 1) {
    conf Misc CTCPs $iif($did(config,101).state = 1,on,off)
  }
  elseif (%s = 2) {
    conf Misc Fkeys $iif($did(config,101).state = 1,on,off)
  }
  elseif (%s = 3) {
    conf Misc MsgBlock $iif($did(config,101).state = 1,on,off)
  }
  elseif (%s = 4) {
    conf Misc Quits $iif($did(config,101).state = 1,on,off)
  }
}

on *:dialog:config:sclick:104: {
  if ($did($dname,104).sel = 1) { did -h $dname 105 | did -v $dname 97 }
  else { did -h $dname 97 | did -v $dname 105 }
}

; ## Select icon dialog/dialog events

dialog icon {
  title "Select Icon..."
  size -1 -1 171 111
  option dbu
  icon $icl, 12
  list 1, 2 3 167 94, size
  edit "", 2, 2 99 151 10, read autohs
  button "!", 3, 155 99 14 10
}

on *:dialog:icon:init:0: {
  mdx MarkDialog $dname
  mdx SetControlMDX $dname 1 Listview large icon single showsel > $views
  mdx SetFont $dname 1,2,3 -11 400 Tahoma
  var %p = %icl_,%i = 0,%x = $counticons(%icl_)
  did -ra icon 2 Total Icons: $remove(%x,$chr(32),$true) - File: $nopath(%p)
  if (%x == 0) { .did -ra icon 2 Invalid Icon File: $nopath(%p) | return }
  did -r icon 1 
  did -i icon 1 1 clearicons normal
  var %~32 = $+(%x,$chr(171),$nopath(%p))
  while (%i <= %x) {
    .did -i icon 1 1 seticon normal 0 $+(%i,$chr(44),%p)
    if (%i != 0) { .did -a icon 1 0 + %i 0 0 $calc(%i -1) }
    inc %i
  }
}

on *:dialog:icon:sclick:1: { set %icl_sel $calc($did($dname,1).sel -2) }

on *:dialog:icon:sclick:3: {
  set %icl_icon %icl_sel $+ , $+ %icl_
  if (%icl_target = nicklust) {
    conf NickLust %target %icl_icon
    cfg_nicklust
    dialog -v config
  }
  elseif (%icl_target = switchbar) {
    conf Switchbar %target %icl_icon
    cfg_switchbar
    bbar_refresh
    dialog -v config
  }
  unset %icl_*
  unset %target
  dialog -x $dname
}

; ## Import server to Favourites list dialog table/events

dialog mserv {
  title "mIRC Servers.ini Import"
  size -1 -1 170 135
  option dbu
  icon $icl, 14
  text "Show network:", 1, 3 7 42 8
  combo 2, 76 5 92 50, size drop
  list 3, 2 22 166 95, size
  button "Add server", 4, 89 121 37 12
  button "Cancel", 5, 131 121 37 12, cancel
  box "", 6, 128 118 1 15
  text "", 7, 2 122 61 8
}

on *:dialog:mserv:init:0: {
  mdx MarkDialog mserv
  mdx SetFont mserv 1 -11 700 Tahoma
  mdx SetFont mserv 2,3,4,5,7 -11 400 Tahoma
  mdx SetControlMDX mserv 3 Listview report single rowselect > $views
  did -a mserv 2 All
  servers -g
  did -i mserv 3 1 headerdims 110 130 85
  did -i mserv 3 1 headertext Network $chr(9) Address $chr(9) Port
  dialog -x mservw
}

on *:dialog:mserv:sclick:2: {
  did -r mserv 3
  if ($did($dname,2).seltext = all) { servers -a }
  else { servers -s $v1 } 
}

on *:dialog:mserv:sclick:4: {
  if ($did($dname,3).sel) {
    var %n = $gettok($did($dname,3).seltext,6,32),%s = $gettok($did($dname,3).seltext,11,32),%p = $gettok($did($dname,3).seltext,16,32) 
    writeini $+(",$scriptdirFavourites.ini,") %n %s $+(*,%p,*,2)
    if ($dialog(config)) {
      did -r config 62
      filter -k $+(",$scriptdirFavourites.ini,") loadfservs
    }
  }
}

; ## Wait dialog for servers.ini dialog

dialog mservw {
  title ""
  size -1 -1 94 9
  option dbu
  text "Listing networks...please wait", 1, 2 6 91 16, center
}

on *:dialog:mservw:init:0: {
  mdx MarkDialog $dname
  mdx SetDialog $dname style dlgmodal
  mdx SetFont $dname 1 -11 700 Tahoma
}

; ## Add other server to favourites list

dialog addserv {
  title "Add server..."
  size -1 -1 151 103
  option dbu
  icon $icl, 14
  box "Add other server to list", 1, 3 5 117 4
  text "Network:", 2, 8 18 28 8
  text "Server address:", 3, 8 30 48 8
  text "Port(s):", 4, 8 43 25 8
  edit "", 5, 58 16 84 10, autohs
  edit "", 6, 58 29 84 10, autohs
  edit "", 7, 58 42 84 10, autohs
  check "Show in favourite servers popup on toolbar", 8, 3 64 116 10
  button "Cancel", 9, 112 88 37 12, cancel
  button "Add", 10, 72 88 37 12
}

on *:dialog:addserv:init:0: {
  mdx MarkDialog $dname
  mdxbutton addserv 9,10
  mdx SetFont addserv 1,2,3,4 -11 700 Tahoma
  mdx SetFont addserv 5,6,7,8,9,10 -11 400 Tahoma
}

on *:dialog:addserv:sclick:10: {
  if ($did($dname,5) && $did($dname,6) && $did($dname,7)) {
    var %n = $did($dname,5),%s = $did($dname,6),%p = $did($dname,7),%o = $iif($did($dname,8).state = 1,2,1)
    writeini $+(",$scriptdirFavourites.ini,") %n %s $+(*,%p,*,%o)
    dialog -x addserv
    if ($dialog(config)) {
      did -r config 62
      filter -k $+(",$scriptdirFavourites.ini,") loadfservs
    }
  }
}