ircN for mIRC — File Browser

ircNformIRCv6.0 / ircNformIRCv6.0 / ircn / SYSTEM / Xdcc.mrc

Xdcc.mrc — 22.34 KB — Download this file

;%%%%%%%%%%%%%%%%%%%%%%%%
;script iXdcc
;version 1.01
;author icN, Chutzpah
;email icn@ircn.com
;url http://www.ircN.com
;%%%%%%%%%%%%%%%%%%%%%%%%
on 1:CONNECT { write -c $tp(queue.txt) }
ctcp 1:XDCC {
  set %pack $remove($3,$chr(35))
  if ((%numpacks == $null) || (%numpacks == 0)) .quote notice $nick :[cybernightmare(1beta.zero2)] (no files offered)
  elseif (%pack > %numpacks) .quote notice $nick :[phile(  $+ $3 $+ )] does not exist. /ctcp $me xdcc LIST.
  else {
    if (($2 == list) && ($3)) {
      %nopath = $nopath(%file [ $+ [ %pack ] ] ) | %ngets = %get [ $+ [ %pack ] ]
      .quote notice $nick :Pack: %filedesc [ $+ [ %pack ] ]
      .quote notice $nick :Size $str( ,5) File
      .quote notice $nick : $+ $fix(10,$lof(%file [ $+ [ %pack ] ] )) %nopath
      .quote notice $nick :---------- -------------------------------------------------
      .quote notice $nick : $+ $fix(10,$lof(%file [ $+ [ %pack ] ] )) 1 file(s) :: %ngets Snags
      unset %nopath %ngets
    }
    elseif (($2 == send) || ($2 == get)) {
      if (%pack !isnum) .quote notice $nick :[phile ( $+ $3 $+ )] does not exist. /ctcp $me xdcc HELP.
      elseif ($send(0) >= %maxslots) {
        if ($qlen >= %maxqueue) { .quote notice $nick :All %maxslots slots are full--queue of %maxqueue is full.  Try again later. | halt }
        %qds = $read -s $+ $nick $tp(queue.txt)
        if (%qds == %pack) { set %fpack %file [ $+ [ %pack ] ] | .quote notice $nick :Queue: $replace($remove(%fpack,$left(2,%fpack)),\,/) is already in your queue.  It will be sent as slots open. }
        else {
          write $tp(queue.txt) $nick %pack
          if ($timer(%xdcc.timer2) == $null) { .timer 0 150 qs | set %xdcc.timer2 $ltimer }
          .quote notice $nick :DCC Limit reached: Will send you %filedesc [ $+ [ %pack ] ] $+ , which is one file, when a slot opens.
          .quote notice $nick :You are in queue position $qlen of %maxqueue $+ .
        }
      }
      else psend $nick %pack
    }
    elseif ($2 == queue) .quote notice $nick :Queue Length: $qlen / %maxqueue
    elseif ($2 == list) nlist $nick
    elseif ($2 == help) {
      .quote notice $nick :/ctcp $me XDCC LIST - to get the list of offered packs.
      .quote notice $nick :/ctcp $me XDCC LIST #<N> - to get more info on pack #<N>.
      .quote notice $nick :/ctcp $me XDCC SEND #<N> - to send pack #<N>.
    }
    else .quote notice $nick :Unrecognized request. Try /CTCP $me XDCC HELP.
  }
}
on 1:TEXT:XDCC*:? {
  set %pack $remove($3,$chr(35))
  close -m $nick
  if ((%numpacks == $null) || (%numpacks == 0)) .quote notice $nick :No files offered.
  elseif (%pack > %numpacks) .quote notice $nick :File  $+ $3 $+  does not exist. /CTCP $me XDCC LIST.
  else {
    if (($2 == list) && ($3)) {
      %nopath = $nopath(%file [ $+ [ %pack ] ] ) | %ngets = %get [ $+ [ %pack ] ]
      .quote notice $nick :Pack: %filedesc [ $+ [ %pack ] ]
      .quote notice $nick :Size $str( ,5) File
      .quote notice $nick : $+ $fix(10,$lof(%file [ $+ [ %pack ] ] )) %nopath
      .quote notice $nick :---------- -------------------------------------------------
      .quote notice $nick : $+ $fix(10,$lof(%file [ $+ [ %pack ] ] )) 1 file(s) :: %ngets Snags
      unset %nopath %ngets
    }
    elseif (($2 == send) || ($2 == get)) {
      if (%pack !isnum) .quote notice $nick :[phile ( $+ $3 $+ )] does not exist. /ctcp $me XDCC HELP.
      elseif ($send(0) >= %maxslots) {
        if ($qlen >= %maxqueue) .quote notice $nick :All %maxslots slots are full--queue of %maxqueue is full.  Try again later. | halt } | %qds = $read -s $+ $nick $tp(queue.txt) | if (%qds == %pack) { set %fpack %file [ $+ [ %pack ] ] | .quote notice $nick :Queue: $replace($remove(%fpack,$left(2,%fpack)),\,/) is already in your queue.  It will be sent as slots open.
        else {
          write $tp(queue.txt) $nick %pack
          if ($timer(%xdcc.timer2) == $null) { .timer 0 150 qs | set %xdcc.timer2 $ltimer }
          .quote notice $nick :DCC Limit reached: Will send you %filedesc [ $+ [ %pack ] ] $+ , which is one file, when a slot opens.
          .quote notice $nick :You are in query position $qlen of %maxqueue $+ .
        }
      }
      else psend $nick %pack
    }
    elseif ($2 == queue) .quote notice $nick :Queue Length: $qlen / %maxqueue
    elseif ($2 == list) nlist $nick
    elseif ($2 == help) {
      .quote notice $nick :/CTCP $me XDCC LIST - to get the list of offered packs.
      .quote notice $nick :/CTCP $me XDCC LIST #<N> - to get more info on pack #<N>.
      .quote notice $nick :/CTCP $me XDCC SEND #<N> - to send pack #<N>.
    }
    else .quote notice $nick :Unrecognized request. Try /CTCP $me XDCC HELP.
    .timer 1 1 close -m $nick
  }
}
on 1:SENDFAIL:* {
  if (($qlen >= 1) && ($send(0) <= %maxslots)) psend $read -l1 $tp(queue.txt) queue
  if ($window(@Xdcc)) x.stat -u
}
on 1:FILESENT:* {
  if (($qlen >= 1) && ($send(0) <= %maxslots)) psend $read -l1 $tp(queue.txt) queue
  set %i 0
  :start
  inc %i
  if (($send(%i) == $null) || ($send(%i).cps == n/a)) goto end
  elseif (($nick == $send(%i)) && ($nopath($filename) == $send(%i).file)) {
    if (($send(%i).cps > %lrecord) && ($len($send(%i).cps) > 3)) {
      set %record $round($div($send(%i).cps,1000),1)
      set %lrecord $send(%i).cps
      iecho New record:  $+ $kps($send(%i).cps) $+ kb/s
      .quote notice $nick :New record set by you at  $+ $kps($send(%i).cps) $+ kb/s!
    }
  }
  else goto start
  :end
  if ($window(@Xdcc)) x.stat -u
}
alias cs {
  set %i 0
  :start
  inc %i
  if ($send(%i) == $null) goto end
  if ($send(%i).status == inactive) close -s $send(%i) $send(%i).file
  psend $read -l1 $tp(queue.txt) queue
  goto start
  :end
}
alias psend {
  if (($2 > %numpacks) || ($2 == $null) || ($send(0) >= %maxslots)) halt
  if ($3 == queue) write -dl1 $tp(queue.txt)
  .quote notice $1 :Ready to send  $+ %filedesc [ $+ [ $2 ] ] $+ , you will need  $+ [ $alof($lof($remove(%file [ $+ [ $2 ] ] ,"))) ] $+  free.
  inc %get [ $+ [ $2 ] ]
  .timer 1 %chsend checksend $1 [ $remove($nopath(%file [ $+ [ $2 ] ] ),") ]
  if (%minsp [ $+ [ $2 ] ] != $null) .timer 1 50 checkspeed $1 $remove($nopath(%file [ $+ [ $2 ] ] ),") [ %minsp [ $+ [ $2 ] ] ]
  elseif (%msall == on) .timer 1 50 checkspeed $1 $nopath(%file [ $+ [ $2 ] ] ) %allspeed
  dcc send $1 [ %file [ $+ [ $2 ] ] ]
}
alias checksend {
  set %i 0
  :start
  inc %i
  if ($send(%i) == $null) halt
  elseif (($send(%i) == $1) && ($send(%i).file == $2) && ($send(%i).status == waiting)) {
    close -s $1 $2
    .quote notice $1 :Timeout: $2
    iecho One or more DCC SENDs to $hc($1) have timed out.
    if (($qlen >= 1) && ($send(0) <= %maxslots)) psend $read -l1 $tp(queue.txt) queue
  }
  else goto start
}
alias tml {
  set %g 0
  set %tml 0
  set %tmp01 0
  :begin
  inc %g
  if (%g <= %numpacks) {
    %tmp02 = %get [ $+ [ %g ] ] * $lof( $remove(%file [ $+ [ %g ] ] ,") )
    inc %tmp01 %tmp02
    goto begin
  }
  else {
    set %tml $round($div(%tmp01,1000000),1)
    unset %tmp*
    return %tml
  }
}
alias tmo {
  set %i 0
  set %tmp.x 0
  :start
  inc %i
  if (%file [ $+ [ %i ] ] == $null) {
    set %tmp2 $round($calc(%tmp.x /1000000),1)
    %tmp1 = %tmp.x % 1000000
    if ($len(%tmp1) < 6) set %tmp1 1
    unset %tmp.*
    return %tmp2
  }
  else {
    inc %tmp.x $lof( $remove(%file [ $+ [ %i ] ] ,") )
    goto start
  }
}
alias pmin {
  if (($2 == $null) || ($1 > %numpacks)) iecho Syntax: /pmin <pack #> <minspeed in kb/s>
  else {
    if ($2 == 0) {
      unset %minsp [ $+ [ $1 ] ]
      iecho Removed minspeed for pack $hc($1) $+ .
    }
    else {
      set %minsp [ $+ [ $1 ] ] [ $2 * 1000 ]
      iecho Minspeed for Pack $1 $+ : $2 $+ kb/s.
    }
  }
}
alias minspeed {
  if ($1) {
    if ($1 == 0) {
      set %msall off
      unset %allspeed
      iecho Removed minspeed.
    }
    else {
      set %msall on
      set %allspeed $mpy($1,1000)
      iecho Minspeed is now: $1 $+ kb/s
    }
  }
  else iecho Syntax: /minspeed <minspeed in kb/s>
}
alias doffer {
  unset %pack %nopath %ngets %qds %numpacks %num %showsum %tmp* %tmo %xc %fsize* %g %tml %msall %allspeed %minsp* %file* %fcomment* %record %lrecord %get*
  window -c @Xdcc
  $timoff(%xdcc.timer1,xdcc.timer1)
  .remove $tp(xstatus.txt)
  iecho All packs have been deleted.
  cq
}
alias addpack {
  if (%numpacks == $null) set %numpacks 0
  set %num $pls(1,%numpacks)
  set %get [ $+ [ %num ] ] 0
  set %filedesc [ $+ [ %num ] ] $$?="Pack Description for [ [ %num ] $+ ] :"
  set %fcomment [ $+ [ %num ] ] $?="Comment for [ %num ] Press Cancel for None:"
  set %file [ $+ [ %num ] ] " $+ $dir="Select File for Pack [ %num ] "  *.* $+ "
  set %numpacks %num
  iecho Pack $hc(%num) has been added.
  unset %num
}
alias editpack {
  if ($1 == $null) iecho Syntax: /editpack <pack #>
  else {
    set %num $1
    set %get [ $+ [ %num ] ] 0
    set %filedesc [ $+ [ %num ] ] $$?="Pack Description for [ [ %num ] $+ ] :"
    set %fcomment [ $+ [ %num ] ] $?="Comment for [ %num ] Press Cancel for None:"
    set %file [ $+ [ %num ] ] $dir="Select File for Pack [ %num ] "  *.*
    set %numpacks %num
    iecho Pack $hc(%num) has been edited.
    unset %num
    tmo
  }
}
alias delpack {
  if ($1 == $null) iecho Syntax: /delpack <pack #>
  elseif ((%numpacks == 0) || (%numpacks == $null)) iecho You have no offer set.
  elseif ($1 > %numpacks) iecho You have only $hc(%numpacks) pack(s) offered.
  elseif (%numpacks == 1) doffer
  elseif ($1 == %numpacks) {
    unset %file $+ [ $1 ]
    unset %filedesc $+ [ $1 ]
    unset %get $+ [ $1 ]
    unset %fcomment $+ [ $1 ]
    set %numpacks $sub(%numpacks,1)
    iecho Pack $hc($1) has been removed.
  }
  else {
    set %i $1
    :start
    inc %i
    if (%i <= %numpacks) {
      set %file $+ [ $sub(%i,1) ] [ %file [ $+ [ %i ] ] ]
      set %get $+ [ $sub(%i,1) ] [ %get [ $+ [ %i ] ] ]
      set %filedesc $+ [ $sub(%i,1) ] [ %filedesc [ $+ [ %i ] ] ]
      .save -rv vars.mrc
      write -ds%fcomment [ $+ [ $sub(%i,1) ] ] vars.mrc
      .load -rv vars.mrc
      if (%fcomment [ $+ [ %i ] ] != $null) set %fcomment $+ [ $sub(%i,1) ] [ %fcomment [ $+ [ %i ] ] ]
      goto start
    }
    .save -rv vars.mrc
    write -ds%file [ $+ [ %numpacks ] ] vars.mrc
    write -ds%filedesc [ $+ [ %numpacks ] ] vars.mrc
    write -ds%get [ $+ [ %numpacks ] ] vars.mrc
    write -ds%fcomment [ $+ [ %numpacks ] ] vars.mrc
    .load -rv vars.mrc
    set %numpacks $sub(%numpacks,1)
    iecho Pack $hc($1) has been removed.
  }
}
alias fsize {
  %tmp.y = $remove(%file [ $+ [ %num ] ] ,")
  if ($lof(%tmp.y) < 1000) %fsize = $lof(%tmp.y) $+ b
  elseif (($lof(%tmp.y) >= 1000) && ($lof(%tmp.y) < 1000000)) {
    %fsize = $lof(%tmp.y) / 1000
    if ($len(%fsize) == 3) %fsize = $round(%fsize,0) $+ k
    else %fsize = $round(%fsize,1) $+ k
  }
  else {
    %fsize = $lof(%tmp.y) / 1000000
    %fsize = $round(%fsize,1) $+ m
  }
  return %fsize
}
alias nlist {
  if ((%numpacks == 0) || (%numpacks == $null)) iecho You have no packs to offer.
  else {
    if ($1 == $null) {
      iecho $hc(NLIST) sent to $hc($active) at $hc($atime) $+ .
      set %xc qnotice $active
    }
    else {
      iecho $hc(NLIST) sent to $hc($1) at $hc($atime) $+ .
      set %xc qnotice $1
    }
    sdcc
  }
}
alias plist {
  if ((%numpacks == 0) || (%numpacks == $null)) iecho You have no packs to offer.
  else {
    if ($1 == $null) {
      iecho $hc(PLIST) sent to all channels at $hc($atime) $+ .
      set %xc .amsg
    }
    else {
      iecho $hc(PLIST) sent to $hc($1) at $hc($atime) $+ .
      set %xc qmsg $1
    }
    sdcc
  }
}
alias oplist {
  if ((%numpacks == 0) || (%numpacks == $null)) iecho You have no packs to offer.
  else {
    if ($1 == $null) {
      iecho $hc(NLIST) sent to $hc($active ops) at $hc($atime) $+ .
      set %xc xwall $active
    }
    else {
      iecho $hc(NLIST) sent to $hc(#$$1 ops) at $hc($atime) $+ .
      set %xc xwall #$$1
    }
    sdcc
  }
}
alias sdcc {
  %xc :: smurf packs offered :: ( $+ %numpacks $+ ), '/ctcp $me xdcc help'
  if (%msall == on) %xc Slots ( $+ $sub(%maxslots,$send(0)) $+ / $+ %maxslots $+ ) Queue ( $+ $qlen $+ / $+ %maxqueue $+ ) Min ( $+ $div(%allspeed,1000) $+ kb/s) Record ( $+ %record $+ kb/s)
  else %xc Slots ( $+ $sub(%maxslots,$send(0)) $+ / $+ %maxslots $+ ) Queue ( $+ $qlen $+ / $+ %maxqueue $+ ) Record ( $+ %record $+ kb/s)
  set %num 0
  :start
  inc %num
  if (%num <= %numpacks) {
    set %tmp %get [ $+ [ %num ] ]
    %xc ( $+ $xlfix(2,%num) $+ ) $bld($chr(91)) $+ $lfix(3,%tmp) $+ x / $lfix(5,$fsize(%num)) $bld($chr(93)) %filedesc [ $+ [ %num ] ]
    if (%fcomment [ $+ [ %num ] ] == $null) goto start
    else %xc   ^- %fcomment [ $+ [ %num ] ]
    goto start
  }
  if (%showsum == y) %xc Total Offered ( $+ $tmo $+ m) Total Leeched ( $+ $tml $+ m)
}
alias xlfix set %tmp1 $sub($1,$len($strip($2-))) | return $str( ,%tmp1) $+  $+ $2-
alias checkspeed {
  set %i 0
  :start
  inc %i
  if ($send(%i) == $null) halt
  elseif (($send(%i) == $1) && ($send(%i).file == $2)) {
    if ($send(%i).status == waiting) {
      .quote notice $1 :You have DCCs pending. Type /DCC GET $me $+ .
      .timer 1 20 checkspeed *1
    }
    elseif ($send(%i).cps < $3) {
      set %mstime $div($send(%i).cps,1000)
      close -s $1 $2
      .quote notice $1 :MINSPEED: %mstime $+ kb/sec less than $div($3,1000)  $+ kb/sec: Closing connection.
      if ($window(@Xdcc)) x.stat -u
      if (($qlen >= 1) && ($send(0) <= %maxslots)) psend $read -l1 $tp(queue.txt) queue
    }
  }
  else goto start
}
alias xdccload {
  if ($1 == $null) iecho Syntax: /xdccload <offer name>
  elseif ($readini $td(xdcc.txt) $1 numpacks == $null) iecho No such offer in xdcc save.
  else {
    set %i 0
    if ($readini -n $td(xdcc.txt) $1 summary == y) set %showsum y
    else set %showsum n
    %numpacks = $readini $td(xdcc.txt) $1 numpacks
    :start
    inc %i
    if (%i > %numpacks) iecho XDCC offer $hc($1) has been loaded.
    else {
      set %file [ $+ [ %i ] ] $readini $td(xdcc.txt) $1 file [ $+ [ %i ] ]
      set %filedesc [ $+ [ %i ] ] $readini $td(xdcc.txt) $1 desc [ $+ [ %i ] ]
      set %get [ $+ [ %i ] ] $readini $td(xdcc.txt) $1 get [ $+ [ %i ] ]
      if ($readini $td(xdcc.txt) $1 fc [ $+ [ %i ] ] == yes) set %fcomment [ $+ [ %i ] ] $readini $td(xdcc.txt) $1 comment [ $+ [ %i ] ]
      goto start
    }
  }
}
alias xdccsave {
  if ($1 == $null) iecho Syntax: /xdccsave <offer name>
  elseif ((%numpacks == 0) || (%numpacks == $null)) iecho No offer to save.
  else {
    set %i 0
    if (%showsum == y) writeini $td(xdcc.txt) $1 summary y
    writeini $td(xdcc.txt) $1 numpacks %numpacks
    :start
    inc %i
    if (%i > %numpacks) iecho XDCC offer $hc($1) has been saved.
    else {
      writeini $td(xdcc.txt) $1 file [ $+ [ %i ] ] %file [ $+ [ %i ] ]
      writeini $td(xdcc.txt) $1 get [ $+ [ %i ] ] %get [ $+ [ %i ] ]
      writeini $td(xdcc.txt) $1 desc [ $+ [ %i ] ] %filedesc [ $+ [ %i ] ]
      if (%fcomment [ $+ [ %i ] ] != $null) {
        writeini $td(xdcc.txt) $1 comment [ $+ [ %i ] ] %fcomment [ $+ [ %i ] ]
        writeini $td(xdcc.txt) $1 fc [ $+ [ %i ] ] yes
      }
      goto start
    }
  }
}
alias qs {
  if ($qlen == 0) $timoff(%xdcc.timer2,xdcc.timer2)
  set %i 0
  :start
  inc %i
  if (%i > $qlen) cs
  else {
    %qs = $read -l [ $+ [ %i ] ] $tp(queue.txt)
    .quote notice $rm(%qs) :You are in queue position %i of %maxqueue $+ .
    goto start
  }
}
alias pchannels {
  if ($1 ischan) {
    .timer 0 %tc plist $1
    if ($1 == $null) iecho Sending PLIST to all channels every $hc($div(%tc,60)) minutes.
    else iecho Sending PLIST to $hc($1) every $hc($div(%tc,60)) minutes.
  }
  else {
    .timer 0 %tc plist $?="Enter channel to send plist to (cancel for all):"
    if ($! == $null) iecho Sending PLIST to all channels every $hc($div(%tc,60)) minutes.
    else iecho Sending PLIST to $hc($!) every $hc($div(%tc,60)) minutes.
  }
}
alias pmsg {
  set %pmsg $?="Enter channel to send pmsg to (cancel for all)"
  if (%pmsg == $null) set %pmg ame
  else set %pmg describe %pmsg
  .timer 0 %tc %pmg is offering  $+ %numpacks $+  pack(s). Type '/CTCP $me XDCC LIST' for a complete listing.
  if (%pmsg == ame) iecho Sending offer message to all channels every $hc($div(%tc,60)) minutes.
  else iecho Sending offer message to $hc($!) every $hc($div(%tc,60)) minutes.
  unset %pmg %pmsg
}
alias poff {
  if ($1) {
    set %i 0
    :start
    inc %i
    if ($timer(%i) == $null) iecho Unable to locate PLIST timer for $hc($1) $+ .
    elseif ($1 isin $timer(%i).com) {
      $timoff($timer(%i))
      iecho PLIST timer for $hc($1) has been halted.
    }
    else goto start
  }
  else {
    .timers off
    .timer 0 60 online
    .timer 0 3 tb
    if (%chanprot == on) { $timoff(%chantimer,chantimer) | .timer 0 600 cclr | set %chantimer $ltimer }
    if ((%idcheck == on) && (%idauto == on)) .timer 0 600 idchk
    if ($window(@Xdcc)) { .timer 0 3 if ($send(0) > 0) x.stat -u | set %xdcc.timer1 $ltimer }
    if ($window(@DCC)) { .timer 0 3 d.stat -u | set %xstat.timer $ltimer }
  }
}
alias xview {
  if ((%numpacks == 0) || (%numpacks == $null)) iecho You have no packs offered.
  else {
    window -a @Xview %xvloc @Xview
    set %xc aline @Xview $chr(160)
    sdcc
  }
}
alias xstatus {
  if ($1 == on) {
    set %xstatus on
    .timer 0 3 if ($send(0) > 0) x.stat -u
    set %xdcc.timer1 $ltimer
    x.stat -i
  }
  elseif ($1 == off) {
    set %xstatus off
    if ($window(@Xdcc)) set %xloc $swlc(@Xdcc)
    window -c @Xdcc
    $timoff(%xdcc.timer1,xdcc.timer1)
  }
  else iecho Syntax: /xstatus <on|off>
}
alias x.stat {
  if ($1 == -i) {
    if ($window(@Xdcc)) halt
    else {
      window -albdo @Xdcc %xloc @Xdcc Courier New 11
      aline @Xdcc $fix(2,$chr(35)) $fix(10,Nick) Pack $fix(5,Speed) P $+ $chr(37) Timeleft Elapsed
      set %i 0
      :start
      inc %i
      if (%i <= %maxslots)  {
        if (($send(%i)) && ($send(%i).status == active)) aline @Xdcc %i $+ . $fix(10,$send(%i)) $fix(4,$x.file($send(%i).file)) $lfix(5,$kps($send(%i).cps)) $lfix(2,$send(%i).pc) $center(8,$d.s($rsc($duration($div($sub($send(%i).size,$send(%i).sent),$send(%i).cps))))) $center(8,$d.s($rsc($duration($div($send(%i).sent,$send(%i).cps)))))
        elseif ($send(%i)) aline @Xdcc %i $+ . $fix(10,$send(%i)) $fix(4,$x.file($send(%i).file)) $lfix(5,0.00) $lfix(2,0) $str(0,3) $send(%i).status
        else aline @Xdcc %i $+ . $str( ,7) empty $str( ,10) slot
        goto start
      }
      else sline @Xdcc 2
    }
  }
  elseif ($1 == -u) {
    if ($window(@Xdcc) == $null) $timoff(%xdcc.timer1,xdcc.timer1)
    else {
      set %i 0
      :start
      inc %i
      if (%i <= %maxslots) {
        if (($send(%i)) && ($send(%i).status == active)) rline @Xdcc $pls(%i,1) %i $+ . $fix(10,$send(%i)) $fix(4,$x.file($send(%i).file)) $lfix(5,$kps($send(%i).cps)) $lfix(2,$send(%i).pc) $center(8,$d.s($rsc($duration($div($sub($send(%i).size,$send(%i).sent),$send(%i).cps))))) $center(8,$d.s($rsc($duration($div($send(%i).sent,$send(%i).cps)))))
        elseif ($send(%i)) rline @Xdcc $pls(%i,1) %i $+ . $fix(10,$send(%i)) $fix(4,$x.file($send(%i).file)) $lfix(5,0.00) $lfix(2,0) $str( ,3) $send(%i).status
        else rline @Xdcc $pls(%i,1) %i $+ . $str( ,7) empty $str( ,10) slot
        goto start
      }
      else sline @Xdcc 2
    }
  }
}
alias x.file {
  set %j 0
  :start
  inc %j
  if (%j > %numpacks) return n/a
  set %tmp.x %file [ $+ [ %j ] ]
  if ($nopath(%tmp.x) == $1) return %j
  else goto start
}
alias timelimit set %chsend $mpy(60,$$1) | iecho XDCC Send Timeout set to $hc($1) minutes.
alias maxslots set %maxslots $$1 | iecho Maximum slots set to $hc($1) slots.
alias qmax set %maxqueue $$1 | iecho Queue size set to $hc($1) slots.
alias ptime set %tc $mpy($$1,60) | iecho PLIST timer set to every $hc($1) minutes.
alias rm return $remove($remove($remove($remove($remove($remove($remove($remove($remove($remove($1-,1),2),3),4),5),6),7),8),9),0)
alias cq write -c $tp(queue.txt)
alias qlen {
  if ($exists($tp(queue.txt))) return $lines($tp(queue.txt))
  else return 0
}
menu @Xdcc {
  dclick if ($send($sub($1,1))) /close -s $send($sub($1,1)) $send($sub($1,1)).file
  exit { set %xloc $swlc(@Xdcc) | window -c @Xdcc | $timoff(%xdcc.timer1,xdcc.timer1) }
}
menu @Xview {
  dclick { set %xvloc $swlc(@Xview) | window -c @Xview }
  exit { set %xvloc $swlc(@Xview) | window -c @Xview }
}
menu Channel {
  xdcc
  .on/off
  ..on { xdcc on | halt }
  ..-
  ..off { xdcc off | halt }
  .-
  .offer
  ..all channels { plist | halt }
  ..notice chan { nlist | halt }
  ..current chan { plist # | halt }
  ..-
  ..timed msg
  ...select { pmsg | halt }
  ...-
  ...disable
  ....all { poff | halt }
  ....-
  ....one { poff $$?="Enter channel:" | halt }
  ..timed offer
  ...select { pchannels | halt }
  ...-
  ...disable
  ....all { poff | halt }
  ....-
  ....one { poff $$?="Enter channel:" | halt }
  ..-
  ..help { pophelp xoffer }
  .setup
  ..new offer { offer | halt }
  ..add pack { addpack | halt }
  ..dele pack { delpack $$?="Pack number to edit" | halt }
  ..edit pack
  ...description { xdcc desc $$?="pack number to edit:" | halt }
  ...comment { xdcc note $$?="pack number to edit:" | halt }
  ...minspeed { pmin $$?="pack number" $$?="minspeed in kb/s" | halt }
  ...change file { xdcc file $$?="pack number to edit:" | halt }
  ...-
  ...edit whole { editpack $$?="Pack number to edit" | halt }
  ..-
  ..queue { qmax $$?="queue size:" | halt }
  ..time limit { timelimit $$?="time limit in minutes:" | halt }
  ..max slots { maxslots $$?="maximum slots:" | halt }
  ..msg delay { ptime $$?="delay in minutes:" | halt }
  ..minspeed
  ...on { minspeed $$?="minspeed in kb/s:" | halt }
  ...off { minspeed 0 }
  ...-
  ...min { minspeed $$?="minspeed in kb/s:" | halt }
  ..summary
  ...on { set %showsum y | halt }
  ...-
  ...off { set %showsum n | halt }
  ..-
  ..load offer { xdccload $$?="Enter offer name to load:" | halt }
  ..save offer { xdccsave $$?="Enter offer name to save:" | halt }
  ..-
  ..del offer { doffer | halt }
  ..-
  ..help { pophelp xsetup }
  .status
  ..on { xstatus on | halt }
  ..-
  ..off { xstatus off | halt }
  ..-
  ..help { pophelp xstatus }
}