aIRC — File Browser

aIRCv0.8.69 / aIRCv0.8.69 / addons / xdcc2.mrc

xdcc2.mrc — 19.78 KB — Download this file

;/**********************************************************************
; *
; * aIRC
; * XDCC file 2
; *
; **********************************************************************/
;
;
dialog _xdcc {
  size -1 -1 250 157
  option dbu
  title "XDCC Setup"

  tab "Packs",1001,5 1 240 130
  tab "Options",1002
  tab "Msgs",1003
  box "",1011,10 15 230 113
  box "",1012,47 15 193 113,tab 1001
  box "Files",1013,47 30 193 50,tab 1001

  text "Pack:",1501,15 25 15 8,tab 1001
  list 1502,15 35 30 60,tab 1001
  button "add",1503,15 92 14 9,tab 1001
  button "del",1504,31 92 14 9,tab 1001
  button "up",1505,15 104 14 9,tab 1001
  button "down",1506,31 104 14 9,tab 1001
  button "clear",1507,15 115 30 9,tab 1001

  text "",1601,52 22 180 8,tab 1001
  list 1602,52 43 140 40,tab 1001
  button "add",1603,195 43 18 12,tab 1001
  button "del",1604,217 43 18 12,tab 1001
  button "up",1605,195 60 18 12,tab 1001
  button "down",1606,217 60 18 12,tab 1001

  text "Description:",1701,50 86 28 8,tab 1001 right
  edit "",1702,80 84 150 10,tab 1001 autohs
  text "Note:",1703,50 100 28 8,tab 1001 right
  edit "",1704,80 98 150 10,tab 1001 autohs
  text "Password:",1705,50 114 28 8,tab 1001 right
  edit "",1706,80 112 150 10,tab 1001 autohs pass

  check "Echo remote requests in",2001,20 30 100 8,tab 1002
  radio "active window",2002,30 40 55 8,tab 1002 group
  radio "status window",2003,30 50 55 8,tab 1002
  radio "@xdcc window",2004,30 60 55 8,tab 1002

  text "Send list as",2101,110 30 40 8,tab 1002
  radio "notice",2102,120 40 40 8,tab 1002 group
  radio "privmsg",2103,120 50 40 8,tab 1002
  text "Timed...",2104,170 30 40 8,tab 1002
  radio "notice",2105,180 40 40 8,tab 1002 group
  radio "privmsg",2106,180 50 40 8,tab 1002

  box "",2111,10 15 230 57,tab 1002
  check "Notice channels every",2112,20 80 65 8,tab 1002
  edit "",2113,85 78 15 10,tab 1002 autohs
  text "minutes",2114,103 80 18 8,tab 1002
  check "On Join Notice",2115,135 80 65 8,tab 1002
  check "Only in these channels:",2116,20 93 63 8,tab 1002
  edit "",2117,85 91 145 10,tab 1002 autohs
  text "Timed Notice/msg (or /xdcc notice)",2118,15 105 180 8,tab 1002
  edit "",2119,15 113 215 10,tab 1002 autohs
  button "!",2129,232 113 6 10,tab 1002

  text "List: Header:",2201,15 25 180 8,tab 1003
  edit "",2202,15 33 215 10,tab 1003 autohs
  button "!",2212,232 33 6 10,tab 1003
  text "List: Pack",2203,15 45 180 8,tab 1003
  edit "",2204,15 53 215 10,tab 1003 autohs
  button "!",2214,232 53 6 10,tab 1003
  text "List: Pack with Note",2205,15 65 180 8,tab 1003
  edit "",2206,15 73 215 10,tab 1003 autohs
  button "!",2216,232 73 6 10,tab 1003
  text "List: End",2207,15 85 180 8,tab 1003
  edit "",2208,15 93 215 10,tab 1003 autohs
  button "!",2218,232 93 6 10,tab 1003
  text "Info (reply to ctcp info #x)",2209,15 105 180 8,tab 1003
  edit "",2210,15 113 215 10,tab 1003 autohs
  button "!",2220,232 113 6 10,tab 1003


  check "XDCC",2981,10 140 25 8

  text "text presets",2982,45 140 30 8
  combo 2983,75 138 75 100,drop
  combo 2984,75 138 75 100,drop hide
  button "save",2985,153 138 20 10

  list 2461,999 999 999 999,hide
  list 2462,999 999 999 999,hide
  list 2463,999 999 999 999,hide
  list 2464,999 999 999 999,hide

  button "Ok",2991,180 138 30 15,ok
  button "Cancel",2992,215 138 30 15,cancel
}
ON *:DIALOG:_xdcc:sclick:2991:{
  _xdcc.d.save
  _xdcc.init
}
ON *:DIALOG:_xdcc:*:*:{
  if ($devent == init) {
    _mdx.init $_icofile(xdcc.ico,$scriptdir)
    _dummy $_lang.loaddialog($dname,$dname,00086969,xdcc.lang,$scriptdir)
  }
  if (%XDCC.D.NONONO) { return }
  if ($devent == init) { _xdcc.d.init }
  elseif ($devent == sclick) {
    if ($did == 1502) { _xdcc.d.loadpack }
    elseif ($did == 1503) { .timer -o 1 0 _xdcc.d.addpack }
    elseif ($did == 1504) { _xdcc.d.delpack }
    elseif ($did == 1505) { _xdcc.d.uppack }
    elseif ($did == 1506) { _xdcc.d.downpack }
    elseif ($did == 1507) { .timer -o 1 0 _xdcc.d.clearpacks }
    elseif ($did == 1603) { .timer -o 1 0 _xdcc.d.addfile }
    elseif ($did == 1604) { _xdcc.d.delfile }
    elseif ($did == 1605) { _dialog.up $dname 1602 1602 }
    elseif ($did == 1606) { _dialog.down $dname 1602 1602 }
    elseif ($did == 2983) { _xdcc.d.txtpreset $did($dname,2984,$did($dname,2983).sel) }
    elseif ($did == 2985) {
      _addontextscheme.save $dname XDCC xdccts 2119,_xdcctext_notice,+ 2202,_xdcctext_header,+ 2204,_xdcctext_packd,+ 2206,_xdcctext_packn,+ 2208,_xdcctext_lstend,+ 2210,_xdcctext_info,+
      if ($result != $null) { _xdcc.d.initpresets $ifmatch }
    }
    elseif ($istok(2129 2212 2214 2216 2218 2220,$did,32)) { _txtpreviewin $dialog($dname).x 1 $dialog($dname).w 80 $dname $calc($did - 10) $calc($did - 10) - _xdcc.d.winprev }
  }
  elseif ($devent == edit) {
    if ($did($dname,1502).sel) {
      var %l = $ifmatch
      if ($did == 1702) { did -o $dname 2463 %l $did($dname,1702,1) }
      elseif ($did == 1704) { did -o $dname 2464 %l $did($dname,1704,1) }
      elseif ($did == 1706) { did -o $dname 2461 %l $gettok($did($dname,2461,%l),1-3,32) $gettok($did($dname,1706,1),1,32) }
    }
  }
  _xdcc.d.refresh
}
alias _xdcc.d.init {
  var %d = _xdcc,%total = $_xdcc.totalpacks,%i = 1,%gets,%time,%pass,%files,%desc,%note,%size
  did $iif($_xdcc.rini(echo),-c,-u) %d 2001
  did $iif($_xdcc.rini(xdcc),-c,-u) %d 2981

  did $iif($_xdcc.rini(advertimerstatus),-c,-u) %d 2112
  if ($_isint($_xdcc.rini(advertimertime))) { did -o %d 2113 1 $ifmatch }
  did $iif($_xdcc.rini(advertonjoin),-c,-u) %d 2115
  did $iif($_not($_xdcc.rini(advertall)),-c,-u) %d 2116
  did -o %d 2117 1 $_fixchans($_xdcc.rini(advertchannels))

  did -o %d 2119 1 $_xdcc.premsg(notice,0)
  did -o %d 2202 1 $_xdcc.premsg(header,0)
  did -o %d 2204 1 $_xdcc.premsg(packd,0)
  did -o %d 2206 1 $_xdcc.premsg(packn,0)
  did -o %d 2208 1 $_xdcc.premsg(lstend,0)
  did -o %d 2210 1 $_xdcc.premsg(info,0)

  did -c %d $calc($_xdcc.rini(echowin) + 2002)
  did -c %d $calc($_xdcc.rini(type) + 2102)
  did -c %d $calc($_xdcc.rini(timedtype) + 2105)
  while (%i <= %total) {
    %gets = $_xdcc.read(%i,gets)
    if ($_not(%gets)) { %gets = 0 }
    %time = $_xdcc.read(%i,time)
    if ($_not(%time)) { %time = 0 }
    if ($_xdcc.read(%i,pass) != $null) { %pass = $_decrypt($ifmatch) }
    else { var %pass }
    %files = $_xdcc.read(%i,files)
    %desc = $_xdcc.read(%i,desc)
    %note = $_xdcc.read(%i,note)
    %size = $_xdcc.packsize(%i)
    did -o %d 1502 %i $chr(35) $+ %i
    did -o %d 2461 %i %gets %time %size %pass
    did -o %d 2462 %i $iif(%files != $null,%files,$null)
    did -o %d 2463 %i $iif(%desc != $null,%desc,$null)
    did -o %d 2464 %i $iif(%note != $null,%note,$null)
    inc %i
  }
  _xdcc.d.initpresets

  did -c %d 1502 1
  _xdcc.d.loadpack
}
alias -l _xdcc.d.initpresets {
  var %d = _xdcc
  if ($dialog(%d) == $null) { return }
  did -r %d 2983,2984
  did -o %d 2983,2984 1 Default
  _dummy $findfile($mircdiraddons\tschemes\,*.xdccts,0,1,_xdcc.d._initpresets $1-)
  if ($didwm(%d,2984,$1,1)) { did -c %d 2983 $ifmatch }
}
alias -l _xdcc.d._initpresets {
  var %d = _xdcc,%file = " $+ $1- $+ ",%name = $read -nsschemename %file ,%author = $read -nsauthor %file
  if (%name != $null) {
    if (%author != $null) { did -a %d 2983 %name ( $+ %author $+ ) }
    else { did -a %d 2983 %name }
    did -a %d 2984 $nopath(%file)
  }
}

;;
;
; $_xdcc.d.winprev(string)
;
alias _xdcc.d.winprev {
  var %text = $1-,%target = <TARGET>,%tmp = 1- $+ $_randtok(1 1 1 2 3 4,32),%packfiles = $gettok(airc.rar"mirc32.exe"mp3list.htm"Metallica_One.mp3,%tmp,34),%pack = $rand(3,10)
  %text = $replace(%text,<PACK>,%pack,<PACKSIZE>,$rand(3456078,7890123),<PACKGETS>,$rand(10,200),<PACKDESC>,Packet Description,<PACKNOTE>,Packet Note,<PACKFILES>,%packfiles,<PACKNUMFILES>,$numtok(%packfiles,34),<TIMEADDED>,$ctime,<PACKPASS>,password)
  if (<TOTALGETS> isin %text) { %text = $replace(%text,<TOTALGETS>,$rand(50,200)) }
  if (<TOTALFILES> isin %text) { %text = $replace(%text,<TOTALFILES>,$rand(10,20)) }
  if (<TOTALSIZE> isin %text) { %text = $replace(%text,<TOTALSIZE>,$rand(8901234,234567801)) }
  if (<TOTALSGETS> isin %text) { %text = $replace(%text,<TOTALSGETS>,$rand(100,150)) }
  return $_evaltext($replace(%text,<TARGET>,%target,<TOTALPACKS>,$calc(%pack + $rand(3,5)),<RECORDCPS>,$_xdcc.getrecordcps,<RECORDBY>,$_xdcc.getrecordby))
}

alias _xdcc.txtpreset.default {
  if ($istok(notice header packd packn lstend info,$1,32) == $false) { return }
  goto $1
  :notice | return [xdcc] Offering <TOTALPACKS> <$_singoplur(<TOTALPACKS>,pack,packs)> [<$_size(<TOTALSIZE>)>] - "/ctcp <ME> xdcc list" - slots[<SENDS_CURR>/<SENDS_MAX>] ques[<QUEUE_CURR>/<QUEUE_MAX>] [next send: <NEXTSEND>] [cps in use: <CURRENT_CPS>] record[<RECORDCPS>cps by <RECORDBY>] (aIRC)
  :header | return [xdcc] Offering <TOTALPACKS> <$_singoplur(<TOTALPACKS>,pack,packs)> - /ctcp <ME> xdcc get #N<CRLF>[xdcc] min speed: <$^n(<$_size($calc(<SEND_MINSPEED> * 1024))>)>/s, dls[<SENDS_CURR>/<SENDS_MAX>] queue[<QUEUE_CURR>/<QUEUE_MAX>]
  :packd  | return #<PACK> [<PACKNUMFILES> <$_singoplur(<PACKNUMFILES>,file,files)> / <$^n(<$_nospaces(<$lower(<$_size(<PACKSIZE>)>)>)>)> / <PACKGETS> <$_singoplur(<PACKGETS>,get,gets)>] <PACKDESC>
  :packn  | return #<PACK> [<PACKNUMFILES> <$_singoplur(<PACKNUMFILES>,file,files)> / <$^n(<$_nospaces(<$lower(<$_size(<PACKSIZE>)>)>)>)> / <PACKGETS> <$_singoplur(<PACKGETS>,get,gets)>] <PACKDESC><CRLF>        > <PACKNOTE>
  :lstend | return
  :info   | return [xdcc] Pack #<PACK> (<$_nsingoplur(<PACKNUMFILES>,file,files)> - <$_size(<PACKSIZE>)> - <$_nsingoplur(<PACKGETS>,get,gets)> - minspeed: <$_size(<$calc(<SEND_MINSPEED> * 1024)>)>/s  - Added: <$_date(<TIMEADDED>)>
}
alias _xdcc.d.save {
  var %d = $dname,%no = %XDCC.D.NONONO,%file = $_xdcc.file,%gets,%time,%pass,%files,%desc,%note,%ttt,%emptypacks,%nemptypacks,%z,%i,%j,%size
  unset %XDCC.D.NONONO
  _xdcc.wini echo $did(%d,2001).state
  _xdcc.wini type $iif($did(%d,2102).state,0,1)
  _xdcc.wini timedtype $iif($did(%d,2105).state,0,1)
  if ($did(%d,2002).state) { _xdcc.wini echowin 0 }
  elseif ($did(%d,2003).state) { _xdcc.wini echowin 1 }
  else { _xdcc.wini echowin 2 }

  _winitxt _xdcctext_notice $did(%d,2119,1)
  _winitxt _xdcctext_header $did(%d,2202,1)
  _winitxt _xdcctext_packd $did(%d,2204,1)
  _winitxt _xdcctext_packn $did(%d,2206,1)
  _winitxt _xdcctext_lstend $did(%d,2208,1)
  _winitxt _xdcctext_info $did(%d,2210,1)

  _xdcc.wini advertimerstatus $did(%d,2112).state
  _xdcc.wini advertonjoin $did(%d,2115).state
  _xdcc.wini advertall $_not($did(%d,2116).state)
  if ($_isint($did(%d,2113))) { _xdcc.wini advertimertime $ifmatch }
  _xdcc.wini advertchannels $_fixchans($did(%d,2117))

  if (%no) { return }

  write -c $"(%file)
  %i = 1
  %j = $did(%d,1502).lines
  while (%i <= %j) {
    %ttt = $did(%d,2461,%i)
    %gets = $gettok(%ttt,1,32)
    %time = $gettok(%ttt,2,32)
    %pass = $gettok(%ttt,3,32)
    %pass = $gettok(%ttt,4,32)
    %desc = $did(%d,2463,%i)
    %note = $did(%d,2464,%i)
    %files = $did(%d,2462,%i)
    %z = $numtok(%files,34)
    while (%z) {
      if ($_fixfilename($gettok(%files,%z,34),em) == $null) { %files = $deltok(%files,%z,34) }
      dec %z
    }
    if (%files != $null) {
      _xdcc.write %i files %files
      _xdcc.write %i gets %gets
      _xdcc.write %i time %time
      if (%pass != $null) { _xdcc.write %i pass $_crypt(%pass) }
      _xdcc.write %i desc %desc
      _xdcc.write %i note %note
    }
    else { %emptypacks = %emptypacks $+ , $+ $chr(35) $+ %i }
    inc %i
  }
  if (,* iswm %emptypacks) { %emptypacks = $right(%emptypacks,-1) }
  %nemptypacks = $numtok(%emptypacks,44)
  if (%nemptypacks) { info.a There $_singoplur(%nemptypacks,is,are) $_nsingoplur(%nemptypacks,empty pack,empty packs) $+ : %emptypacks $+ ... Reordering... }
  _xdcc.fixfile
  if ($did(%d,2981).state != $iif($_xdcc.rini(xdcc),1,0)) { xdcc $iif($ifmatch,on,off) }
  return 0
}
alias _xdcc.d.txtpreset {
  var %d = _xdcc,%preset = $1-,%topics,%dids,%i,%cdid,%read,%zt,%file,%evangelion
  if ($dialog(%d) == $null) { return 1 }
  %file = " $+ addons\tschemes\ $+ $1- $+ "
  if ($1- == default) || ($isfile(%file) == $false) { var %file }
  %topics = notice header packd packn lstend info
  %dids = 2119 2202 2204 2206 2208 2210
  did -r %d $replace(%dids,$chr(32),$chr(44))
  %i = $numtok(%dids,32)
  while (%i) {
    var %evangelion,%cdid = $gettok(%dids,%i,32),%zt = $gettok(%topics,%i,32),%yt = _xdcctext_ $+ %zt
    if (%file) { %evangelion = $read -ns $+ %yt %file }
    if ($1- == default) || ((%evangelion == $null) && ($istok(2119 2204 2206,%cdid,32))) { %evangelion = $_xdcc.txtpreset.default(%zt) }
    did -o %d %cdid 1 %evangelion
    dec %i
  }
}
alias _xdcc.d.prepfloadpack {
  var %d = _xdcc,%size = 0,%i,%pack,%ttt,%gets,%time,%pass
  if ($dialog(%d) == $null) { return 1 }
  %pack = $did(%d,1502).sel
  if ($_not($_isint(%pack))) { return 1 }
  %i = $did(%d,1602).lines
  while (%i) {
    if ($_fixfilename($did(%d,1602,%i),em) != $null) { inc %size $file($ifmatch).size }
    dec %i
  }
  %ttt = $did(%d,2461,%pack)
  %gets = $gettok(%ttt,1,32)
  %time = $gettok(%ttt,2,32)
  %pass = $gettok(%ttt,4,32)
  did -o %d 2461 %pack %gets %time %size %pass
  did -o %d 1601 1 Pack $chr(35) $+ %pack $+ : $_size(%size) - $_nsingoplur(%gets,get,gets) - Created: $_date(%time)
  return 0
}
alias _xdcc.d.loadpack {
  var %d = _xdcc,%pack,%gets,%time,%pass,%files,%desc,%note,%size
  if ($dialog(%d) == $null) { return 1 }
  %pack = $did(%d,1502).sel
  if ($_not($_isint(%pack))) { return 1 }
  %gets = $gettok($did(%d,2461,%pack),1,32)
  %time = $gettok($did(%d,2461,%pack),2,32)
  %size = $gettok($did(%d,2461,%pack),3,32)
  %pass = $gettok($did(%d,2461,%pack),4,32)
  %files = $did(%d,2462,%pack)
  %desc = $did(%d,2463,%pack)
  %note = $did(%d,2464,%pack)
  did -r %d 1601,1702,1704,1706,1602
  did -o %d 1601 1 Pack $chr(35) $+ %pack $+ : $_size(%size) - $_nsingoplur(%gets,get,gets) - Created: $_date(%time)
  did -o %d 1702 1 %desc
  did -o %d 1704 1 %note
  did -o %d 1706 1 %pass
  didtok %d 1602 34 %files
  _xdcc.d.refresh
}
alias _xdcc.d.refresh {
  var %d = _xdcc
  if ($dialog(%d) == $null) { return 1 }
  did $iif($did(%d,2001).state,-e,-b) %d 2002,2003,2004
  if ($_not($did(%d,1502).sel)) { did -r %d 1601,1702,1704,1706,1602 }
  if ($did(%d,1502).sel) {
    did $iif($did(%d,1602).sel,-e,-b) %d 1604,1605,1606
    did -e %d 1504,1505,1506,1601,1602,1603,1701,1702,1703,1704,1705,1706
  }
  else { did -b %d 1504,1505,1506,1601,1602,1603,1604,1605,1606,1701,1702,1703,1704,1705,1706 }
  did $iif($did(%d,2112).state,-e,-b) %d 2113
  did $iif($did(%d,2116).state,-e,-b) %d 2117
}
alias _xdcc.d.addfile {
  var %d = _xdcc,%pack,%gets,%time,%pass,%files,%desc,%note,%dir = $mircdir,%sel = 1,%file,%i,%n,%tfile
  if ($dialog(%d) == $null) { return 1 }
  %pack = $did(%d,1502).sel
  %i = $did(%d,1602).lines
  if ($_not($_isint(%pack))) { return 1 }
  if ($did(%d,1602).sel)  { %sel = $ifmatch }
  if (%sel <= %i) { %dir = $nofile($_fixfilename($did(%d,1602,%sel))) }
  %XDCC.D.NONONO = 1
  %file = $file="[xdcc] Select file to add:" %dir
  unset %XDCC.D.NONONO
  did -c %d 1502 %pack
  if ($dialog(%d) == $null) { return 1 }
  dialog -v %d
  if (%file == $null) { return 1 }
  %file = $_fixfilename(%file,m)
  if ($_not($_isfile(%file))) { return 1 }
  while (%i) {
    %tfile = $_fixfilename($did(%d,1602,%i),m)
    if (%file == %tfile) {
      did -c %d 1602 %i
      return 1
    }
    dec %i
  }
  did -ac %d 1602 %file
  _xdcc.d.prepfloadpack
  _xdcc.d.refresh
  _xdcc.d.files2line
  return 0
}
alias _xdcc.d.delfile {
  var %d = _xdcc,%sel,%total
  if ($dialog(%d) == $null) { return 1 }
  %sel = $did(%d,1602).sel
  if (%sel) {
    did -d %d 1602 %sel
    %total = $did(%d,1602).lines
    if (%sel <= %total) { did -c %d 1602 %sel }
    else { did -c %d 1602 %total }
    _xdcc.d.prepfloadpack
    _xdcc.d.refresh
    _xdcc.d.files2line
    return 0
  }
  return 1
}
alias _xdcc.d.files2line {
  var %d = _xdcc
  if ($did(%d,1502).sel) { did -o %d 2462 $ifmatch $didtok(%d,1602,34) }
}
alias _xdcc.d.clearpacks {
  var %d = _xdcc
  if ($dialog(%d) == $null) { return 1 }
  if ($_yesno(1,XDCC [/xdcc],1,Clear all packs?)) {
    did -r %d 1502,1601,1602,1702,1704,1706,2461,2462,2463,2464
    _xdcc.d.refresh
  }
}
alias _xdcc.d.addpack {
  var %d = _xdcc,%file,%l,%desc
  if ($dialog(%d) == $null) { return 1 }
  %XDCC.D.NONONO = 1
  %file = $dir="[xdcc] Select file:"
  unset %XDCC.D.NONONO
  if ($dialog(%d) == $null) { return 1 }
  dialog -v %d
  %file = $_fixfilename(%file,m)
  if ($_not($_isfile(%file))) { return 1 }
  %l = $calc($did(%d,1502).lines + 1)
  %desc = $gettok($nopath(%file),1,46)
  did -o %d 1502 %l $chr(35) $+ %l
  did -o %d 2461 %l 0 $ctime
  did -o %d 2462 %l %file
  did -o %d 2463 %l $iif(%desc != $null,%desc,$null)
  did -o %d 2464 %l $null
  did -c %d 1502 %l
  _xdcc.d.loadpack
  _xdcc.d.prepfloadpack
  return 0
}
alias _xdcc.d.delpack {
  var %d = _xdcc,%l,%total
  if ($dialog(%d) == $null) { return 1 }
  %l = $did(%d,1502).sel
  if (%l) {
    %total = $did(%d,1502).lines
    did -d %d 2461,2462,2463,2464 %l
    did -d %d 1502 %total
    dec %total
    if (%l <= %total) { did -c %d 1502 %l }
    elseif (%total) { did -c %d 1502 %total }
    _xdcc.d.loadpack
    return 0
  }
  return 1
}
alias _xdcc.d.uppack {
  var %d = _xdcc,%l,%total,%i
  if ($dialog(%d) == $null) { return 1 }
  %l = $did(%d,1502).sel
  if (%l) {
    did -c %d 2461,2462,2463,2464 %l
    if ($calc(%l - 1)) {
      did -c %d 1502 $ifmatch
      did -o %d 1601 1 $puttok($did(%d,1601,1),$_nospaces($chr(35),$ifmatch),2,32)
    }
    _dialog.up %d 2461 2461
    _dialog.up %d 2462 2462
    _dialog.up %d 2463 2463
    _dialog.up %d 2464 2464
    return 0
  }
  return 1
}
alias _xdcc.d.downpack {
  var %d = _xdcc,%l,%total,%i
  if ($dialog(%d) == $null) { return 1 }
  %l = $did(%d,1502).sel
  if (%l) {
    did -c %d 2461,2462,2463,2464 %l
    if ($calc(%l + 1) <= $did(%d,1502).lines) {
      did -c %d 1502 $ifmatch
      did -o %d 1601 1 $puttok($did(%d,1601,1),$_nospaces($chr(35),$ifmatch),2,32)
    }
    _dialog.down %d 2461 2461
    _dialog.down %d 2462 2462
    _dialog.down %d 2463 2463
    _dialog.down %d 2464 2464
    return 0
  }
  return 1
}


alias _xdcc.ad.allchans {
  .timer_xdccadvert.* off
  if ($_connected) && ($_xdcc.rini(xdcc)) && ($_xdcc.rini(advertimerstatus)) {
    var %i = $chan(0)
    while (%i) {
      _xdcc.ad.chan $chan(%i)
      dec %i
    }
  }
}
alias _xdcc.ad.chan {
  var %chan = $1,%int,%last
  .timer_xdccadvert. $+ %chan off
  if ($_connected) && ($me ison %chan) && ($_xdcc.rini(xdcc)) && ($_xdcc.rini(advertimerstatus)) && ($_xdcc.isadvertchan(%chan)) && ($_isint($calc($_xdcc.rini(advertimertime) * 60))) {
    %int = $ifmatch
    %last = $_get(junk,xdcc.ad.last,%chan)
    if (%last > $ctime) { %last = $ctime - 60 }
    if (%last == $null) || ($calc(%last + %int) < $ctime) { _xdcc.ad.send %chan }
    else { .timer_xdccadvert. $+ %chan 1 $calc(%int - $ctime + %last) _xdcc.ad.send %chan }
  }
}
alias _xdcc.ad.send {
  var %chan = $1,%int,%last
  .timer_xdccadvert. $+ %chan off
  if ($_connected) && ($me ison %chan) && ($_xdcc.rini(xdcc)) && ($_xdcc.rini(advertimerstatus)) && ($_xdcc.isadvertchan(%chan)) {
    if ($_xdcc.ad.msg(%chan) != $null) {
      var %msg = $ifmatch
      _puthelp %chan c& $iif($_xdcc.rini(timedtype),msg,notice) %chan %msg
      _setd junk xdcc.ad.last %chan $ctime
    }
    if ($_isint($calc($_xdcc.rini(advertimertime) * 60))) { .timer_xdccadvert. $+ %chan 1 $ifmatch _xdcc.ad.send %chan }
  }
}
alias _xdcc.ad.msg {
  var %target = $1,%packs = $_xdcc.totalpacks
  if (%target != $null) && (%packs) { return $_xdcc.evaltext($_xdcc.premsg(notice,0),%target,%packs) }
}