XDCC Autoresume/Autoqueue Stealth Script — File Browser

XDCCAutoresumeAutoqueueStealthScriptv4.2.0 / XDCCAutoresumeAutoqueueStealthScriptv4.2.0 / XDCCStealthDialogs.mrc

XDCCStealthDialogs.mrc — 122.7 KB — Download this file

;-------------------------------------------------------------------------
;
; Name: XDCC Autoresume/Autoqueue Stealth Script
; File: XDCCStealthDialogs.mrc
; Version: 4.1.5
; Author: Werecow
; Date: 23-02-2005
;
; Contents: The dialog listeners, constructors and aliases, and window event listeners.
;
;
; WARNING: many channels will ban you for using XDCC leech scripts. While this is a silly rule,
; it is your responsibility. Use this wisely. Don't use it in such channels, or don't get caught.
; And play nice for the other people that want to use the XDCCs! If you leech em dry other people 
; may be unable to get on.
;
;-------------------------------------------------------------------------








;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;----------------------------Dialog Section------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------









;-------------------------------------------------------------------------
; /xdccpreferencesdialog:
; Initiates the preferences menu dialog and sets the appropriate values.
;-------------------------------------------------------------------------
alias xdccpreferencesdialog {
  set %newxdccdir $null
  dialog -m xdccpreferencesdialog xdccpreferencesdialog
  /did -a xdccpreferencesdialog 132 bandwidth is available
  /did -a xdccpreferencesdialog 132 download slots are open
  /did -a xdccpreferencesdialog 220 available bandwidth
  /did -a xdccpreferencesdialog 220 open download slots
  /did -a xdccpreferencesdialog 130 $sendlimit 
  /did -a xdccpreferencesdialog 206 $sendlimit 
  /did -a xdccpreferencesdialog 201 $minbandwidth
  /did -a xdccpreferencesdialog 202 $maxbandwidth
  /did -a xdccpreferencesdialog 203 $mintransfers
  /did -a xdccpreferencesdialog 204 $maxtransfers
  /did -a xdccpreferencesdialog 205 $connectionbandwidth


  /did -a xdccpreferencesdialog 501 $nopath($triggerHash)
  /did -a xdccpreferencesdialog 502 $nopath($triggerbackup)
  /did -a xdccpreferencesdialog 503 $nopath($xdccsinprogress)
  /did -a xdccpreferencesdialog 504 $nopath($autoresumedisablefile)
  /did -a xdccpreferencesdialog 505 $nopath($autoresumesenddisablefile)
  /did -a xdccpreferencesdialog 506 $nopath($tempbotqueuefile)
  /did -a xdccpreferencesdialog 507 $nopath($xdccsessiongetfile)
  /did -a xdccpreferencesdialog 508 $nopath($xdccsessionsendfile)
  /did -a xdccpreferencesdialog 509 $nopath($networksendfile)
  /did -a xdccpreferencesdialog 510 $nopath($xdccqueueposfile)
  /did -a xdccpreferencesdialog 511 $nopath($chankeyfile)
  /did -a xdccpreferencesdialog 512 $nopath($dccallownetworkfile)
  /did -a xdccpreferencesdialog 513 $nopath($xdccdebugfile)
  /did -a xdccpreferencesdialog 514 %statsfile
  /did -a xdccpreferencesdialog 515 $nopath($xdccwishlist)
  /did -a xdccpreferencesdialog 516 $nopath($alternatedccserverfile )
  /did -a xdccpreferencesdialog 517 $nopath($botqueuefile)

  /did -a xdccpreferencesdialog 551 Current XDCC dir: $xdccdir

  if ($exists($chankeyfile) && $lines($chankeyfile) > 0) {
    var %i = 1
    while (%i <= $lines($chankeyfile)) {
      /did -a xdccpreferencesdialog 610 $gettok($read($chankeyfile,%i),1-2,32)
      inc %i
    }
  }
  if ($exists($dccallownetworkfile) && $lines($dccallownetworkfile) > 0) {
    var %i = 1
    while (%i <= $lines($dccallownetworkfile)) {
      /did -a xdccpreferencesdialog 611 $read($dccallownetworkfile,%i)
      inc %i
    }
  }
  if ($exists($alternatedccserverfile) && $lines($alternatedccserverfile) > 0) {
    var %i = 1
    while (%i <= $lines($alternatedccserverfile)) {
      /did -a xdccpreferencesdialog 612 $read($alternatedccserverfile,%i)
      inc %i
    }
  }
  if ($exists($xdccwishlist) && $lines($xdccwishlist) > 0) {
    var %i = 1
    while (%i <= $lines($xdccwishlist)) {
      /did -a xdccpreferencesdialog 613 $read($xdccwishlist,%i)
      inc %i
    }
  }

  if ($showbotlist == ON) { /did -c xdccpreferencesdialog 307 }
  if ($colorbotlist == on) { /did -c xdccpreferencesdialog 308 }
  if ($infochoise == special window) { /did -c xdccpreferencesdialog 303 }
  elseif ($infochoise == server status window) { /did -c xdccpreferencesdialog 304 }
  elseif ($infochoise == active window) { /did -c xdccpreferencesdialog 305 }
  elseif ($infochoise == both active and special windows) { /did -c xdccpreferencesdialog 306 }
  /did -a xdccpreferencesdialog 301 $xdccfont
  /did -a xdccpreferencesdialog 310 Current Font Used (use prefix -b for bold) $+ $chr(58) $xdccfont
  if ($group(#groupctrlkeys) == on) { /did -c xdccpreferencesdialog 309 }

  /did -a xdccpreferencesdialog 401 $minresumedelay 
  /did -a xdccpreferencesdialog 402 $maxresumedelay 
  /did -a xdccpreferencesdialog 403 $resumedelay
  /did -a xdccpreferencesdialog 405 $sendresumetime
  /did -a xdccpreferencesdialog 407 $sendresumedelay
  /did -a xdccpreferencesdialog 409 $minautoqdelay 
  /did -a xdccpreferencesdialog 410 $maxautoqdelay 
  /did -a xdccpreferencesdialog 411 $minqfulldelay
  /did -a xdccpreferencesdialog 412 $maxqfulldelay
  /did -a xdccpreferencesdialog 413 $minnoconnect
  /did -a xdccpreferencesdialog 414 $maxnoconnect
  /did -a xdccpreferencesdialog 415 $startresumeoffset
  /did -a xdccpreferencesdialog 417 $statisticstime
  /did -a xdccpreferencesdialog 419 $packchangechecktime
  /did -a xdccpreferencesdialog 421 $liblimitdate

  if ($botqueuemode == bandwidth) { 
    /did -c xdccpreferencesdialog 132 1 
    /did -c xdccpreferencesdialog 220 1 
    /did -m xdccpreferencesdialog 203 
    /did -m xdccpreferencesdialog 204 
  }
  else { 
    /did -c xdccpreferencesdialog 132 2 
    /did -c xdccpreferencesdialog 220 2
    /did -m xdccpreferencesdialog 201 
    /did -m xdccpreferencesdialog 202 
  }
  if ($sendlimit == Unlimited) { 
    /did -m xdccpreferencesdialog 130
    /did -m xdccpreferencesdialog 206
  }
  else { 
    /did -c xdccpreferencesdialog 131
    /did -c xdccpreferencesdialog 235
  }
  if ($group(#groupautoxdccresume) == on) { /did -c xdccpreferencesdialog 102 }
  if ($group(#groupautosendresume) == on) { 
    /did -c xdccpreferencesdialog 103 
    /did -c xdccpreferencesdialog 211
  }
  else { 
    /did -m xdccpreferencesdialog 206
    /did -m xdccpreferencesdialog 130 
    /did -b xdccpreferencesdialog 131 
    /did -b xdccpreferencesdialog 235
  }
  if ($multisourcehandling == on) { /did -c xdccpreferencesdialog 121 }
  if ($group(#groupautoxdccresumejoin) == on) { /did -c xdccpreferencesdialog 104 }
  if ($xdccpreemptivejoin == on) { /did -c xdccpreferencesdialog 118 }
  if ($connectnetsatstart == on) { 
    /did -c xdccpreferencesdialog 119 
    /did -c xdccpreferencesdialog 740
  }
  if ($connectxdccnetsatstart == on) { 
    /did -c xdccpreferencesdialog 120 
    /did -c xdccpreferencesdialog 741
  }
  if ($group(#groupautoxdccq) == on) { /did -c xdccpreferencesdialog 105 }
  if ($botqueuehandling == on) { /did -c xdccpreferencesdialog 106 }
  if ($testnumoftransferspeed == on) { 
    /did -c xdccpreferencesdialog 210
    /did -c xdccpreferencesdialog 107 
  }
  else { 
    /did -b xdccpreferencesdialog 132 
    /did -b xdccpreferencesdialog 220
    /did -m xdccpreferencesdialog 201 
    /did -m xdccpreferencesdialog 202 
    /did -m xdccpreferencesdialog 203
    /did -m xdccpreferencesdialog 204
  }
  if ($group(#groupautoresumestart) == on) { /did -c xdccpreferencesdialog 108 }
  if ($group(#groupnonewconnects) == on) { /did -c xdccpreferencesdialog 109 }
  if ($group(#groupautoxdccresume) == on) { /did -c xdccpreferencesdialog 110 }
  if ($group(#groupautoremove) == on) { /did -c xdccpreferencesdialog 111 }
  if ($group(#groupautoxdccresume) == on) { /did -c xdccpreferencesdialog 112 }
  if ($group(#groupnickchangedetect) == on) { /did -c xdccpreferencesdialog 117 }
  if ($group(#grouppackchangedetect) == on) { /did -c xdccpreferencesdialog 113 }
  if ($group(#grouptrackqueuepos) == on) { /did -c xdccpreferencesdialog 114 }
  if ($group(#groupdccpendingerror) == on) { /did -c xdccpreferencesdialog 122 }
  if ($autocleanatstart == on) { /did -c xdccpreferencesdialog 115 }
  if ($debugxdccinfo == on) { /did -c xdccpreferencesdialog 116 }

  var %i = 1
  while (%i <= $networksTable.items) {
    /did -a xdccpreferencesdialog 710 $networksTable.item(%i)
    inc %i
  }
  var %i = 1
  while (%i <= $lines($autoconnectfile)) {
    /did -a xdccpreferencesdialog 711 $read($autoconnectfile,nt,%i)
    inc %i
  }

  if ($xdccautoextraction == on) { /did -c xdccpreferencesdialog 801 }
  /did -a xdccpreferencesdialog 820 $xdccextractpath
  /did -a xdccpreferencesdialog 821 $winrarexe
  /did -a xdccpreferencesdialog 822 $unrarflags


  if ($xdccautomove == on) { /did -c xdccpreferencesdialog 840 }
  /did -b xdccpreferencesdialog 852
  /did -b xdccpreferencesdialog 854
  /loadprefmvdirlist 
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------

;-------------------------------------------------------------------------
; /loadprefmvdirlist: 
; Reloads the auto file movement combo.
;-------------------------------------------------------------------------
alias loadprefmvdirlist {
  /did -r xdccpreferencesdialog 850
  if ($exists($xdccautomovepathfile)) {
    var %i = 1
    var %llen = $lines($xdccautomovepathfile)
    while (%i <= %llen) {
      /did -a xdccpreferencesdialog 850 $gettok($read($xdccautomovepathfile,nt,%i),1,32)
      inc %i
    }
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------


;-------------------------------------------------------------------------
; /applyallsettings:
; Sets all variables, filenames and groups to the values you entered in 
; the menu. If the botlist setting has changed, the @XDCC_Info window is
; closed and reopened to initiate the botlist. If the XDCCdir has changed, 
; the contents of the old dir are moved to the new one.
;-------------------------------------------------------------------------
alias applyallxdccsettings {
  if ($exists($xdcctriggerfile) && $xdcctriggerfile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 501).text)) { .rename $xdcctriggerfile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 501).text)) }
  set %xdcctriggerfile $did(xdccpreferencesdialog, 501).text
  if ($exists($triggerbackup) && $triggerbackup != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 502).text)) { .rename $triggerbackup $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 502).text)) }
  set %triggerbackup $did(xdccpreferencesdialog, 502).text
  if ($exists($xdccsinprogress) && $xdccsinprogress != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 503).text)) { .rename $xdccsinprogress $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 503).text)) }
  set %xdccsinprogress $did(xdccpreferencesdialog, 503).text
  if ($exists($autoresumedisablefile) && $autoresumedisablefile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 504).text)) { .rename $autoresumedisablefile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 504).text)) }
  set %autoresumedisablefile $did(xdccpreferencesdialog, 504).text
  if ($exists($autoresumesenddisablefile) && $autoresumesenddisablefile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 505).text)) { .rename $autoresumesenddisablefile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 505).text)) }
  set %autoresumesenddisablefile $did(xdccpreferencesdialog, 505).text
  if ($exists($botqueuefile) && $botqueuefile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 517).text)) { .rename $botqueuefile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 517).text)) }
  set %botqueuefile $did(xdccpreferencesdialog, 517).text
  if ($exists($tempbotqueuefile) && $tempbotqueuefile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 506).text)) { .rename $tempbotqueuefile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 506).text)) }
  set %tempbotqueuefile $did(xdccpreferencesdialog, 506).text
  if ($exists($xdccsessiongetfile) && $xdccsessiongetfile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 507).text)) { .rename $xdccsessiongetfile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 507).text)) }
  set %xdccsessiongetfile $did(xdccpreferencesdialog, 507).text
  if ($exists($xdccsessionsendfile) && $xdccsessionsendfile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 508).text)) { .rename $xdccsessionsendfile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 508).text)) }
  set %xdccsessionsendfile $did(xdccpreferencesdialog, 508).text
  if ($exists($networksendfile) && $networksendfile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 509).text)) { .rename $networksendfile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 509).text)) }
  set %networksendfile $did(xdccpreferencesdialog, 509).text
  if ($exists($xdccqueueposfile) && $xdccqueueposfile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 510).text)) { .rename $xdccqueueposfile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 510).text)) }
  set %xdccqueueposfile $did(xdccpreferencesdialog, 510).text
  if ($exists($chankeyfile) && $chankeyfile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 511).text)) { .rename $chankeyfile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 511).text)) }
  set %chankeyfile $did(xdccpreferencesdialog, 511).text
  if ($exists($dccallownetworkfile) && $dccallownetworkfile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 512).text)) { .rename $dccallownetworkfile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 512).text)) }
  set %dccallownetworkfile $did(xdccpreferencesdialog, 512).text
  if ($exists($alternatedccserverfile) && $alternatedccserverfile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 516).text)) { .rename $alternatedccserverfile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 516).text)) }
  set %alternatedccserverfile $did(xdccpreferencesdialog, 516).text
  if ($exists($xdccwishlist) && $xdccwishlist != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 515).text)) { .rename $xdccwishlist $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 515).text)) }
  set %xdccwishlist $did(xdccpreferencesdialog, 515).text
  if ($exists($statsfile) && $statsfile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 514).text)) { .rename $statsfile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 514).text)) }
  set %statsfile $did(xdccpreferencesdialog, 514).text
  if ($exists($xdccdebugfile) && $xdccdebugfile != $xdccdir $+ \ + $replxdccfile($did(xdccpreferencesdialog, 513).text)) { .rename $xdccdebugfile $preventdoubleslash($xdccdir $+ \ $+ $replxdccfile($did(xdccpreferencesdialog, 513).text)) }
  set %xdccdebugfile $did(xdccpreferencesdialog, 513).text

  if ($did(xdccpreferencesdialog, 403).text isnum && $did(xdccpreferencesdialog, 403).text >= 0) { set %resumedelay $did(xdccpreferencesdialog, 403).text }
  if ($did(xdccpreferencesdialog, 407).text isnum && $did(xdccpreferencesdialog, 407).text >= 0) { set %sendresumedelay $did(xdccpreferencesdialog, 407).text }
  if ($did(xdccpreferencesdialog, 401).text isnum && $did(xdccpreferencesdialog, 401).text >= 0) { set %minresumedelay $did(xdccpreferencesdialog, 401).text }
  if ($did(xdccpreferencesdialog, 402).text isnum && $did(xdccpreferencesdialog, 402).text >= 0) { set %maxresumedelay $did(xdccpreferencesdialog, 402).text }
  if ($did(xdccpreferencesdialog, 409).text isnum && $did(xdccpreferencesdialog, 409).text >= 0) { set %minautoqdelay $did(xdccpreferencesdialog, 409).text }
  if ($did(xdccpreferencesdialog, 410).text isnum && $did(xdccpreferencesdialog, 410).text >= 0) { set %maxautoqdelay $did(xdccpreferencesdialog, 410).text }
  if ($did(xdccpreferencesdialog, 411).text isnum && $did(xdccpreferencesdialog, 411).text >= 0) { set %minqfulldelay $did(xdccpreferencesdialog, 411).text }
  if ($did(xdccpreferencesdialog, 412).text isnum && $did(xdccpreferencesdialog, 412).text >= 0) { set %maxqfulldelay $did(xdccpreferencesdialog, 412).text }
  if ($did(xdccpreferencesdialog, 413).text isnum && $did(xdccpreferencesdialog, 413).text >= 0) { set %minnoconnect $did(xdccpreferencesdialog, 413).text }
  if ($did(xdccpreferencesdialog, 414).text isnum && $did(xdccpreferencesdialog, 414).text >= 0) { set %maxnoconnect $did(xdccpreferencesdialog, 414).text }
  if ($did(xdccpreferencesdialog, 415).text isnum && $did(xdccpreferencesdialog, 415).text >= 0) { set %startresumeoffset $did(xdccpreferencesdialog, 415).text }
  if ($did(xdccpreferencesdialog, 405).text isnum && $did(xdccpreferencesdialog, 405).text >= 0) { set %sendresumetime $did(xdccpreferencesdialog, 405).text }
  if ($did(xdccpreferencesdialog, 417).text isnum && $did(xdccpreferencesdialog, 417).text >= 0) { set %statisticstime $did(xdccpreferencesdialog, 417).text } 
  if ($did(xdccpreferencesdialog, 419).text isnum && $did(xdccpreferencesdialog, 419).text >= 0) { set %packchangechecktime $did(xdccpreferencesdialog, 419).text }
  if ($did(xdccpreferencesdialog, 421).text isnum && $did(xdccpreferencesdialog, 421).text >= 0) { set %liblimitdate $did(xdccpreferencesdialog, 421).text }

  if ($did(xdccpreferencesdialog, 131).state == 1) { set %sendlimit $did(xdccpreferencesdialog, 130).text }
  else { set %sendlimit Unlimited }

  set %maxtransfers $did(xdccpreferencesdialog, 203).text
  set %mintransfers $did(xdccpreferencesdialog, 204).text
  set %connectionbandwidth $did(xdccpreferencesdialog, 205).text
  set %maxbandwidth $did(xdccpreferencesdialog, 202).text
  set %minbandwidth $did(xdccpreferencesdialog, 201).text
  if ($did(xdccpreferencesdialog, 132).sel == 1) { set %botqueuemode bandwidth }
  else { set %botqueuemode number of transfers }

  if ($did(xdccpreferencesdialog, 303).state == 1) { set %infochoise special window }
  elseif ($did(xdccpreferencesdialog, 304).state == 1) { set %infochoise server status window }
  elseif ($did(xdccpreferencesdialog, 305).state == 1) { set %infochoise active window }
  else { set %infochoise both active and special windows }

  if ($did(xdccpreferencesdialog, 307).state == 1) { set %showbotlist on }
  else { set %showbotlist off }
  if ($did(xdccpreferencesdialog, 308).state == 1) { set %colorbotlist on }
  else { set %colorbotlist off }
  if ($did(xdccpreferencesdialog, 309).state == 1) { .enable #groupctrlkeys }
  else { .disable #groupctrlkeys }


  if ($did(xdccpreferencesdialog, 106).state == 1) { set %botqueuehandling on }
  else { set %botqueuehandling off }
  if ($did(xdccpreferencesdialog, 121).state == 1) { set %multisourcehandling on }
  else { set %multisourcehandling off }
  if ($did(xdccpreferencesdialog, 107).state == 1) { set %testnumoftransferspeed on }
  else { set %testnumoftransferspeed off }
  if ($did(xdccpreferencesdialog, 115).state == 1) { set %autocleanatstart on }
  else { set %autocleanatstart off }
  if ($did(xdccpreferencesdialog, 112).state == 1) { set %clearallqueuesoncomplete on }
  else { set %clearallqueuesoncomplete off }
  if ($did(xdccpreferencesdialog, 118).state == 1) { set %preemptivejoin on }
  else { set %preemptivejoin off }
  if ($did(xdccpreferencesdialog, 119).state == 1) { set %connectnetsatstart on }
  else { set %connectnetsatstart off }
  if ($did(xdccpreferencesdialog, 120).state == 1) { set %connectxdccnetsatstart on }
  else { set %connectxdccnetsatstart off }
  if ($did(xdccpreferencesdialog, 112).state == 1) { set %debugxdccinfo on }
  else { set %debugxdccinfo off }
  if ($did(xdccpreferencesdialog, 102).state == 1) { .enable #groupautoxdccresume }
  else { .disable #groupautoxdccresume }
  if ($did(xdccpreferencesdialog, 104).state == 1) { .enable #groupautoxdccresumejoin }
  else { .disable #groupautoxdccresumejoin }
  if ($did(xdccpreferencesdialog, 105).state == 1) { .enable #groupautoxdccq } 
  else { .disable #groupautoxdccq } 
  if ($did(xdccpreferencesdialog, 108).state == 1) { .enable #groupautoresumeatstart }
  else { .disable #groupautoresumeatstart }
  if ($did(xdccpreferencesdialog, 108).state == 1) { .enable #groupautoresumestart }
  else { .disable #groupautoresumestart }
  if ($did(xdccpreferencesdialog, 110).state == 1) { .enable #groupautojoinxdcc }
  else { .disable #groupautojoinxdcc }
  if ($did(xdccpreferencesdialog, 109).state == 1) { .enable #groupnonewconnects } 
  else { .disable #groupnonewconnects } 
  if ($did(xdccpreferencesdialog, 111).state == 1) { .enable #groupautoremove } 
  else { .disable #groupautoremove } 
  if ($did(xdccpreferencesdialog, 103).state == 1) { .enable #groupautosendresume }
  else { .disable #groupautosendresume }
  if ($did(xdccpreferencesdialog, 114).state == 1) { .enable #grouptrackqueuepos }
  else { .disable #grouptrackqueuepos }
  if ($did(xdccpreferencesdialog, 116).state == 1) { .set %debugxdccinfo on }
  else { .set %debugxdccinfo off }
  if ($did(xdccpreferencesdialog, 117).state == 1) { .enable #groupnickchangedetect }
  else { .disable #groupnickchangedetect }
  if ($did(xdccpreferencesdialog, 122).state == 1) { .enable #groupdccpendingerror }
  else { .disable #groupdccpendingerror }

  if ($did(xdccpreferencesdialog, 113).state == 1) { 
    .enable #grouppackchangedetect 
    set %comparepacks on
  }
  else {
    .disable #grouppackchangedetect 
    set %comparepacks off
  }

  if (%newxdccdir != $null && $remove($replxdccdir(%newxdccdir),$mircdir) != $remove($replxdccdir(%xdccdir),$mircdir)) {
    .mkdir %newxdccdir
    /movexdccdir2 %newxdccdir
  }

  if ($did(xdccpreferencesdialog,301).text != $xdccfont && ($gettok($did(xdccpreferencesdialog,301).text,1,32) == @XDCC_Info || $gettok($did(xdccpreferencesdialog,301).text,1-2,32) == -b @XDCC_Info)) { 
    set %xdccfont $did(xdccpreferencesdialog,301).text 
    .timer 1 1 /font $did(xdccpreferencesdialog,301).text 
  }

  if ($did(xdccpreferencesdialog, 307).state == 1) { 
    if ($showbotlist != on) {
      window -c @XDCC_Info
      /makexdccwindow 
    }
    set %showbotlist on 
  }
  elseif ($did(xdccpreferencesdialog, 307).state == 0) { 
    if ($showbotlist != off) {
      window -c @XDCC_Info
      /makexdccwindow 
    }
    set %showbotlist off 
  }

  if ($did(xdccpreferencesdialog, 801).state == 1) { set %xdccautoextraction on }
  else { set %xdccautoextraction off }

  set %xdccextractpath $did(xdccpreferencesdialog, 820).text
  set %winrarexe $did(xdccpreferencesdialog, 821).text
  set %unrarflags $remove($did(xdccpreferencesdialog, 822).text,$chr(32) $+ --)

  if ($did(xdccpreferencesdialog, 840).state == 1) { set %xdccautomove on }
  else { set %xdccautomove off }

  /outputxdccinfo 14Applied All Settings.
  /outputxdccinfo 
  unset %newxdccdir
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------

;-------------------------------------------------------------------------
; /dialog xdccpreferencesdialog:
; 14 editboxes, 1 ok button, 1 cancel button.
; 3rd manual setup window. Sets the timer settings.
;-------------------------------------------------------------------------
dialog xdccpreferencesdialog {
  title "XDCC Script Preferences"
  size -1 -1 700 600
  button "OK", 1, 170 565 100 25, ok
  button "Apply", 2, 290 565 100 25
  button "Cancel", 3, 410 565 100 25, cancel

  tab "Main", 4, 3 3 694 550
  tab "Connection", 5
  tab "Window", 6
  tab "Timers", 7
  tab "Files", 8
  tab "Lists", 9
  tab "Networks", 10
  tab "Auto-Extraction/Moving", 11
  tab "Nicklist Colors", 12

  text "Check the script features that you want to enable:", 101, 40 50 300 15, tab 4
  check "Automatically resume incoming transfers (downloads) when they fail", 102, 45 75 500 15, tab 4
  check "Automatically resume outgoing transfers (uploads) when they fail", 103, 45 95 330 15, tab 4
  check "Automatically resume transfers when an offline bot rejoins a channel", 104, 45 115 500 15, tab 4
  check "Automatically queue up next requested pack when a transfer completes", 105, 45 135 500 15, tab 4
  check "Automatically start queue for the next bot in the Bot Queue when a previous bot completes it's queue", 106, 45 155 600 15, tab 4
  check "Automatically test every few seconds and start queue for the next bot in the Bot Queue when ", 107, 45 175 475 15, tab 4
  check "Automatically resume incomplete transfers at IRC start that were active during the last time IRC closed", 108, 45 195 600 15, tab 4
  check "Automatically retry after N secs if a bot says it will refuse all connections for next N secs", 109, 45 215 600 15, tab 4
  check "Automatically try multi-source alternate bots if a bot is unavailable", 121, 45 235 500 15, tab 4
  check "Automatically join a channel if a bot requires it", 110, 45 255 500 15, tab 4
  check "Automatically join a channel before requesting a pack if needed", 118, 45 275 500 15, tab 4
  check "Automatically connect to networks in connect file at IRC start", 119, 45 295 500 15, tab 4
  check "Automatically connect to networks with open XDCC requests at IRC start", 120, 45 315 500 15, tab 4
  check "Automatically remove packs that you manually removed from a bot's remote queue using /msg bot xdcc remove", 111, 45 335 600 15, tab 4
  check "Automatically attempt to remove a completed pack from queues on all bots, instead of just the bot that completed it", 112, 45 355 603 15, tab 4
  check "Automatically copy entries for a bot on a nickname change", 117, 45 375 500 15, tab 4
  check "Automatically suspend auto resume on xdcc pending error", 122, 45 395 500 15, tab 4
  check "Automatically inform me if a bot's pack listing appears to have changed", 113, 45 415 500 15, tab 4
  check "Automatically inform me if my remote queue position changes on a bot", 114, 45 435 500 15, tab 4
  check "Automatically clean XDCC library from old files at IRC startup", 115, 45 455 500 15, tab 4
  check "Write a debugging Log file", 116, 45 510 440 15, tab 4

  edit "", 130, 590 92 80 20, tab 4
  check "Bandwidth limit (Per Send, in KB/s):", 131, 395 95 185 15, tab 4
  combo 132, 520 171 150 20, drop, tab 4

  box "Main Options:", 140, 15 30 670 505, tab 4



  edit "", 201, 500 117 120 20, tab 5
  edit "", 202, 500 137 120 20, tab 5
  edit "", 203, 500 187 120 20, tab 5
  edit "", 204, 500 207 120 20, tab 5
  edit "", 205, 500 257 120 20, tab 5
  edit "", 206, 500 460 120 20, tab 5

  check "Enable timed testing for ", 210, 55 67 131 20, tab 5
  check "Enable DCC send autoresume ", 211, 55 420 180 20, tab 5
  combo 220, 190 67 150 20, drop, tab 5
  text "Minimum bandwidth that should be used at any time (in KByte):", 230, 45 120 390 20, tab 5
  text "Maximum bandwidth for which to start a new XDCC transfer when file completes (in KByte):", 231, 45 140 440 20, tab 5
  text "Minimum number of downloads that should be active at any time:", 232, 45 190 390 20, tab 5
  text "Maximum number of downloads that should be active at any time:", 233, 45 210 390 20, tab 5
  text "Your approximate connection speed (in KByte):", 234, 45 260 390 20, tab 5
  check "Limit maximum bandwidth to be used by a resumed DCC Send to:", 235, 55 460 360 20, tab 5

  box "Connection Options:", 250, 15 30 670 505, tab 5
  box "System Options:", 251, 35 240 630 45, tab 5
  box "Timed Botqueue Handling Settings:", 252, 25 45 650 350, tab 5
  box "Used bandwidth method:", 253, 35 100 630 65, tab 5
  box "Number of active transfers method:", 254, 35 170 630 65, tab 5

  box "Auto Send Resume Options:", 255, 25 400 650 120, tab 5



  edit "", 301, 45 260 250 25, tab 6
  text "Where do you want the script's messages to go?", 302, 40 50 300 15, tab 6
  text "", 310, 40 240 250 15, tab 6
  radio "Write messages to a separate XDCC_Info window", 303, 45 80 300 15, group, tab 6
  radio "Write messages to the server status window", 304, 45 100 300 15, tab 6
  radio "Write messages to the currently active window", 305, 45 120 300 15, tab 6
  radio "Write messages to the currently active window and to a separate XDCC_Info window", 306, 45 140 430 15, tab 6
  check "Show a list of all known bots in the separate XDCC_Info window", 307, 45 180 400 15, tab 6
  check "Keep track of offline or unreachable bots by coloring botlist on quit, connect/disconnect and join/part", 308, 45 200 510 15, tab 6
  check "Use keyboard shortcuts (in @XDCC_Info window)", 309, 45 340 510 15, tab 6

  box "Window Options:", 320, 15 30 670 505, tab 6


  edit "", 401, 348 78 53 20, tab 7
  edit "", 402, 414 78 53 20, tab 7
  edit "", 403, 348 98 53 20, tab 7
  text "N/A", 404, 420 100 53 20, tab 7
  edit "", 405, 414 118 53 20, tab 7
  text "N/A", 406, 350 120 53 20, tab 7
  edit "", 407, 348 138 53 20, tab 7
  text "N/A", 408, 420 140 53 20, tab 7
  edit "", 409, 348 158 53 20, tab 7
  edit "", 410, 414 158 53 20, tab 7
  edit "", 411, 348 178 53 20, tab 7
  edit "", 412, 414 178 53 20, tab 7
  edit "", 413, 348 198 53 20, tab 7
  edit "", 414, 414 198 53 20, tab 7
  edit "", 415, 348 218 53 20, tab 7
  text "N/A", 416, 420 220 53 20, tab 7
  edit "", 417, 348 238 53 20, tab 7
  text "N/A", 418, 420 240 53 20, tab 7
  edit "", 419, 348 258 53 20, tab 7
  text "N/A", 420, 420 260 53 20, tab 7
  edit "", 421, 348 278 53 20, tab 7
  text "N/A", 422, 420 280 53 20, tab 7

  text "Delay for failed download auto resume (in secs):", 430, 45 80 300 15, tab 7
  text "Disable time for failed download auto resume (in secs):", 431, 45 100 300 15, tab 7
  text "Delay for failed upload auto resume (in secs):", 432, 45 120 300 15, tab 7
  text "Disable time for failed upload auto resume (in secs):", 433, 45 140 300 15, tab 7
  text "Delay for next pack auto queue (in secs):", 434, 45 160 300 15, tab 7
  text "Delay for retry on remote queue full (in secs):", 435, 45 180 300 15, tab 7
  text "Added delay for retry on 'no new connections' notice:", 436, 45 200 300 15, tab 7
  text "Offset for auto download resume at IRC start (in secs):", 437, 45 220 300 15, tab 7
  text "Delay for open download slot or available bandwidth test:", 438, 45 240 300 15, tab 7
  text "Delay for updated pack listing comparison (in secs):", 439, 45 260 300 15, tab 7
  text "Idle XDCC library entry timeout date (in days):", 440, 45 280 300 15, tab 7

  text "The time intervals used by the XDCC script are as follows: ", 451, 40 50 300 15, tab 7
  box "Min Time", 460, 345 63 60 239, tab 7
  box "Max Time", 461, 410 63 60 239, tab 7

  box "Timer Settings:", 462, 15 30 670 505, tab 7



  edit "", 501, 318 48 165 20, tab 8
  edit "", 502, 318 68 165 20, tab 8
  edit "", 503, 318 88 165 20, tab 8
  edit "", 504, 318 108 165 20, tab 8
  edit "", 505, 318 128 165 20, tab 8
  edit "", 506, 318 168 165 20, tab 8
  edit "", 507, 318 188 165 20, tab 8
  edit "", 508, 318 208 165 20, tab 8
  edit "", 509, 318 228 165 20, tab 8
  edit "", 510, 318 248 165 20, tab 8
  edit "", 511, 318 268 165 20, tab 8
  edit "", 512, 318 288 165 20, tab 8
  edit "", 513, 318 328 165 20, tab 8
  edit "", 514, 318 368 165 20, tab 8
  edit "", 515, 318 348 165 20, tab 8
  edit "", 516, 318 308 165 20, tab 8
  edit "", 517, 318 148 165 20, tab 8

  button "Choose Script Directory", 530, 318 400 165 25, tab 8

  text "", 551, 45 405 150 15, tab 8
  text "Trigger Hash File:", 552, 45 50 250 15, tab 8
  text "Trigger Hash Backup File:", 553, 45 70 250 15, tab 8
  text "Active Transfers File:", 554, 45 90 250 15, tab 8
  text "Auto Resume Get Temp Disable File:", 555, 45 110 250 15, tab 8
  text "Auto Resume Send Temp Disable File:", 556, 45 130 200 15, tab 8
  text "Temp Bot Queue File:", 557, 45 170 250 15, tab 8
  text "Session Gets File:", 558, 45 190 250 15, tab 8
  text "Session Sends File:", 559, 45 210 250 15, tab 8
  text "Active Transfers On Networks File:", 560, 45 230 250 15, tab 8
  text "Remote Queue Positions File:", 561, 45 250 250 15, tab 8
  text "Channel Key File:", 562, 45 270 250 15, tab 8
  text "DCCALLOW Network File:", 563, 45 290 250 15, tab 8
  text "Debug Log File:", 564, 45 330 250 15, tab 8
  text "Statistics file mask:", 565, 45 370 250 15, tab 8
  text "Wishlist File:",566, 45 350 250 15, tab 8
  text "Alternate DCC Server Send Method File:",567, 45 310 250 15, tab 8
  text "Bot Queue File:", 568, 45 150 250 15, tab 8

  box "Timer Settings:", 580, 15 30 670 505, tab 8


  button "Add Channel Key", 601, 33 110 150 25, tab 9
  button "Delete Channel Key", 602, 189 110 150 25, tab 9
  button "Add DCCALLOW Network", 603, 363 110 150 25, tab 9
  button "Remove DCCALLOW Network", 604, 518 110 150 25, tab 9
  button "Add Alt. DCC Server", 605, 33 350 150 25, tab 9
  button "Remove Alt. DCC Server", 606, 189 350 150 25, tab 9
  button "Add Wishlist Item", 607, 363 350 150 25, tab 9
  button "Remove Wishlist Item", 608, 518 350 150 25, tab 9

  list 610, 33 145 305 145, tab 9
  list 611, 363 145 305 145, tab 9
  list 612, 33 385 305 145, tab 9
  list 613, 363 385 305 145, tab 9
  box "Miscelaneous Options: ", 630, 15 30 670 505, tab 9
  box "Channel Keys: ", 631, 25 45 322 235, tab 9
  box "Networks with /DCCALLOW + support: ", 632, 353 45 322 235, tab 9
  box "DCC Alternate Send Method Support: ", 633, 25 285 322 235, tab 9
  box "Wishlist Items: ", 634, 353 285 322 235, tab 9

  text "Add or remove channels that require a key to join.",650, 32 65 250 25, tab 9
  text "Syntax: NETWORK CHANNEL KEY (E.g.: EFnet #chan 1337key)",651, 32 85 250 15, tab 9
  text "Add or remove networks that require /DCCALLOW +NICKNAME to receive files.",652, 362 63 290 25, tab 9
  text "Syntax: NETWORK (E.g.: EFnet)",653, 362 90 250 15, tab 9

  text "Add or remove bots that use a '/dccserver ?? on PORT' method.",654, 32 303 320 25, tab 9
  text "Syntax: NETWORK NICK COMMAND (E.g.: EFnet guest1234 /dccserver +sc on 1337)",655, 32 319 320 25, tab 9
  text "Add or remove items the script should warn you about if they are seen. More general description will give more matches, more specific description to prevent false alarms.",656, 362 303 290 40, tab 9


  box "Network Auto Connect Settings:", 780, 15 30 670 505, tab 10

  list 710, 35 70 135 460, tab 10, sort, extsel
  list 711, 270 120 135 350, tab 10, extsel
  text "Available Networks:", 720, 50 50 305 15, tab 10
  text "Current Auto-Connect list:", 721, 208 100 345 15, tab 10

  button "Add >>", 730, 180 253 75 25, tab 10
  button "<< Remove", 731, 180 283 75 25, tab 10
  button "UP", 732, 270 460 135 25, tab 10
  button "DOWN", 733, 270 490 135 25, tab 10

  check "Use the list below to auto connect", 740, 210 50 210 20, tab 10
  check "Join all networks with waiting transfers", 741, 210 75 210 20, tab 10


  box "Auto Move/Extraction Options:", 880, 15 30 670 505, tab 11
  box "Automated Archive Extraction Settings (RAR/TAR/ZIP):", 881, 25 50 650 305, tab 11
  box "Automated File Moving Settings:", 882, 25 355 650 170, tab 11
  box "Flag explanation", 883, 35 160 310 185, tab 11



  check "Automatically extract completed archives to: ", 801, 45 75 250 15, tab 11
  Button "Choose", 831, 565 70 100 25, tab 11
  Button "Choose", 832, 565 100 100 25, tab 11
  text "Path to winrar.exe: ", 802, 45 105 200 15, tab 11
  text "Flags: ", 803, 45 130 200 15, tab 11
  text "-ibck: Run in background.", 804, 45 180 200 15, tab 11
  text "-kb: Keep broken files.", 805, 45 200 200 15, tab 11
  text "-ad: Separate folder for each archive (prevents loose files).", 806, 45 220 300 15, tab 11
  text "-o-: Do not overwrite existing files.", 807, 45 240 200 15, tab 11
  text "-o+: Overwrite all existing files.", 808, 45 260 200 15, tab 11
  text "-y: Assume yes to all queries.", 809, 45 280 200 15, tab 11
  text "-ilog[name]: Create log file.", 810, 45 300 200 15, tab 11
  text "Do not add flag '--' (automatically added).", 811, 45 320 200 15, tab 11
  edit "", 820, 300 72 250 20, tab 11
  edit "", 821, 300 102 250 20, tab 11
  edit "", 822, 300 127 250 20, tab 11

  check "Automatically move Files with Extension: ", 840, 45 410 250 15, tab 11
  text "To Directory (on D/L Completion): ", 870, 65 435 200 15, tab 11
  combo 850, 300 410 255 20, tab 11, drop, sort
  edit "", 851, 300 438 255 20, tab 11
  Button "Choose", 852, 565 435 100 25, tab 11
  Button "Add Extention", 853, 300 380 125 25, tab 11
  Button "Remove Extention", 854, 430 380 125 25, tab 11

  text "Future project.",900, 300 300 250 25, tab 12
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------

;-------------------------------------------------------------------------
; Settings and Options menu dialog listeners.
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:edit:130:{ 
  /did -o xdccpreferencesdialog 206 1 $did(xdccpreferencesdialog,130,1).text
}
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:edit:206:{ 
  /did -o xdccpreferencesdialog 130 1 $did(xdccpreferencesdialog,206,1).text
}
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:103:{ 
  if ($did(xdccpreferencesdialog,103).state == 1) { 
    /did -c xdccpreferencesdialog 211
    /did -e xdccpreferencesdialog 131
    /did -e xdccpreferencesdialog 235
    if ($did(xdccpreferencesdialog,131).state == 1) {
      /did -n xdccpreferencesdialog 130 
      /did -n xdccpreferencesdialog 206
    }
  }
  else { 
    /did -u xdccpreferencesdialog 211
    /did -b xdccpreferencesdialog 131
    /did -b xdccpreferencesdialog 235 
    /did -m xdccpreferencesdialog 130
    /did -m xdccpreferencesdialog 206
  }
}
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:211:{
  if ($did(xdccpreferencesdialog,211).state == 1) { 
    /did -c xdccpreferencesdialog 103 
    /did -e xdccpreferencesdialog 131
    /did -e xdccpreferencesdialog 235
    if ($did(xdccpreferencesdialog,235).state == 1) {
      /did -n xdccpreferencesdialog 130
      /did -n xdccpreferencesdialog 206
    }
  }
  else { 
    /did -u xdccpreferencesdialog 103 
    /did -b xdccpreferencesdialog 131
    /did -b xdccpreferencesdialog 235
    /did -m xdccpreferencesdialog 130
    /did -m xdccpreferencesdialog 206
  }
}
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:235:{ 
  if ($did(xdccpreferencesdialog,235).state == 1) { 
    /did -c xdccpreferencesdialog 131
    /did -n xdccpreferencesdialog 130
    /did -n xdccpreferencesdialog 206
  }
  else {
    /did -u xdccpreferencesdialog 131
    /did -m xdccpreferencesdialog 130
    /did -m xdccpreferencesdialog 206
  }
}
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:131:{ 
  if ($did(xdccpreferencesdialog,131).state == 1) { 
    /did -c xdccpreferencesdialog 235
    /did -n xdccpreferencesdialog 130
    /did -n xdccpreferencesdialog 206
  }
  else {
    /did -u xdccpreferencesdialog 235
    /did -m xdccpreferencesdialog 130
    /did -m xdccpreferencesdialog 206
  }
}
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:132:{ 
  /did -c xdccpreferencesdialog 220 $did(132).sel 
  if ($did(xdccpreferencesdialog,132).sel == 1) { 
    /did -m xdccpreferencesdialog 230 
    /did -m xdccpreferencesdialog 231 
    /did -n xdccpreferencesdialog 232
    /did -n xdccpreferencesdialog 233
  }
  else {
    /did -n xdccpreferencesdialog 230 
    /did -n xdccpreferencesdialog 231 
    /did -m xdccpreferencesdialog 232
    /did -m xdccpreferencesdialog 233
  }
} 
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:119:{ 
  if ($did(xdccpreferencesdialog,119).state == 1) {
    /did -c xdccpreferencesdialog 740
  } 
  else {
    /did -u xdccpreferencesdialog 740
  } 
} 
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:740:{ 
  if ($did(xdccpreferencesdialog,740).state == 1) {
    /did -c xdccpreferencesdialog 119
  } 
  else {
    /did -u xdccpreferencesdialog 119
  } 
} 
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:741:{ 
  if ($did(xdccpreferencesdialog,741).state == 1) {
    /did -c xdccpreferencesdialog 120
  } 
  else {
    /did -u xdccpreferencesdialog 120
  } 
} 
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:120:{ 
  if ($did(xdccpreferencesdialog,120).state == 1) {
    /did -c xdccpreferencesdialog 741
  } 
  else {
    /did -u xdccpreferencesdialog 741
  } 
} 
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:220:{ 
  /did -c xdccpreferencesdialog 132 $did(220).sel 
  if ($did(xdccpreferencesdialog,220).sel == 1) { 
    /did -n xdccpreferencesdialog 201 
    /did -n xdccpreferencesdialog 202 
    /did -m xdccpreferencesdialog 203
    /did -m xdccpreferencesdialog 204
  }
  else {
    /did -m xdccpreferencesdialog 201 
    /did -m xdccpreferencesdialog 202 
    /did -n xdccpreferencesdialog 203
    /did -n xdccpreferencesdialog 204
  }
}
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:107:{ 
  if ($did(xdccpreferencesdialog,107).state == 1) { 
    /did -e xdccpreferencesdialog 132 
    /did -c xdccpreferencesdialog 210
    /did -e xdccpreferencesdialog 220
    if ($did(xdccpreferencesdialog,220).sel == 1) { 
      /did -n xdccpreferencesdialog 201 
      /did -n xdccpreferencesdialog 202 
      /did -m xdccpreferencesdialog 203
      /did -m xdccpreferencesdialog 204
    }
    else {
      /did -m xdccpreferencesdialog 201 
      /did -m xdccpreferencesdialog 202 
      /did -n xdccpreferencesdialog 203
      /did -n xdccpreferencesdialog 204
    }
  }
  else { 
    /did -b xdccpreferencesdialog 132 
    /did -u xdccpreferencesdialog 210
    /did -b xdccpreferencesdialog 220
    /did -m xdccpreferencesdialog 201 
    /did -m xdccpreferencesdialog 202 
    /did -m xdccpreferencesdialog 203 
    /did -m xdccpreferencesdialog 204 
  }
}
;-------------------------------------------------------------------------
on 1:dialog:xdccpreferencesdialog:sclick:210:{ 
  if ($did(xdccpreferencesdialog,210).state == 1) { 
    /did -e xdccpreferencesdialog 132 
    /did -c xdccpreferencesdialog 107
    /did -e xdccpreferencesdialog 220
    if ($did(xdccpreferencesdialog,220).sel == 1) { 
      /did -n xdccpreferencesdialog 201
      /did -n xdccpreferencesdialog 202
      /did -m xdccpreferencesdialog 203 
      /did -m xdccpreferencesdialog 204
    }
    else {
      /did -m xdccpreferencesdialog 201 
      /did -m xdccpreferencesdialog 202 
      /did -n xdccpreferencesdialog 203
      /did -n xdccpreferencesdialog 204
    }
  }
  else { 
    /did -b xdccpreferencesdialog 132 
    /did -u xdccpreferencesdialog 107
    /did -b xdccpreferencesdialog 220
    /did -m xdccpreferencesdialog 201 
    /did -m xdccpreferencesdialog 202 
    /did -m xdccpreferencesdialog 203 
    /did -m xdccpreferencesdialog 204 
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:530:{ 
  var %tempdir = $sdir($xdccdir, Select directory to be used for XDCC script) 
  if (%tempdir != $null) {
    set %newxdccdir %tempdir
    //did -o xdccpreferencesdialog 551 1 New XDCC dir $+ $chr(58) $replxdccdir(%newxdccdir)
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:601: {
  var %chankey = $?*="Please input network, channel and required key separated by a space (E.g.: EFnet #channel 1337key)."
  if ($numtok(%chankey, 32) >= 3) { 
    /did -a xdccpreferencesdialog 610 $gettok(%chankey,1-2,32) 
    if ($read($chankeyfile,snt,$gettok(%chankey,1-2,32))) { /write -ds" $+ $gettok(%chankey,1-2,32) $+ " $chankeyfile }
    /write -a $chankeyfile %chankey
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:603: {
  var %networks = $?="Please input networks that should support DCCALLOW options, separated by a space (E.g.: DALnet EFnet irchighway). Do not add networks that don't use DCCALLOW."
  var %i = 1
  while (%i <= $numtok(%networks, 32)) { 
    if (!$read($dccallownetworkfile,wnt,$gettok(%networks,%i,32))) { 
      /did -a xdccpreferencesdialog 611 $gettok(%networks,%i,32) 
      /write -a $dccallownetworkfile $gettok(%networks,%i,32) 
    }
    inc %i
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:605: {
  var %altserv = $?="Please input network, nickname and dccserver command separated by a space (E.g.: EFnet guest1234 /dccserver +sc on 1337)."
  if ($numtok(%altserv, 32) > 4) { 
    /did -a xdccpreferencesdialog 612 %altserv 
    if (!$read($alternatedccserverfile,wnt,$gettok(%altserv,1-2,32))) { /write -ds" $+ $gettok(%altserv,1-2,32) $+ " $alternatedccserverfile }
    /write -a $alternatedccserverfile %altserv  
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:607: {
  var %newwishlistitem = $?="Please input a (partial) pack description to add to the wishlist."
  if (!$read($xdccwishlist,wnt,%newwishlistitem)) { 
    /did -a xdccpreferencesdialog 613 %newwishlistitem 
    /write -a $xdccwishlist %newwishlistitem 
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:602: { 
  if ($read($chankeyfile,snt,$did(xdccpreferencesdialog, 610).seltext)) { /write -ds" $+ $did(xdccpreferencesdialog, 610).seltext $+ " $chankeyfile }
  /did -d xdccpreferencesdialog 610 $did(xdccpreferencesdialog, 610).sel 
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:604: { 
  if ($read($dccallownetworkfile,wnt,$did(xdccpreferencesdialog, 611).seltext)) { /write -dw" $+ $did(xdccpreferencesdialog, 611).seltext $+ " $dccallownetworkfile }
  /did -d xdccpreferencesdialog 611 $did(xdccpreferencesdialog, 611).sel 
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:606: {
  if ($read($alternatedccserverfile,wnt,$did(xdccpreferencesdialog, 612).seltext)) { /write -dw" $+ $did(xdccpreferencesdialog, 612).seltext $+ " $alternatedccserverfile }
  /did -d xdccpreferencesdialog 612 $did(xdccpreferencesdialog, 612).sel 
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:608: { 
  if ($read($xdccwishlist,wnt,$did(xdccpreferencesdialog, 613).seltext)) { /write -dw" $+ $did(xdccpreferencesdialog, 613).seltext $+ " $xdccwishlist }
  /did -d xdccpreferencesdialog 613 $did(xdccpreferencesdialog, 613).sel 
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:dclick:710: {
  if (!$didwm(xdccpreferencesdialog,711,$did(xdccpreferencesdialog,710).seltext)) { 
    /did -a xdccpreferencesdialog 711 $did(xdccpreferencesdialog,710).seltext 
    /write -a $autoconnectfile $did(xdccpreferencesdialog,710).seltext
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:dclick:711: {  
  /write -dw" $+ $did(xdccpreferencesdialog,711).seltext $+ " $autoconnectfile 
  /did -d xdccpreferencesdialog 711 $did(xdccpreferencesdialog,711).sel
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:730: {
  if (!$didwm(xdccpreferencesdialog,711,$did(xdccpreferencesdialog,710).seltext)) { 
    /did -a xdccpreferencesdialog 711 $did(xdccpreferencesdialog,710).seltext 
    /write -a $autoconnectfile $did(xdccpreferencesdialog,710).seltext
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:731: {  
  /write -dw" $+ $did(xdccpreferencesdialog,711).seltext $+ " $autoconnectfile 
  /did -d xdccpreferencesdialog 711 $did(xdccpreferencesdialog,711).sel
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:732: {
  if ($did(xdccpreferencesdialog,711,$calc($did(xdccpreferencesdialog,711,1).sel - 1)).text != $null) {
    var %aline = $did(xdccpreferencesdialog,711,$calc($did(xdccpreferencesdialog,711,1).sel - 1)).text
    var %bline = $did(xdccpreferencesdialog,711,1).seltext 

    //write -l $+ $calc($did(xdccpreferencesdialog,711,1).sel - 1) $autoconnectfile %bline
    //write -l $+ $did(xdccpreferencesdialog,711,1).sel $autoconnectfile %aline

    /did -r xdccpreferencesdialog 711
    var %i = 1
    while (%i <= $lines($autoconnectfile)) {
      /did -a xdccpreferencesdialog 711 $read($autoconnectfile,nt,%i)
      inc %i
    }
    /did -c xdccpreferencesdialog 711 $didwm(xdccpreferencesdialog,711,%bline)
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:733: {  
  if ($did(xdccpreferencesdialog,711,$calc($did(xdccpreferencesdialog,711,1).sel + 1)).text) {
    var %aline = $did(xdccpreferencesdialog,711,$calc($did(xdccpreferencesdialog,711,1).sel + 1)).text
    var %bline = $did(xdccpreferencesdialog,711,1).seltext 
    //write -l $+ $calc($did(xdccpreferencesdialog,711,1).sel + 1) $autoconnectfile %bline
    //write -l $+ $did(xdccpreferencesdialog,711,1).sel $autoconnectfile %aline

    /did -r xdccpreferencesdialog 711
    var %i = 1
    while (%i <= $lines($autoconnectfile)) {
      /did -a xdccpreferencesdialog 711 $read($autoconnectfile,nt,%i)
      inc %i
    }

    /did -c xdccpreferencesdialog 711 $didwm(xdccpreferencesdialog,711,%bline)
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:831: {
  var %tmpxdccextractpath = $sdir($iif($xdccextractpath == $null,$getdir,$xdccextractpath),Select directory to auto-extract archives to)
  if (%tmpxdccextractpath != $null) {
    /did -r xdccpreferencesdialog 820 
    /did -a xdccpreferencesdialog 820 %tmpxdccextractpath 
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:832: {
  var %tmpxdccextractfile = $sfile(C:\Program Files\WinRAR\WinRAR.exe,Select winrar.exe executable)
  if (%tmpxdccextractfile != $null) {
    /did -r xdccpreferencesdialog 821
    /did -a xdccpreferencesdialog 821 %tmpxdccextractfile 
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:850: {
  /did -e xdccpreferencesdialog 852
  /did -e xdccpreferencesdialog 854
  /did -r xdccpreferencesdialog 851
  var %tmpxdccmvdir = $read($xdccautomovepathfile,snt,$did(xdccpreferencesdialog,850).seltext)
  if (%tmpxdccmvdir != $null) {
    /did -a xdccpreferencesdialog 851 %tmpxdccmvdir
  }
}
;-------------------------------------------------------------------------
;on *:dialog:xdccpreferencesdialog:edit:850: {
;  /did -e xdccpreferencesdialog 852
;  var %tmpxdccmvdir = $read($xdccautomovepathfile,snt,$did(xdccpreferencesdialog,850).text)
;  if (%tmpxdccmvdir != $null) {
;    /did -r xdccpreferencesdialog 851
;    /did -a xdccpreferencesdialog 851 %tmpxdccmvdir
;  }
;}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:edit:851: {
  var %tmpxdccmvdir = $did(xdccpreferencesdialog,851).text
  var %seltext = $did(xdccpreferencesdialog,850).seltext
  if (%tmpxdccmvdir != $null) {
    if ($read($xdccautomovepathfile,wnt,%seltext *)) {
      /write -dw" $+ %seltext *" $xdccautomovepathfile
    }
    ;/did -r xdccpreferencesdialog 851
    ;/did -a xdccpreferencesdialog 851 %tmpxdccmvdir
    /write -a $xdccautomovepathfile %seltext $did(xdccpreferencesdialog,851).text
    /loadprefmvdirlist
    /did -c xdccpreferencesdialog 850 $didwm(xdccpreferencesdialog,850,%seltext)
    /did -e xdccpreferencesdialog 852
    /did -e xdccpreferencesdialog 854
  }
  else { 
    /write -dw" $+ %seltext *" $xdccautomovepathfile
    /did -b xdccpreferencesdialog 854 
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:852: {
  var %tmpxdccmvdir = $sdir($getdir,Select output Directory)
  if (%tmpxdccmvdir != $null) {
    var %seltext = $did(xdccpreferencesdialog,850).seltext
    if ($read($xdccautomovepathfile,wnt,%seltext *)) {
      /write -dw" $+ %seltext *" $xdccautomovepathfile
    }
    /did -r xdccpreferencesdialog 851
    /did -a xdccpreferencesdialog 851 %tmpxdccmvdir
    /write -a $xdccautomovepathfile %seltext $did(xdccpreferencesdialog,851).text
    /loadprefmvdirlist
    /did -c xdccpreferencesdialog 850 $didwm(xdccpreferencesdialog,850,%seltext)
    /did -e xdccpreferencesdialog 854
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:853: {
  var %extension = $remove($?="Type file extension to add:",$chr(46))
  if (%extension != $null) {
    if ($read($xdccautomovepathfile,snt,%extension)) {
      /did -c xdccpreferencesdialog 850 $didwm(xdccpreferencesdialog,850,%extension)
      /did -r xdccpreferencesdialog 851
      /did -a xdccpreferencesdialog 851 $read($xdccautomovepathfile,snt,%extension)
      /did -e xdccpreferencesdialog 852
      /did -b xdccpreferencesdialog 854
    }
    else {
      /did -a xdccpreferencesdialog 850 %extension
      /did -c xdccpreferencesdialog 850 $didwm(xdccpreferencesdialog,850,%extension)
      /did -r xdccpreferencesdialog 851
      /did -e xdccpreferencesdialog 852
      /did -b xdccpreferencesdialog 854
    }
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:854: {
  var %extension = $did(xdccpreferencesdialog,850).seltext
  if (%extension != $null) {
    if ($read($xdccautomovepathfile,wnt,%extension *)) {
      /write -dw" $+ %extension *" $xdccautomovepathfile
      /did -r xdccpreferencesdialog 850
      /did -r xdccpreferencesdialog 851
      /did -b xdccpreferencesdialog 852
      /did -b xdccpreferencesdialog 854
      /loadprefmvdirlist
    }
    else {
      /did -r xdccpreferencesdialog 850
      /did -r xdccpreferencesdialog 851
      /did -b xdccpreferencesdialog 852
      /did -b xdccpreferencesdialog 854
    }
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:1,2: { /applyallxdccsettings }
;-------------------------------------------------------------------------
on *:dialog:xdccpreferencesdialog:sclick:3: { 
  /outputxdccinfo 14Settings not saved, options dialog cancelled. 
  /outputxdccinfo 
}
;-------------------------------------------------------------------------













;-------------------------------------------------------------------------
; /dialog xdccinitwizard:
; 3 radio buttons, 1 ok button.
; Here you can choose to open an existing profile, revert to default 
; settings, or continue with the wizard manually.
;-------------------------------------------------------------------------
dialog xdccinitwizard {
  title "XDCC Autoresume/Autoqueue Stealth Script Wizard"
  size -1 -1 300 200
  button "Next", 1, 100 160 100 25, Ok 
  text "What do you want to do:", 3, 30 40 130 15
  radio "I want to open an existing profile", 4, 35 60 200 15, group
  radio "I want to use default values", 5, 35 80 200 15
  radio "I want to configure the script manually now", 6, 35 100 240 15
  box "Choose Configuration Method", 7, 5 5 290 190
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------

;-------------------------------------------------------------------------
; Remote identifiers for /dialog xdccinitwizard:
; init: Selects revert to default.
; sclick 5 & 4,6: Renames the ok button.
; sclick 1: Loads or reverts settings, or continues the wizard with 
;           /dialog xdccmanualwizard3.
;-------------------------------------------------------------------------
on *:dialog:xdccinitwizard:init:*: { /did -c xdccinitwizard 5 }
;-------------------------------------------------------------------------
on *:dialog:xdccinitwizard:sclick:5: {
  /did -r xdccinitwizard 1
  /did -a xdccinitwizard 1 OK
}
;-------------------------------------------------------------------------
on *:dialog:xdccinitwizard:sclick:4,6: {
  /did -r xdccinitwizard 1
  /did -a xdccinitwizard 1 Next
}
;-------------------------------------------------------------------------
on *:dialog:xdccinitwizard:sclick:1: {
  if ($did(4).state == 1) { /xdccloadwizard }
  elseif ($did(5).state == 1) { /reverttodefaults2 }
  elseif ($did(6).state == 1) { /xdccmanualwizard1 }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------


;-------------------------------------------------------------------------
; Wizard dialog aliases:
; /xdccinitwizard: Set default values, then open xdccinitwizard dialog.
; /xdccloadwizard: Show file dialog and load settings from selected file.
; /xdccmanualwizard1-4: Open /xdccmanualwizard1-4 dialog.
;-------------------------------------------------------------------------
alias xdccinitwizard { 
  /reverttodefaults2
  /dialog -m xdccinitwizard XDCCInitWizard 
}
;-------------------------------------------------------------------------
alias xdccloadwizard {
  if ($isdir($xdccdir)) { var %filenm = $sfile($xdccdir $+ \ $+ *.set,Select profile to load) }
  else { var %filenm = $sfile($mircdir $+ \ $+ *.set,Select profile to load) }
  /loadxdccscriptsettings $remove(%filenm,.set)
}
;-------------------------------------------------------------------------





;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias xdccmanualwizard1 { 
  /dialog -m xdccmanualwizard1 xdccmanualwizard1 
  /did -b xdccmanualwizard1 1
}
;-------------------------------------------------------------------------
dialog xdccmanualwizard1 {
  title "XDCC Script Manual Wizard: System and bandwidth settings"
  size -1 -1 400 250
  button "Next", 1, 140 200 100 25, ok 
  box "Main Options:", 17, 5 5 390 240
  text "Your system's approximate total Bandwidth limit (in KB/s):", 19, 25 80 300 15
  edit "", 18, 330 75 50 20
}
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard1:edit:18:{
  if ($did(xdccmanualwizard1,18).text isnum &&  $did(xdccmanualwizard1,18).text > 0) { /did -e xdccmanualwizard1 1 }
}
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard1:sclick:1:{
  if ($did(xdccmanualwizard1,18).text isnum &&  $did(xdccmanualwizard1,18).text > 0) {
    set %connectionbandwidth $did(xdccmanualwizard1,18).text
    set %maxbandwidth $connectionbandwidth * 0.75
    set %minbandwidth $connectionbandwidth * 0.50
    set %maxtransfers $ceil($sqrt($sqrt($calc(2 * $did(xdccmanualwizard1,18).text))))
    set %mintransfers $floor($sqrt($sqrt($calc($did(xdccmanualwizard1,18).text))))
    /xdccmanualwizard2
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------







;-------------------------------------------------------------------------
; /dialog xdccmanualwizard2:
; 13 checkboxes, 1 editbox, 1 ok button, 1 cancel button.
; 1st manual setup window. Sets the main features for the script, and the 
; send bandwidth for auto resume send. 
;-------------------------------------------------------------------------
dialog xdccmanualwizard2 {
  title "XDCC Script Manual Wizard: Features"
  size -1 -1 750 420
  button "Next", 1, 250 360 100 25, ok 
  button "Cancel", 2, 375 360 100 25, cancel
  text "Check the script features that you want to enable:", 3, 70 40 300 15
  check "Automatically resume incoming transfers when they fail", 4, 75 60 500 15, group
  check "Automatically resume outgoing transfers when they fail", 16, 75 80 300 15
  check "Automatically resume transfers when an offline bot rejoins a channel", 5, 75 100 500 15
  check "Automatically queue up next requested pack when a transfer completes", 6, 75 120 500 15
  check "Automatically start queue for the next bot in the Bot Queue when a previous bot completes it's queue", 7, 75 140 600 15
  check "Automatically resume incomplete transfers that were active during last IRC close at IRC start", 8, 75 180 600 15
  check "Automatically retry after N secs if bot says it will refuse all connections for next N secs", 9, 75 200 600 15
  check "Automatically join a channel if a bot requires it", 10, 75 220 500 15
  check "Automatically remove packs that you manually removed from a bot's remote queue using /msg bot xdcc remove", 11, 75 240 600 15
  check "Automatically attempt to remove a completed pack from all queues on all bots instead of just the one bot that completed it", 12, 75 260 603 15
  check "Automatically inform me if a bot's pack listing appears to have changed", 13, 75 280 500 15
  check "Automatically inform me if my remote queue position changes on a bot", 14, 75 300 500 15
  check "Automatically clean XDCC library from old files at IRC startup", 15, 75 320 500 15
  check "Automatically check every few minutes to see if bandwidth is available", 20, 75 160 500 15
  box "Main Options:", 17, 5 5 740 410
  text "Bandwidth limit (Per Send, in KB/s):", 19, 395 80 200 15
  edit "Unlimited", 18, 570 77 80 20
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------

;-------------------------------------------------------------------------
; Remote identifiers for /dialog xdccmanualwizard2:
; init: Selects default features.
; sclick 2: Cancel.
; sclick 1: Enables the appropriate groups and sets variables, then 
;           continues the wizard with /dialog xdccmanualwizard3.
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard2:init:*: {
  /did -c xdccmanualwizard2 4
  /did -c xdccmanualwizard2 5
  /did -c xdccmanualwizard2 6
  /did -c xdccmanualwizard2 10
}
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard2:sclick:1: {
  if ($did(4).state == 1) { .enable #groupautoxdccresume }
  else { .disable #groupautoxdccresume }
  if ($did(5).state == 1) { .enable #groupautoxdccresumejoin }
  else { .disable #groupautoxdccresumejoin }
  if ($did(6).state == 1) { .enable #groupautoxdccq }
  else { .disable #groupautoxdccq }
  if ($did(9).state == 1) { .enable #groupnonewconnects }
  else { .disable #groupnonewconnects }
  if ($did(10).state == 1) { .enable #groupautojoinxdcc }
  else { .disable #groupautojoinxdcc }
  if ($did(11).state == 1) { .enable #groupautoremove }
  else { .disable #groupautoremove }
  if ($did(14).state == 1) { .enable #grouptrackqueuepos }
  else { .disable #grouptrackqueuepos }
  if ($did(16).state == 1) { .enable #groupautosendresume }
  else { .disable #groupautosendresume }
  if ($did(8).state == 1) {
    .enable #groupautoresumeatstart
    .enable #groupautoresumestart
  }
  else { 
    .disable #groupautoresumeatstart
    .disable #groupautoresumestart
  }
  if ($did(13).state == 1) { 
    set %comparepacks on
    .enable #grouppackchangedetect
  }
  else { 
    set %comparepacks off
    .disable #grouppackchangedetect
  }
  if ($did(7).state == 1) { set %botqueuehandling on }
  else { set %botqueuehandling off }
  if ($did(15).state == 1) { set %autocleanatstart on }
  else { set %autocleanatstart off }
  if ($did(12).state == 1) { set %clearallqueuesoncomplete on }
  else { set %clearallqueuesoncomplete off }
  if ($did(20).state == 1) { set testnumoftransferspeed on }
  else { set testnumoftransferspeed off }

  if ($did(18).text isnum) { set %sendlimit $did(18).text }
  else { set %sendlimit Unlimited }
  /xdccmanualwizard3
}
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard2:sclick:2: { 
  /outputxdccinfo 14Wizard manual configuration setup 4aborted14 during general settings, using default values for all settings. 
  /outputxdccinfo 
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias xdccmanualwizard2 { /dialog -m xdccmanualwizard2 xdccmanualwizard2 }
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------









;-------------------------------------------------------------------------
; /dialog xdccmanualwizard3:
; 2 checkboxes, 4 radiobuttons, 1 ok button, 1 cancel button.
; 2nd manual setup window. Sets the window output for the script, and the 
; debug logging.
;-------------------------------------------------------------------------
dialog xdccmanualwizard3 {
  title "XDCC Script Manual Wizard: Output Settings"
  size -1 -1 480 290
  button "Next", 1, 125 250 100 25, ok
  button "Cancel", 2, 245 250 100 25, cancel
  text "Where do you want the script's messages to go?", 3, 20 40 300 15
  radio "Write messages to separate XDCC_Info window", 4, 25 60 300 15, group
  radio "Write messages to server status window", 5, 25 80 300 15
  radio "Write messages to the currently active window", 6, 25 100 300 15
  radio "Write messages to the currently active window and the separate XDCC_Info window", 7, 25 120 430 15
  check "Show a list of all known bots in the separate XDCC_Info window", 8, 25 160 400 15

  check "Write a debugging Log file", 9, 25 210 400 15

  box "Window Options:", 11, 15 20 450 170
  box "Log file Options:", 12, 15 190 450 50
  box "Output Options:", 13, 5 5 470 280
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------

;-------------------------------------------------------------------------
; Remote identifiers for /dialog xdccmanualwizard3:
; init: Selects default features.
; sclick 2: Cancel.
; sclick 1: Sets window variables, then continues the wizard with /dialog 
;           xdccmanualwizard3.
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard3:init:*: { /did -c xdccmanualwizard3 4 }
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard3:sclick:1: {
  if ($did(4).state == 1) { set %infochoise special window }
  elseif ($did(5).state == 1) { set %infochoise server status window }
  elseif ($did(6).state == 1) { set %infochoise active window }
  elseif ($did(7).state == 1) { set %infochoise both active and special windows }

  if ($did(8).state == 1) { set %showbotlist ON }
  else { set %showbotlist off }
  if ($did(9).state == 1) { set %debugxdccinfo on }
  else { set %debugxdccinfo off }
  /xdccmanualwizard4
}
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard3:sclick:2: { 
  /outputxdccinfo 14Wizard manual configuration setup 4aborted14 during window settings, using default values for remaining settings. 
  /outputxdccinfo 
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias xdccmanualwizard3 { /dialog -m xdccmanualwizard3 xdccmanualwizard3 }
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------





;-------------------------------------------------------------------------
; /dialog xdccmanualwizard4:
; 13 editboxes, 4 buttons, 1 ok button, 1 cancel button.
; 4th manual setup window. Sets the filename and directory settings, and 
; the DCCALLOW and Channel Key options. 
;-------------------------------------------------------------------------
dialog xdccmanualwizard4 {
  title "XDCC Script Manual Wizard: Filename Settings"
  size -1 -1 500 500
  button "Finish", 1, 127 465 120 25, ok
  button "Cancel", 2, 253 465 120 25, cancel
  box "File settings:", 3, 5 5 490 110

  button "Choose Script Directory", 17, 175 50 230 25
  button "Add Channel Key", 18, 20 140 110 25
  button "Add DCCALLOW Net", 19, 255 140 105 25
  button "Delete Channel Key", 20, 135 140 110 25
  button "Delete DCCALLOW Net", 21, 365 140 120 25

  text "Default XDCC dir: XDCC\", 23, 27 55 135 15
  box "Miscelaneous Options: ", 37, 5 117 490 330
  list 38, 17 170 230 280
  list 39, 255 170 230 280
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------

;-------------------------------------------------------------------------
; Remote identifiers for /dialog xdccmanualwizard4:
; sclick 17: Sets future XDCC dir (does not set %XDCCdir yet). 
; sclick 18: Add channel/key pair to the list (doesn't write to file yet).
; sclick 19: Add network to the list (doesn't write to file yet).
; sclick 20: Del channel/key pair from list.
; sclick 21: Del network from list.
; sclick 2: Cancel.
; sclick 1: Sets filename variables, directory variable, and adds DCCALLOW
;           networks to $dccallownetworkfile, and channel/key pairs to
;           $chankeyfile. Wizard is finished.
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard4:sclick:17: { set %wiznewdir $sdir($xdccdir,Choose main XDCC script directory:) }
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard4:sclick:18: {
  var %chankey = $?="Please input network, channel and required key separated by a space (E.g.: EFnet #channel 1337key)."
  if ($numtok(%chankey, 32) >= 3) { /did -a xdccmanualwizard4 38 %chankey }
}
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard4:sclick:19: {
  var %networks = $?="Please input networks that should support DCCALLOW options, separated by a space (E.g.: DALnet EFnet irchighway). Do not add networks that don't use DCCALLOW."
  var %i = 1
  while (%i <= $numtok(%networks, 32)) { 
    /did -a xdccmanualwizard4 39 $gettok(%networks, %i, 32) 
    inc %i
  }
}
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard4:sclick:20: { /did -d xdccmanualwizard4 38 $did(38).sel }
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard4:sclick:21: { /did -d xdccmanualwizard4 39 $did(39).sel }
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard4:sclick:1: { 
  if (%wiznewdir != $null && $isdir(%newdir)) {
    set %XDCCdir $replxdccdir(%wiznewdir) 
    unset %wiznewdir
  }

  var %i = 1
  while (%i <= $did(38).lines) {
    if ($read($chankeyfile,snt,$gettok($did(38,%i).text, 1, 32))) { /write -l $+ $readn $chankeyfile $did(38,%i).text }
    else { /write -a $chankeyfile $did(38,%i).text }
    inc %i
  }
  var %i = 1
  while (%i <= $did(39).lines) {
    if ($exists($dccallownetworkfile) && $read($dccallownetworkfile,wnt,$did(39,%i).text)) { /write -l $+ $readn $dccallownetworkfile $did(39,%i).text }
    else { /write -a $dccallownetworkfile $did(39,%i).text }
    inc %i
  }
  /outputxdccinfo 14Wizard manual configuration setup successfully completed. You may need to restart your IRC to get all features to fully function. 
  /outputxdccinfo 
}
;-------------------------------------------------------------------------
on *:dialog:xdccmanualwizard4:sclick:2: { 
  /outputxdccinfo 14Wizard manual configuration setup 4aborted14 during directory & special chan/network settings, using default values for remaining settings. 
  /outputxdccinfo 
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias xdccmanualwizard4 { /dialog -m xdccmanualwizard4 xdccmanualwizard4 }
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------









;-------------------------------------------------------------------------
; /dialog xdccbrowsebots:
; Contains lists for networks, channels, bots, packs, xdcc queues and the
; botqueue, and manipulates the queues. This way you can browse all known
; XDCC packs.
;-------------------------------------------------------------------------
dialog xdccbrowsebots {
  title "VisualQ"
  size -1 -1 800 590
  button "OK", 1, 350 555 100 25, ok
  button "Add To Queue >>", 30, 395 360 130 25
  button "<< Remove From Queue", 31, 540 360 130 25
  button "Add Bot Queue >>", 32, 110 355 130 25
  button "Remove Bot Queue <<", 33, 110 390 130 25
  button "MOVE UP", 34, 305 360 80 25
  button "MOVE DOWN", 35, 680 360 80 25

  list 3, 5 45 100 180, sort
  list 4, 5 240 100 310, sort
  list 5, 110 45 130 310, sort, extsel
  list 8, 110 422 130 140, extsel
  list 6, 245 45 550 310, extsel
  list 7, 245 395 550 165, extsel
  text "Choose Network:", 20, 15 25 90 15
  text "Choose Channel:", 21, 15 225 90 15
  text "Choose Bot:", 22, 135 25 100 15
  text "Packs:", 23, 255 25 80 15
  text "Queues:", 24, 255 370 45 15  
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------


;-------------------------------------------------------------------------
; Remote identifiers for /dialog xdccbrowsebots:
; init: Adds all networks to the first list in the browser, and all 
;       botqueues to the sixth list.
; sclick 1: OK, Frees all hash tables and exists program.
; sclick 3: Adds all channels for selected network to the second list in 
;           the browser.
; sclick 4: Adds all nicks for selected channel to the third list in the 
;           browser.
; sclick 5: Adds all packs for selected bot/network to the fourth list in 
;           the browser, and all queues for that pair to the fifth list.
; dclick 8: Adds all packs for selected bot in botqueue to the fourth list 
;           in the browser, and all queues for that bot to the fifth list.
; sclick 30: Adds all selected packs to selected bot's queue and reloads 
;            the queue list.
; sclick 31: Removes all selected queues from selected bot's queue and 
;            reloads the queue list.
; sclick 32: Adds the selected bot to the botqueue and reloads the bot 
;            queue list.
; sclick 33: Removes the selected bot from the botqueue and reloads the 
;            bot queue list.
; sclick 34: Moves the selected xdcc queue item up in the queue.
; sclick 35: Moves the selected xdcc queue item down in the queue.
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:init:*:{
  var %u = 1
  while (%u <= $hget(xdccBrowserHash,0).item) {
    if ($gettok($hget(xdccBrowserHash,network),%u,32) != $null) { /did -a xdccbrowsebots 3 $gettok($hget(xdccBrowserHash,network),%u,32) }
    inc %u 
  }
  var %u = 1
  while (%u <= $lines($botqueuefile)) {
    if ($read($botqueuefile, nt, %u) != $null) { /did -a xdccbrowsebots 8 $read($botqueuefile, nt, %u) }
    inc %u 
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:sclick:3:{
  var %additems = $hget(xdccBrowserHash,$did(xdccbrowsebots,3).seltext)
  /did -r xdccbrowsebots 4,5,6,7
  var %u = 1
  while (%u <= $numtok(%additems,32)) {
    if ($gettok(%additems,%u,32) != $null) { //did -a xdccbrowsebots 4 $gettok(%additems,%u,32) }
    inc %u 
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:sclick:4:{
  var %additems = $remove($did(xdccbrowsebots,4).seltext,$chr(35))
  /did -r xdccbrowsebots 5,6,7
  var %u 1
  while (%u <= $hget(%additems,0).item) {
    if ($hget(%additems,%u).item != $null) { //did -a xdccbrowsebots 5 $hget(%additems,%u).item }
    inc %u 
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:sclick:5:{
  var %additems = $getpfffilenm($did(xdccbrowsebots,3).seltext, $did(xdccbrowsebots,5).seltext)
  /did -r xdccbrowsebots 6
  var %u = 1
  while (%u <= $lines(%additems)) {
    if ($strip($read(%additems,%u),burc) != $null) { //did -a xdccbrowsebots 6 $strip($read(%additems,%u),burc) }
    inc %u 
  }

  var %additems = $getpfffilenm($did(xdccbrowsebots,3).seltext, $did(xdccbrowsebots,5).seltext)
  /did -r xdccbrowsebots 7
  var %u = 1
  while (%u <= $lines(%additems)) {
    if ($strip($read(%additems,snt,$read($getpfftoqfilenm(%additems),nt,%u)),burc) != $null) { //did -a xdccbrowsebots 7 $read($getpfftoqfilenm(%additems),nt,%u) $strip($read(%additems,snt,$read($getpfftoqfilenm(%additems),nt,%u)),burc) }
    inc %u 
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:dclick:8:{
  var %botnetwork = $triggerHash.network($did(xdccbrowsebots,8).seltext)
  var %botchan = $triggerHash.getChan(%botnetwork, $did(xdccbrowsebots,8).seltext)

  /did -c xdccbrowsebots 3 $didwm(xdccbrowsebots,3,%botnetwork)
  var %additems = $hget(xdccBrowserHash,$did(xdccbrowsebots,3).seltext)
  /did -r xdccbrowsebots 4
  var %u = 1
  while (%u <= $numtok(%additems,32)) {
    if ($gettok(%additems,%u,32) != $null) { //did -a xdccbrowsebots 4 $gettok(%additems,%u,32) }
    inc %u 
  }

  /did -c xdccbrowsebots 4 $didwm(xdccbrowsebots,4,%botchan)

  var %additems = $remove(%botchan,$chr(35))
  /did -r xdccbrowsebots 5
  var %u = 1
  while (%u <= $hget(%additems).size) {
    if ($hget(%additems,%u).item != $null) { //did -a xdccbrowsebots 5 $hget(%additems,%u).item }
    inc %u 
  }

  /did -c xdccbrowsebots 5 $didwm(xdccbrowsebots,5,$did(xdccbrowsebots,8).seltext)

  var %additems = $getpfffilenm(%botnetwork, $did(xdccbrowsebots,8).seltext)
  /did -r xdccbrowsebots 6
  var %u = 1
  while (%u <= $lines(%additems)) {
    if ($read(%additems,%u) != $null) { //did -a xdccbrowsebots 6 $strip($read(%additems,%u),burc) }
    inc %u 
  }

  var %additems = $getpfffilenm(%botnetwork, $did(xdccbrowsebots,8).seltext)
  /did -r xdccbrowsebots 7
  var %u = 1
  while (%u <= $lines($replace(%additems,.pff,.q))) {
    if ($read(%additems,snt,$read($replace(%additems,.pff,.q),nt,%u)) != $null) { //did -a xdccbrowsebots 7 $read($replace(%additems,.pff,.q),nt,%u) $strip($read(%additems,snt,$read($replace(%additems,.pff,.q),nt,%u)),burc) }
    inc %u 
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:sclick:30:{
  var %botnetwork = $did(xdccbrowsebots,3).seltext
  var %botnick = $did(xdccbrowsebots,5).seltext

  var %u = 1
  while (%u <= $did(xdccbrowsebots,6,0).sel) {
    if (!$read($getqfilenm(%botnetwork, %botnick), wnt, $gettok($did(xdccbrowsebots,6,$did(xdccbrowsebots,6,%u).sel).text,1,32))) { //write -a $getqfilenm(%botnetwork, %botnick) $gettok($did(xdccbrowsebots,6,$did(xdccbrowsebots,6,%u).sel).text,1,32) }
    inc %u
  }
  /did -r xdccbrowsebots 7
  var %u = 1
  while (%u <= $lines($getqfilenm(%botnetwork, %botnick))) {
    if ($read($getpfffilenm(%botnetwork, %botnick),snt,$read($getqfilenm(%botnetwork, %botnick),nt,%u)) != $null) { //did -a xdccbrowsebots 7 $read($getqfilenm(%botnetwork, %botnick),nt,%u) $strip($read($getpfffilenm(%botnetwork, %botnick),snt,$read($getqfilenm(%botnetwork, %botnick),nt,%u)),burc) }
    inc %u 
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:sclick:31:{
  var %botnetwork = $did(xdccbrowsebots,3).seltext
  var %botnick = $did(xdccbrowsebots,5).seltext

  var %u = 1
  while (%u <= $did(xdccbrowsebots,7,0).sel) {
    if ($read($getqfilenm(%botnetwork, %botnick), wnt, $gettok($did(xdccbrowsebots,7,$did(xdccbrowsebots,7, %u).sel).text,1,32))) { /write -dw" $+ $gettok($did(xdccbrowsebots,7,$did(xdccbrowsebots,7,%u).sel).text,1,32) $+ " $getqfilenm(%botnetwork, %botnick) }
    inc %u
  }
  if ($lines($getqfilenm(%botnetwork, %botnick)) < 1) { .remove $getqfilenm(%botnetwork, %botnick) }

  /did -r xdccbrowsebots 7
  var %u = 1
  while (%u <= $lines($getqfilenm(%botnetwork, %botnick))) {
    if ($read($getpfffilenm(%botnetwork, %botnick),snt,$read($getqfilenm(%botnetwork, %botnick),nt,%u)) != $null) { //did -a xdccbrowsebots 7 $read($getqfilenm(%botnetwork, %botnick),nt,%u) $strip($read($getpfffilenm(%botnetwork, %botnick),snt,$read($getqfilenm(%botnetwork, %botnick),nt,%u)),burc) }
    inc %u 
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:sclick:32:{
  var %u = 1
  while (%u <= $did(xdccbrowsebots,5,0).sel) {
    if (!$read($botqueuefile, wnt, $did(xdccbrowsebots,5,$did(xdccbrowsebots,5,%u).sel).text)) { //write -a $botqueuefile $did(xdccbrowsebots,5,$did(xdccbrowsebots,5,%u).sel).text }
    inc %u
  }
  /did -r xdccbrowsebots 8
  var %u = 1
  while (%u <= $lines($botqueuefile)) {
    if ($read($botqueuefile, nt, %u) != $null) { /did -a xdccbrowsebots 8 $read($botqueuefile, nt, %u) }
    inc %u 
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:sclick:33:{
  var %u = 1
  while (%u <= $did(xdccbrowsebots,8,0).sel) {
    if ($read($botqueuefile, wnt, $gettok($did(xdccbrowsebots,8,$did(xdccbrowsebots,8, %u).sel).text,1,32))) { /write -dw" $+ $gettok($did(xdccbrowsebots,8,$did(xdccbrowsebots,8,%u).sel).text,1,32) $+ " $botqueuefile }
    inc %u
  }
  if ($lines($botqueuefile) < 1) { .remove $botqueuefile }

  /did -r xdccbrowsebots 8
  var %u = 1
  while (%u <= $lines($botqueuefile)) {
    if ($read($botqueuefile, nt, %u) != $null) { /did -a xdccbrowsebots 8 $read($botqueuefile, nt, %u) }
    inc %u 
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:sclick:34:{
  if ($did(xdccbrowsebots,7,$calc($did(xdccbrowsebots,7,1).sel - 1)).text != $null) {
    var %botnetwork = $did(xdccbrowsebots,3).seltext
    var %botnick = $did(xdccbrowsebots,5).seltext
    var %aline = $did(xdccbrowsebots,7,$calc($did(xdccbrowsebots,7,1).sel - 1)).text
    var %bline = $did(xdccbrowsebots,7,1).seltext 
    //write -l $+ $calc($did(xdccbrowsebots,7,1).sel - 1) $getqfilenm(%botnetwork, %botnick) $gettok(%bline,1,32)
    //write -l $+ $did(xdccbrowsebots,7,1).sel $getqfilenm(%botnetwork, %botnick) $gettok(%aline,1,32)
    /did -r xdccbrowsebots 7
    var %u = 1
    while (%u <= $lines($getqfilenm(%botnetwork, %botnick))) {
      if ($read($getpfffilenm(%botnetwork, %botnick),snt,$read($getqfilenm(%botnetwork, %botnick),nt,%u)) != $null) { //did -a xdccbrowsebots 7 $read($getqfilenm(%botnetwork, %botnick),nt,%u) $strip($read($getpfffilenm(%botnetwork, %botnick),snt,$read($getqfilenm(%botnetwork, %botnick),nt,%u)),burc) }
      inc %u 
    }
    /did -c xdccbrowsebots 7 $didwm(xdccbrowsebots,7,%bline)
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:sclick:35:{
  if ($did(xdccbrowsebots,7,$calc($did(xdccbrowsebots,7,1).sel + 1)).text) {
    var %botnetwork = $did(xdccbrowsebots,3).seltext
    var %botnick = $did(xdccbrowsebots,5).seltext
    var %aline = $did(xdccbrowsebots,7,$calc($did(xdccbrowsebots,7,1).sel + 1)).text
    var %bline = $did(xdccbrowsebots,7,1).seltext 
    //write -l $+ $calc($did(xdccbrowsebots,7,1).sel + 1) $getqfilenm(%botnetwork, %botnick) $gettok(%bline,1,32)
    //write -l $+ $did(xdccbrowsebots,7,1).sel $getqfilenm(%botnetwork, %botnick) $gettok(%aline,1,32)

    /did -r xdccbrowsebots 7
    var %u = 1
    while (%u <= $lines($getqfilenm(%botnetwork, %botnick))) {
      if ($read($getpfffilenm(%botnetwork, %botnick),snt,$read($getqfilenm(%botnetwork, %botnick),nt,%u)) != $null) { //did -a xdccbrowsebots 7 $read($getqfilenm(%botnetwork, %botnick),nt,%u) $strip($read($getpfffilenm(%botnetwork, %botnick),snt,$read($getqfilenm(%botnetwork, %botnick),nt,%u)),burc) }
      inc %u 
    }
    /did -c xdccbrowsebots 7 $didwm(xdccbrowsebots,7,%bline)
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccbrowsebots:sclick:1:{
  var %u = 1
  /hfree xdccBrowserHash 
  while (%u <= $triggerHash.items) {
    if ($hget($remove($triggerHash.item.chan(%u),$chr(35))) != $null) { //hfree $remove($triggerHash.item.chan(%u),$chr(35)) }
    inc %u
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------


;-------------------------------------------------------------------------
; /xdccBrowserHash:
; Creates a number of hash tables (one for every channel, containing 
; appropriate nicknames, plus one that lists networks and their 
; appropriate channels).
;-------------------------------------------------------------------------
alias xdccBrowserHash {
  var %u = 1
  while (%u <= $triggerHash.items) {
    if ($triggerHash.item.network(%u) !isin $hget(xdccBrowserHash,network)) { /hadd -m xdccBrowserHash network $hget(xdccBrowserHash,network) $triggerHash.item.network(%u) }
    if ($triggerHash.item.chan(%u) !isin $hget(xdccBrowserHash,$triggerHash.item.network(%u))) { /hadd -m xdccBrowserHash $triggerHash.item.network(%u) $hget(xdccBrowserHash,$triggerHash.item.network(%u)) $triggerHash.item.chan(%u) }
    if ($hget($remove($triggerHash.item.chan(%u),$chr(35)), $triggerHash.item.nick(%u)) == $null) { //hadd -m $remove($triggerHash.item.chan(%u),$chr(35)) $triggerHash.item.nick(%u) $triggerHash.item.nick(%u) $getpfffilenm($triggerHash.item.network(%u),$triggerHash.item.nick(%u)) }
    inc %u
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------


;-------------------------------------------------------------------------
; /xdccbrowsebots:
; Creates the necessary hash tables and starts the VisualQ pack browser.
;-------------------------------------------------------------------------
alias xdccbrowsebots { 
  /xdccBrowserHash
  /dialog -m xdccbrowsebots xdccbrowsebots 
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------







;-------------------------------------------------------------------------
; /dialog xdccconnectatstart:
; Auto Network Connect options.
;-------------------------------------------------------------------------
dialog xdccconnectatstart {
  title "Network Auto Connection List"
  size -1 -1 400 600
  button "OK", 1, 165 570 100 25, ok

  list 10, 15 25 135 560, sort, extsel
  list 11, 250 85 135 420, extsel

  text "Available Networks:", 20, 30 10 305 15
  text "Current Auto-Connect list:", 21, 188 10 305 15

  button "Add >>", 30, 160 233 75 25, tab 9
  button "<< Remove", 31, 160 263 75 25, tab 9
  button "UP", 32, 250 500 135 25, tab 9
  button "DOWN", 33, 250 530 135 25, tab 9

  check "Use the list below to auto connect", 40, 190 30 210 20
  check "Join all networks with waiting transfers", 41, 190 55 210 20
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccconnectatstart:init:*: { 
  var %i = 1
  while (%i <= $networksTable.items) {
    /did -a xdccconnectatstart 10 $networksTable.item(%i)
    inc %i
  }
  var %i = 1
  while (%i <= $lines($autoconnectfile)) {
    /did -a xdccconnectatstart 11 $read($autoconnectfile,nt,%i)
    inc %i
  }

  if ($connectnetsatstart == on) { /did -c xdccconnectatstart 40 }
  if ($connectxdccnetsatstart == on) { /did -c xdccconnectatstart 41 }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccconnectatstart:dclick:10: {
  if (!$didwm(xdccconnectatstart,11,$did(xdccconnectatstart,10).seltext)) { 
    /did -a xdccconnectatstart 11 $did(xdccconnectatstart,10).seltext 
    /write -a $autoconnectfile $did(xdccconnectatstart,10).seltext
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccconnectatstart:dclick:11: {  
  /write -dw" $+ $did(xdccconnectatstart,11).seltext $+ " $autoconnectfile 
  /did -d xdccconnectatstart 11 $did(xdccconnectatstart,11).sel
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccconnectatstart:sclick:30: {
  if (!$didwm(xdccconnectatstart,11,$did(xdccconnectatstart,10).seltext)) { 
    /did -a xdccconnectatstart 11 $did(xdccconnectatstart,10).seltext 
    /write -a $autoconnectfile $did(xdccconnectatstart,10).seltext
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccconnectatstart:sclick:31: {  
  /write -dw" $+ $did(xdccconnectatstart,11).seltext $+ " $autoconnectfile 
  /did -d xdccconnectatstart 11 $did(xdccconnectatstart,11).sel
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccconnectatstart:sclick:32: {
  if ($did(xdccconnectatstart,11,$calc($did(xdccconnectatstart,11,1).sel - 1)).text != $null) {
    var %aline = $did(xdccconnectatstart,11,$calc($did(xdccconnectatstart,11,1).sel - 1)).text
    var %bline = $did(xdccconnectatstart,11,1).seltext 

    //write -l $+ $calc($did(xdccconnectatstart,11,1).sel - 1) $autoconnectfile %bline
    //write -l $+ $did(xdccconnectatstart,11,1).sel $autoconnectfile %aline

    /did -r xdccconnectatstart 11
    var %i = 1
    while (%i <= $lines($autoconnectfile)) {
      /did -a xdccconnectatstart 11 $read($autoconnectfile,nt,%i)
      inc %i
    }
    /did -c xdccconnectatstart 11 $didwm(xdccconnectatstart,11,%bline)
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:xdccconnectatstart:sclick:33: {  
  if ($did(xdccconnectatstart,11,$calc($did(xdccconnectatstart,11,1).sel + 1)).text) {
    var %aline = $did(xdccconnectatstart,11,$calc($did(xdccconnectatstart,11,1).sel + 1)).text
    var %bline = $did(xdccconnectatstart,11,1).seltext 
    //write -l $+ $calc($did(xdccconnectatstart,11,1).sel + 1) $autoconnectfile %bline
    //write -l $+ $did(xdccconnectatstart,11,1).sel $autoconnectfile %aline

    /did -r xdccconnectatstart 11
    var %i = 1
    while (%i <= $lines($autoconnectfile)) {
      /did -a xdccconnectatstart 11 $read($autoconnectfile,nt,%i)
      inc %i
    }

    /did -c xdccconnectatstart 11 $didwm(xdccconnectatstart,11,%bline)
  }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:xdccconnectatstart:sclick:1:{
  if ($did(xdccconnectatstart,40).state = 1) { set %connectnetsatstart on }
  else { set %connectnetsatstart off }
  if ($did(xdccconnectatstart,41).state = 1) { set %connectxdccnetsatstart on }
  else { set %connectxdccnetsatstart off }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------


;-------------------------------------------------------------------------
; /xdccconnectatstart:
; Starts the network auto connect options dialog.
;-------------------------------------------------------------------------
alias xdccconnectatstart {
  dialog -m xdccconnectatstart xdccconnectatstart 
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------










;-------------------------------------------------------------------------
; /dialog transferstatsdialog:
; Current transfer speeds.
;-------------------------------------------------------------------------
dialog transferstatsdialog {
  title "Current Transfers"
  size -1 -1 645 480
  button "OK", 1, 205 450 100 25, ok
  button "Reload", 2, 325 450 100 25

  tab "Transfers", 4, 3 3 640 444
  tab "Complete", 5
  tab "Failed", 6
  ;tab "Currently Active", 7

  list 110, 15 55 615 195, sort, hsbar, tab 4
  list 111, 15 255 615 195, sort, hsbar, tab 4
  text "Current Downloads:", 120, 10 35 205 15, tab 4
  text "Current Uploads:", 121, 10 235 205 15, tab 4
  text "Nr. of D/Ls: 0 Total Speed: 0", 122, 110 35 465 15, tab 4
  text "Nr. of U/Ls: 0 Total Speed: 0", 123, 110 235 465 15, tab 4

  list 210, 15 55 615 195, hsbar, tab 5
  list 211, 15 255 615 195, hsbar, tab 5
  text "Completed Downloads:", 220, 10 35 205 15, tab 5
  text "Completed Uploads:", 221, 10 235 205 15, tab 5
  text "[Files / Size]", 222, 440 33 155 15, tab 5
  text "[Files / Size]", 223, 440 235 155 15, tab 5
  radio "This session", 230, 130 30 90 20, tab5, group
  radio "Previous session", 231, 220 30 110 20, tab5
  radio "Both", 232, 330 30 40 20, tab5
  radio "All", 233, 390 30 30 20, tab5
  radio "This session", 234, 130 232 90 20, tab5, group
  radio "Previous session", 235, 220 232 110 20, tab5
  radio "Both", 236, 330 232 40 20, tab5
  radio "All", 237, 390 232 30 20, tab5

  list 310, 15 55 615 195, hsbar, tab 6
  list 311, 15 255 615 195, hsbar, tab 6
  text "Failed Downloads:", 320, 10 35 205 15, tab 6
  text "Failed Uploads:", 321, 10 235 205 15, tab 6  
  text "[Files / Size]", 322, 440 33 155 15, tab 6
  text "[Files / Size]", 323, 440 235 155 15, tab 6
  radio "This session", 330, 130 30 90 20, tab 6, group
  radio "Previous session", 331, 220 30 110 20, tab 6
  radio "Both", 332, 330 30 40 20, tab 6
  radio "All", 333, 390 30 30 20, tab6
  radio "This session", 334, 130 232 90 20, tab 6, group
  radio "Previous session", 335, 220 232 110 20, tab 6
  radio "Both", 336, 330 232 40 20, tab 6
  radio "All", 337, 390 232 30 20, tab6
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------


;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on *:dialog:transferstatsdialog:init:*: { 
  /transferstatsdialogupdate
  .timertransferstatsdialogupdate 0 3 /transferstatsdialogupdate
  /did -c transferstatsdialog 233
  /did -c transferstatsdialog 237
  /did -c transferstatsdialog 333
  /did -c transferstatsdialog 337
  /totGetsDialog 
  /totSendsDialog 
  /totGetFailDialog 
  /totSendFailDialog 
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------


;-------------------------------------------------------------------------
; Shut down stats update timer on exit.
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:1:{
  .timertransferstatsdialogupdate off
}
on 1:dialog:transferstatsdialog:close:*:{
  .timertransferstatsdialogupdate off
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------


;-------------------------------------------------------------------------
; Reload the complete/failed file transfer stats.
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:2:{ 
  /sessionGetsDialog
  if ($did(230).state == 1) { /sessionGetsDialog }
  elseif ($did(231).state == 1) { /lastGetsDialog }
  elseif ($did(232).state == 1) { /bothGetsDialog }
  elseif ($did(233).state == 1) { /totGetsDialog }
  if ($did(234).state == 1) { /sessionSendsDialog }
  elseif ($did(235).state == 1) { /lastSendsDialog }
  elseif ($did(236).state == 1) { /bothSendsDialog }
  elseif ($did(237).state == 1) { /totSendsDialog }
  if ($did(330).state == 1) { /sessionGetFailDialog }
  elseif ($did(331).state == 1) { /lastGetFailDialog }
  elseif ($did(332).state == 1) { /bothGetFailDialog }
  elseif ($did(333).state == 1) { /totGetFailDialog }
  if ($did(334).state == 1) { /sessionSendFailDialog }
  elseif ($did(335).state == 1) { /lastSendFailDialog }
  elseif ($did(336).state == 1) { /bothSendFailDialog }
  elseif ($did(337).state == 1) { /totSendFailDialog }
}
;-------------------------------------------------------------------------


;-------------------------------------------------------------------------
; Processing radio buttons:
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:230:{ /sessionGetsDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:231:{ /lastGetsDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:232:{ /bothGetsDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:233:{ /totGetsDialog }
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:234:{ /sessionSendsDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:235:{ /lastSendsDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:236:{ /bothSendsDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:237:{ /totSendsDialog }
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:330:{ /sessionGetFailDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:331:{ /lastGetFailDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:332:{ /bothGetFailDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:333:{ /totGetFailDialog }
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:334:{ /sessionSendFailDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:335:{ /lastSendFailDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:336:{ /bothSendFailDialog }
;-------------------------------------------------------------------------
on 1:dialog:transferstatsdialog:sclick:337:{ /totSendFailDialog }
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------



;-------------------------------------------------------------------------
; /transferstatsdialog:
; Starts the statistics dialog.
;-------------------------------------------------------------------------
alias transferstatsdialog {
  dialog -m transferstatsdialog transferstatsdialog
  /did -z transferstatsdialog 210
  /did -z transferstatsdialog 211
  /did -z transferstatsdialog 310
  /did -z transferstatsdialog 311
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------

;-------------------------------------------------------------------------
; Update the stats dialog.
;-------------------------------------------------------------------------
alias transferstatsdialogupdate {
  /did -r transferstatsdialog 110
  /did -r transferstatsdialog 111
  var %i = 1
  var %totdlspd = 0
  var %totdlsize = 0
  var %totrcvdsize = 0
  while (%i <= $get(0)) {
    if ($get(%i).status == active) { /did -a transferstatsdialog 110 $get(%i).status $+ : $get(%i) - $get(%i).file >> $chr(91) $+ $getnormfilesize($get(%i).rcvd) / $getnormfilesize($get(%i).size) $+ $chr(93) $+ $chr(40) $+ $get(%i).pc $+ $chr(37) $+ $chr(41) @ $getnormfilesize($get(%i).cps) $+ /s }
    else { /did -a transferstatsdialog 110 $get(%i).status $+ : $get(%i) - $get(%i).file >> $chr(91) $+ $getnormfilesize($get(%i).rcvd) / $getnormfilesize($get(%i).size) $+ $chr(93) $+ $chr(40) $+ $get(%i).pc $+ $chr(37) $+ $chr(41) @ 0 KB/s }
    set %totdlspd $calc(%totdlspd + $get(%i).cps)
    set %totdlsize $calc(%totdlsize + $get(%i).size)
    set %totrcvdsize $calc(%totrcvdsize + $get(%i).rcvd)
    inc %i
  }
  var %numdls = $get(0)
  set %totdlspd $getnormfilesize(%totdlspd)
  var %totdlpc = $round($calc($calc(%totrcvdsize / %totdlsize) * 100),2)
  //did -a transferstatsdialog 122 Nr. of D/Ls: %numdls // Received: $getnormfilesize(%totrcvdsize) / $getnormfilesize(%totdlsize) $chr(40) $+ %totdlpc $+ $chr(37) $+ $chr(41) // Total Speed %totdlspd $+ /s

  var %i = 1
  var %totulspd = 0
  var %totulsize = 0
  var %totsentsize = 0
  while (%i <= $send(0)) {
    if ($send(%i).status == active) { /did -a transferstatsdialog 111 $send(%i).status $+ : $send(%i) - $send(%i).file >> $chr(91) $+ $getnormfilesize($send(%i).sent) / $getnormfilesize($send(%i).size) $+ $chr(93) $+ $chr(40) $+ $send(%i).pc $+ $chr(37) $+ $chr(41) @ $getnormfilesize($send(%i).cps) $+ /s }
    else { /did -a transferstatsdialog 111 $send(%i).status $+ : $send(%i) - $send(%i).file >> $chr(91) $+ $getnormfilesize($send(%i).sent) / $getnormfilesize($send(%i).size) $+ $chr(93) $+ $chr(40) $+ $send(%i).pc $+ $chr(37) $+ $chr(41) @ 0 KB/s }
    set %totulspd $calc(%totulspd + $send(%i).cps)
    set %totulsize $calc(%totulsize + $send(%i).size)
    set %totsentsize $calc(%totsentsize + $send(%i).sent)
    inc %i
  }
  var %numuls = $send(0)
  set %totulspd $getnormfilesize(%totulspd)
  var %totulpc = $round($calc($calc(%totsentsize / %totulsize) * 100),2)
  //did -a transferstatsdialog 123 Nr. of U/Ls: %numuls // Sent: $getnormfilesize(%totsentsize) / $getnormfilesize(%totulsize) $chr(40) $+ %totulpc $+ $chr(37) $+ $chr(41) // Total Speed: %totulspd $+ /s
  /did -z transferstatsdialog 110
  /did -z transferstatsdialog 111
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------



;-------------------------------------------------------------------------
; Aliases to load the proper file list.
;-------------------------------------------------------------------------
alias totGetsDialog {
  /did -r transferstatsdialog 210
  var %totgetcmp = 0
  var %i = $lines($xdcctotalgetfile)
  while (%i > 0) {
    /did -a transferstatsdialog 210 $strip($gettok($read($xdcctotalgetfile,nt,%i),$numtok($read($xdcctotalgetfile,nt,%i),32),32) $gettok($read($xdcctotalgetfile,nt,%i),2- $+ $calc($numtok($read($xdcctotalgetfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($xdcctotalgetfile,nt,%i),1,32)))
    set %totgetcmp $calc(%totgetcmp + $gettok($read($xdcctotalgetfile,nt,%i),1,32))
    dec %i
  }
  /did -a transferstatsdialog 222 $chr(91) $+ $lines($xdcctotalgetfile) Files / $getnormfilesize(%totgetcmp) $+ $chr(93)
  /did -z transferstatsdialog 210
}
;-------------------------------------------------------------------------
alias bothGetsDialog {
  /did -r transferstatsdialog 210
  var %totgetcmp = 0
  var %i = $lines($xdccsessiongetfile)
  while (%i > 0) {
    /did -a transferstatsdialog 210 $strip($gettok($read($xdccsessiongetfile,nt,%i),$numtok($read($xdccsessiongetfile,nt,%i),32),32) $gettok($read($xdccsessiongetfile,nt,%i),2- $+ $calc($numtok($read($xdccsessiongetfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($xdccsessiongetfile,nt,%i),1,32)))
    set %totgetcmp $calc(%totgetcmp + $gettok($read($xdccsessiongetfile,nt,%i),1,32))
    dec %i
  }
  var %i = $lines($lastxdccsessiongetfile)
  while (%i > 0) {
    /did -a transferstatsdialog 210 $strip($gettok($read($lastxdccsessiongetfile,nt,%i),$numtok($read($lastxdccsessiongetfile,nt,%i),32),32) $gettok($read($lastxdccsessiongetfile,nt,%i),2- $+ $calc($numtok($read($lastxdccsessiongetfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($lastxdccsessiongetfile,nt,%i),1,32)))
    set %totgetcmp $calc(%totgetcmp + $gettok($read($lastxdccsessiongetfile,nt,%i),1,32))
    dec %i
  }
  /did -a transferstatsdialog 222 $chr(91) $+ $calc($lines($xdccsessiongetfile) + $lines($lastxdccsessiongetfile)) Files / $getnormfilesize(%totgetcmp) $+ $chr(93)
  /did -z transferstatsdialog 210
}
;-------------------------------------------------------------------------
alias lastGetsDialog {
  /did -r transferstatsdialog 210
  var %totgetcmp = 0
  var %i = $lines($lastxdccsessiongetfile)
  while (%i > 0) {
    /did -a transferstatsdialog 210 $strip($gettok($read($lastxdccsessiongetfile,nt,%i),$numtok($read($lastxdccsessiongetfile,nt,%i),32),32) $gettok($read($lastxdccsessiongetfile,nt,%i),2- $+ $calc($numtok($read($lastxdccsessiongetfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($lastxdccsessiongetfile,nt,%i),1,32)))
    set %totgetcmp $calc(%totgetcmp + $gettok($read($lastxdccsessiongetfile,nt,%i),1,32))
    dec %i
  }
  /did -a transferstatsdialog 222 $chr(91) $+ $lines($lastxdccsessiongetfile) Files / $getnormfilesize(%totgetcmp) $+ $chr(93)
  /did -z transferstatsdialog 210
}
;-------------------------------------------------------------------------
alias sessionGetsDialog {
  /did -r transferstatsdialog 210
  var %totgetcmp = 0
  var %i = $lines($xdccsessiongetfile)
  while (%i > 0) {
    /did -a transferstatsdialog 210 $strip($gettok($read($xdccsessiongetfile,nt,%i),$numtok($read($xdccsessiongetfile,nt,%i),32),32) $gettok($read($xdccsessiongetfile,nt,%i),2- $+ $calc($numtok($read($xdccsessiongetfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($xdccsessiongetfile,nt,%i),1,32)))
    set %totgetcmp $calc(%totgetcmp + $gettok($read($xdccsessiongetfile,nt,%i),1,32))
    dec %i
  }
  /did -a transferstatsdialog 222 $chr(91) $+ $lines($xdccsessiongetfile) Files / $getnormfilesize(%totgetcmp) $+ $chr(93)
  /did -z transferstatsdialog 210
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias totSendsDialog {
  /did -r transferstatsdialog 211
  var %totsendcmp = 0
  var %i = $lines($xdcctotalsendfile)
  while (%i > 0) {
    /did -a transferstatsdialog 211 $strip($gettok($read($xdcctotalsendfile,nt,%i),$numtok($read($xdcctotalsendfile,nt,%i),32),32) $gettok($read($xdcctotalsendfile,nt,%i),2- $+ $calc($numtok($read($xdcctotalsendfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($xdcctotalsendfile,nt,%i),1,32)))
    set %totsendcmp $calc(%totsendcmp + $gettok($read($xdcctotalsendfile,nt,%i),1,32))
    dec %i
  }
  /did -a transferstatsdialog 223 $chr(91) $+ $lines($xdcctotalsendfile) Files / $getnormfilesize(%totsendcmp) $+ $chr(93)
  /did -z transferstatsdialog 211
}
;-------------------------------------------------------------------------
alias bothSendsDialog {
  /did -r transferstatsdialog 211
  var %totsendcmp = 0
  var %i = $lines($xdccsessionsendfile)
  while (%i > 0) {
    /did -a transferstatsdialog 211 $strip($gettok($read($xdccsessionsendfile,nt,%i),$numtok($read($xdccsessionsendfile,nt,%i),32),32) $gettok($read($xdccsessionsendfile,nt,%i),2- $+ $calc($numtok($read($xdccsessionsendfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($xdccsessionsendfile,nt,%i),1,32)))
    set %totsendcmp $calc(%totsendcmp + $gettok($read($xdccsessionsendfile,nt,%i),1,32))
    dec %i
  }
  var %i = $lines($lastxdccsessionsendfile)
  while (%i > 0) {
    /did -a transferstatsdialog 211 $strip($gettok($read($lastxdccsessionsendfile,nt,%i),$numtok($read($lastxdccsessionsendfile,nt,%i),32),32) $gettok($read($lastxdccsessionsendfile,nt,%i),2- $+ $calc($numtok($read($lastxdccsessionsendfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($lastxdccsessionsendfile,nt,%i),1,32)))
    set %totsendcmp $calc(%totsendcmp + $gettok($read($lastxdccsessionsendfile,nt,%i),1,32))
    dec %i
  }
  /did -a transferstatsdialog 223 $chr(91) $+ $calc($lines($lastxdccsessionsendfile) + $lines($xdccsessionsendfile)) Files / $getnormfilesize(%totsendcmp) $+ $chr(93)
  /did -z transferstatsdialog 211
}
;-------------------------------------------------------------------------
alias lastSendsDialog {
  /did -r transferstatsdialog 211
  var %totsendcmp = 0
  var %i = $lines($lastxdccsessionsendfile)
  while (%i > 0) {
    /did -a transferstatsdialog 211 $strip($gettok($read($lastxdccsessionsendfile,nt,%i),$numtok($read($lastxdccsessionsendfile,nt,%i),32),32) $gettok($read($lastxdccsessionsendfile,nt,%i),2- $+ $calc($numtok($read($lastxdccsessionsendfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($lastxdccsessionsendfile,nt,%i),1,32)))
    set %totsendcmp $calc(%totsendcmp + $gettok($read($lastxdccsessionsendfile,nt,%i),1,32))
    dec %i
  }
  /did -a transferstatsdialog 223 $chr(91) $+ $lines($lastxdccsessionsendfile) Files / $getnormfilesize(%totsendcmp) $+ $chr(93)
  /did -z transferstatsdialog 211
}
;-------------------------------------------------------------------------
alias sessionSendsDialog {
  /did -r transferstatsdialog 211
  var %totsendcmp = 0
  var %i = $lines($xdccsessionsendfile)
  while (%i > 0) {
    /did -a transferstatsdialog 211 $strip($gettok($read($xdccsessionsendfile,nt,%i),$numtok($read($xdccsessionsendfile,nt,%i),32),32) $gettok($read($xdccsessionsendfile,nt,%i),2- $+ $calc($numtok($read($xdccsessionsendfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($xdccsessionsendfile,nt,%i),1,32)))
    set %totsendcmp $calc(%totsendcmp + $gettok($read($xdccsessionsendfile,nt,%i),1,32))
    dec %i
  }
  /did -a transferstatsdialog 223 $chr(91) $+ $lines($xdccsessionsendfile) Files / $getnormfilesize(%totsendcmp) $+ $chr(93)
  /did -z transferstatsdialog 211
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias totGetFailDialog {
  /did -r transferstatsdialog 310
  var %totgetfail = 0
  var %getfails = 0

  var %i = $lines($totalfailfile)
  while (%i > 0) {
    if ($read($totalfailfile,nt,%i) != $null && $gettok($read($totalfailfile,nt,%i),1,32) == GetFail) {
      /did -a transferstatsdialog 310 $strip($gettok($read($totalfailfile,nt,%i),$numtok($read($totalfailfile,nt,%i),32),32) $gettok($read($totalfailfile,nt,%i),3- $+ $calc($numtok($read($totalfailfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($totalfailfile,nt,%i),2,32))) 
      set %totgetfail $calc(%totgetfail + $gettok($read($totalfailfile,nt,%i),2,32))
      inc %getfails
    }
    dec %i
  }
  /did -a transferstatsdialog 322 $chr(91) $+ %getfails Files / $getnormfilesize(%totgetfail) $+ $chr(93)
  /did -z transferstatsdialog 310
}
;-------------------------------------------------------------------------
alias bothGetFailDialog {
  /did -r transferstatsdialog 310
  var %totgetfail = 0
  var %getfails = 0

  var %i = $lines($xdccsessionfailfile)
  while (%i > 0) {
    if ($read($xdccsessionfailfile,nt,%i) != $null && $gettok($read($xdccsessionfailfile,nt,%i),1,32) == GetFail) {
      /did -a transferstatsdialog 310 $strip($gettok($read($xdccsessionfailfile,nt,%i),$numtok($read($xdccsessionfailfile,nt,%i),32),32) $gettok($read($xdccsessionfailfile,nt,%i),3- $+ $calc($numtok($read($xdccsessionfailfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($xdccsessionfailfile,nt,%i),2,32))) 
      set %totgetfail $calc(%totgetfail + $gettok($read($xdccsessionfailfile,nt,%i),2,32))
      inc %getfails
    }
    dec %i
  }
  var %i = $lines($lastsessionfailfile)
  while (%i > 0) {
    if ($read($lastsessionfailfile,nt,%i) != $null && $gettok($read($lastsessionfailfile,nt,%i),1,32) == GetFail) {
      /did -a transferstatsdialog 310 $strip($gettok($read($lastsessionfailfile,nt,%i),$numtok($read($lastsessionfailfile,nt,%i),32),32) $gettok($read($lastsessionfailfile,nt,%i),3- $+ $calc($numtok($read($lastsessionfailfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($lastsessionfailfile,nt,%i),2,32))) 
      set %totgetfail $calc(%totgetfail + $gettok($read($lastsessionfailfile,nt,%i),2,32))
      inc %getfails
    }
    dec %i
  }
  /did -a transferstatsdialog 322 $chr(91) $+ %getfails Files / $getnormfilesize(%totgetfail) $+ $chr(93)
  /did -z transferstatsdialog 310
}
;-------------------------------------------------------------------------
alias lastGetFailDialog {
  /did -r transferstatsdialog 310
  var %totgetfail = 0
  var %getfails = 0

  var %i = $lines($lastsessionfailfile)
  while (%i > 0) {
    if ($read($lastsessionfailfile,nt,%i) != $null && $gettok($read($lastsessionfailfile,nt,%i),1,32) == GetFail) {
      /did -a transferstatsdialog 310 $strip($gettok($read($lastsessionfailfile,nt,%i),$numtok($read($lastsessionfailfile,nt,%i),32),32) $gettok($read($lastsessionfailfile,nt,%i),3- $+ $calc($numtok($read($lastsessionfailfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($lastsessionfailfile,nt,%i),2,32))) 
      set %totgetfail $calc(%totgetfail + $gettok($read($lastsessionfailfile,nt,%i),2,32))
      inc %getfails
    }
    dec %i
  }
  /did -a transferstatsdialog 322 $chr(91) $+ %getfails Files / $getnormfilesize(%totgetfail) $+ $chr(93)
  /did -z transferstatsdialog 310
}
;-------------------------------------------------------------------------
alias sessionGetFailDialog {
  /did -r transferstatsdialog 310
  var %totgetfail = 0
  var %getfails = 0

  var %i = $lines($xdccsessionfailfile)
  while (%i > 0) {
    if ($read($xdccsessionfailfile,nt,%i) != $null && $gettok($read($xdccsessionfailfile,nt,%i),1,32) == GetFail) {
      /did -a transferstatsdialog 310 $strip($gettok($read($xdccsessionfailfile,nt,%i),$numtok($read($xdccsessionfailfile,nt,%i),32),32) $gettok($read($xdccsessionfailfile,nt,%i),3- $+ $calc($numtok($read($xdccsessionfailfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($xdccsessionfailfile,nt,%i),2,32))) 
      set %totgetfail $calc(%totgetfail + $gettok($read($xdccsessionfailfile,nt,%i),2,32))
      inc %getfails
    }
    dec %i
  }
  /did -a transferstatsdialog 322 $chr(91) $+ %getfails Files / $getnormfilesize(%totgetfail) $+ $chr(93)
  /did -z transferstatsdialog 310
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias totSendFailDialog {
  /did -r transferstatsdialog 311
  var %totsendfail = 0
  var %sendfails = 0

  var %i = $lines($totalfailfile)
  while (%i > 0) {
    if ($read($totalfailfile,nt,%i) != $null && $gettok($read($totalfailfile,nt,%i),1,32) == SendFail) {
      /did -a transferstatsdialog 311 $strip($gettok($read($totalfailfile,nt,%i),$numtok($read($totalfailfile,nt,%i),32),32) $gettok($read($totalfailfile,nt,%i),3- $+ $calc($numtok($read($totalfailfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($totalfailfile,nt,%i),2,32))) 
      set %totsendfail $calc(%totsendfail + $gettok($read($totalfailfile,nt,%i),2,32))
      inc %sendfails 
    }
    dec %i
  }
  /did -a transferstatsdialog 323 $chr(91) $+ %sendfails Files / $getnormfilesize(%totsendfail) $+ $chr(93)
  /did -z transferstatsdialog 311
}
;-------------------------------------------------------------------------
alias bothSendFailDialog {
  /did -r transferstatsdialog 311
  var %totsendfail = 0
  var %sendfails = 0

  var %i = $lines($xdccsessionfailfile)
  while (%i > 0) {
    if ($read($xdccsessionfailfile,nt,%i) != $null && $gettok($read($xdccsessionfailfile,nt,%i),1,32) == SendFail) { 
      /did -a transferstatsdialog 311 $strip($gettok($read($xdccsessionfailfile,nt,%i),$numtok($read($xdccsessionfailfile,nt,%i),32),32) $gettok($read($xdccsessionfailfile,nt,%i),3- $+ $calc($numtok($read($xdccsessionfailfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($xdccsessionfailfile,nt,%i),2,32))) 
      set %totsendfail $calc(%totsendfail + $gettok($read($xdccsessionfailfile,nt,%i),2,32))
      inc %sendfails
    }
    dec %i
  }
  var %i = $lines($lastsessionfailfile)
  while (%i > 0) {
    if ($read($lastsessionfailfile,nt,%i) != $null && $gettok($read($lastsessionfailfile,nt,%i),1,32) == SendFail) { 
      /did -a transferstatsdialog 311 $strip($gettok($read($lastsessionfailfile,nt,%i),$numtok($read($lastsessionfailfile,nt,%i),32),32) $gettok($read($lastsessionfailfile,nt,%i),3- $+ $calc($numtok($read($lastsessionfailfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($lastsessionfailfile,nt,%i),2,32))) 
      set %totsendfail $calc(%totsendfail + $gettok($read($lastsessionfailfile,nt,%i),2,32))
      inc %sendfails
    }
    dec %i
  }
  /did -a transferstatsdialog 323 $chr(91) $+ %sendfails Files / $getnormfilesize(%totsendfail) $+ $chr(93)
  /did -z transferstatsdialog 311
}
;-------------------------------------------------------------------------
alias lastSendFailDialog {
  /did -r transferstatsdialog 311
  var %totsendfail = 0
  var %sendfails = 0

  var %i = $lines($lastsessionfailfile)
  while (%i > 0) {
    if ($read($lastsessionfailfile,nt,%i) != $null && $gettok($read($lastsessionfailfile,nt,%i),1,32) == SendFail) { 
      /did -a transferstatsdialog 311 $strip($gettok($read($lastsessionfailfile,nt,%i),$numtok($read($lastsessionfailfile,nt,%i),32),32) $gettok($read($lastsessionfailfile,nt,%i),3- $+ $calc($numtok($read($lastsessionfailfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($lastsessionfailfile,nt,%i),2,32))) 
      set %totsendfail $calc(%totsendfail + $gettok($read($lastsessionfailfile,nt,%i),2,32))
      inc %sendfails
    }
    dec %i
  }
  /did -a transferstatsdialog 323 $chr(91) $+ %sendfails Files / $getnormfilesize(%totsendfail) $+ $chr(93)
  /did -z transferstatsdialog 311
}
;-------------------------------------------------------------------------
alias sessionSendFailDialog {
  /did -r transferstatsdialog 311
  var %totsendfail = 0
  var %sendfails = 0

  var %i = $lines($xdccsessionfailfile)
  while (%i > 0) {
    if ($read($xdccsessionfailfile,nt,%i) != $null && $gettok($read($xdccsessionfailfile,nt,%i),1,32) == SendFail) { 
      /did -a transferstatsdialog 311 $strip($gettok($read($xdccsessionfailfile,nt,%i),$numtok($read($xdccsessionfailfile,nt,%i),32),32) $gettok($read($xdccsessionfailfile,nt,%i),3- $+ $calc($numtok($read($xdccsessionfailfile,nt,%i),32) - 1),32) $getnormfilesize($gettok($read($xdccsessionfailfile,nt,%i),2,32))) 
      set %totsendfail $calc(%totsendfail + $gettok($read($xdccsessionfailfile,nt,%i),2,32))
      inc %sendfails
    }
    dec %i
  }
  /did -a transferstatsdialog 323 $chr(91) $+ %sendfails Files / $getnormfilesize(%totsendfail) $+ $chr(93)
  /did -z transferstatsdialog 311
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------







;-------------------------------------------------------------------------
; /pleasewaitdialog & /closewaitdialog:
; Opens/closes the please wait dialog box.
;-------------------------------------------------------------------------
alias pleasewaitdialog /dialog -m pleasewaitdialog pleasewaitdialog
alias closewaitdialog /dialog -c pleasewaitdialog
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------

;-------------------------------------------------------------------------
; /dialog pleasewaitdialog:
; Shows a small dialog with a "please wait" request.
;-------------------------------------------------------------------------
dialog pleasewaitdialog {
  title "Please wait (this can take a few minutes)..."
  size -1 -1 300 50
  text "Please wait, this can take a few minutes...", 1, 50 20 300 15
}
;-------------------------------------------------------------------------