mIRCDrop (CSB) — File Browser
mIRCDropCSBv1.1b / mIRCDropCSBv1.1b / csb / data / fserv.ini
fserv.ini — 9.59 KB — Download this file
[script]
n0=; fserve(1.0) for mDrop by S_C_A_R
n1=
n2=; start script.
n3=
n4=; /fserv on/off
n5=
n6=alias fserv {
n7= if ($1 == on) {
n8= if (!$fsrv(chans,options)) { fsrv.disp no channels specified, /fserv -d for options | halt }
n9= wfsrv options ticks $ticks
n10= .timerfsrv.ad 0 300 msg.fsrv.ad
n11= .timerfsrv.checkq 0 10 check.q
n12= msg.fsrv.ad
n13= fsrv.disp server has been started.
n14= }
n15= if ($1 == off) {
n16= if ($input(Are you sure?,8)) {
n17= .timerfsrv.checkq off
n18= .timerfsrv.ad off
n19= .timerchk.cps* off
n20= fsrv.disp server has been halted.
n21= }
n22= }
n23= if ($1 == +b) {
n24= if ($fsrv($2,bans)) { wfsrv bans $2 $iif($3,$3,no reason) | fsrv.disp ban updated. | halt }
n25= if (*!*@* !iswm $2) { fsrv.disp invalid banmask type (use format *!*@*) | halt }
n26= wfsrv bans $2 $iif($3,$3,no reason) | fsrv.disp ban added ( $+ $2 reason: $iif($3,$3,none) $+ )
n27= }
n28= if ($1 == -b) {
n29= if ($ini(data\fserve.ini,bans,0) == 0) { fsrv.disp no bans matching $gettok($2,1,$asc(!)) found. | halt }
n30= var %i = 1
n31= while ($ini(data\fserve.ini,bans,%i)) {
n32= $ini(data\fserve.ini,bans,%i)
n33= }
n34= }
n35=}
n36=
n37=; trigger/!list
n38=on *:text:!*:#:if ($1- == $fsrv(trig,options)) && ($chan isin $fsrv(chans,options)) fserve $nick 1000 $fsrv(dir,options) $fsrv(welcome,options)
n39=
n40=; fileserver startup
n41=on *:open:!:{
n42= mn fserve( $+ $fsrv(ver,options) $+ ) for mIRCDrop (http://PoisonXScript.cjb.net) by S_C_A_R
n43= mn sends: $send(0) $+ / $+ $fsrv(totalsends,options) $+ , queues: $queues(0) $+ / $+ $fsrv(totalqueues,options) - record cps: $fsize($gettok($fsrv(recordcps,options),1,32)) $+ /s
n44= mn -
n45=}
n46=
n47=; fileserver commands.
n48=on *:serv:*:{
n49= if ($1 == sends) {
n50= if ($send(0) == 0) { mn no sends in progress.. | halt }
n51= var %i = 1
n52= while ($send(%i)) { mn send $chr(35) $+ %i ( $+ $send(%i) $+ ), file: $nopath($send(%i).file) $+ , sending at $fsize($send(%i).cps) $+ /s, sent $fsize($send(%i).sent) $+ / $+ $fsize($send(%i).size) ( $+ $send(%i).pc $+ $chr($asc(%)) $+ ), about $_dur($calc(($send(%i).size - $send(%i).sent) / $send(%i).cps)) left, $fsize($calc($send(%i).size - $send(%i).sent))) to go, time elapsed: $_dur($send(%i).secs) | inc %i }
n53= halt
n54= }
n55= if ($1 == queues) {
n56= if ($queues(0) == 0) || (!$window(@queues)) { mn no waiting.. | wfsrv options queues.in.use 0 | halt }
n57= var %i = 1
n58= while ($line(@queues,%i)) { mn queue $chr(35) $+ %i $gettok($line(@queues,%i),1,23) queued: $nopath($gettok($line(@queues,%i),2,23)) $+ ( $+ $fsize($file($gettok($line(@queues,%i),2,23)).size) $+ ) | inc %i }
n59= halt
n60= }
n61= if ($1 == get) {
n62= if (!$2-) { inc -u15 %tmp.f.request | if (%tmp.f.request == 3) { mn you're stupid. | close -f $nick | unset %tmp.f.request | halt } | mn get what? | halt }
n63= set %tmp.f.file $fserv($nick).cd $+ \ [ $+ [ $2- ] ]
n64= if ($issendfile($nick,$2-)) { inc -u15 %tmp.f.request | if (%tmp.f.request == 3) { mn can't you read? | close -f $nick | unset %tmp.f.request | halt } | mn you are already getting that file. | halt }
n65= if ($exists(%tmp.f.file)) {
n66= if ($queues(0) >= $fsrv(totalqueues,options)) { mn unable to queue your request, too many queues (ques: $queues(0) $+ ). | halt }
n67= if ($send($nick) >= $fsrv(maxsends,options)) || ($send(0) >= $fsrv(totalsends,options)) {
n68= if ($queues($nick) < $fsrv(maxqueues,options)) {
n69= if ($isqueue($nick,%tmp.f.file)) { inc -u15 tmp.f.request | if (%tmp.f.request == 3) { mn can't you read? | close -f $nick | unset %tmp.f.request | halt } | mn you already have that file in queue $chr(35) $+ $isqueue($nick,%tmp.f.file) | halt }
n70= que.file $nick %tmp.f.file
n71= mn queueing $2- $+ ( $+ $fsize($file(%tmp.f.file).size) $+ ), too many downloads in progress, file will be sent when slots are available. (queue: $queues(0) $+ )
n72= halt
n73= }
n74= mn unable to queue your request, $iif($fsrv(maxqueues,options) == 0,no queues allowed.,you have too many files in queue.)
n75= halt
n76= }
n77= mn sending $2- $+ ( $+ $fsize($file(%tmp.f.file).size) $+ )
n78= }
n79= elseif (!$exists($shortfn(%tmp.f.file))) { inc -u15 %tmp.f.request | if (%tmp.f.request == 3) { mn you just don't get it do you? | close -f $nick | unset %tmp.f.request | halt } | mn no such file | halt }
n80= .timerchk.cps [ $+ [ $nick ] ] 0 15 chk.cps $nick
n81= }
n82=}
n83=
n84=; local aliases
n85=alias -l mn if ($fserv($nick)) .msg = [ $+ [ $nick ] ] $1-
n86=alias queues {
n87= if ($1- == 0) return $iif($fsrv(queues.in.use,options),$fsrv(queues.in.use,options),0)
n88= else {
n89= if ($fsrv(queues.in.use,options) == 0) || (!$window(@queues)) return 0
n90= var %i = 1, %l, %q = 0
n91= while (%i <= $line(@queues,0)) {
n92= %l = $line(@queues,%i)
n93= if ($1 == $gettok(%l,1,23)) inc %q
n94= inc %i
n95= }
n96= return %q
n97= }
n98=}
n99=alias -l que.file if (!$window(@queues)) window -hnl @queues | aline -l @queues $1 $+ $chr(23) $+ $2- $+ $chr(23) $+ $ticks | wfsrv options queues.in.use $calc($queues(0) +1)
n100=alias -l send.next.que if (!$window(@queues)) { wfsrv options queues.in.use 0 | halt } | if ($queues(0) > 0) && ($send(0) < $fsrv(totalsends,options)) { sline -a @queues 1 | .notice $gettok($sline(@queues,1),1,23) After waiting $duration($calc(($ticks - $gettok($sline(@queues,1),3,23)) / 1000)) $+ , your file ( $+ $nopath($gettok($sline(@queues,1),2,23)) $+ ) is now being sent. | dcc send $gettok($sline(@queues,1),1,23) " $+ $gettok($sline(@queues,1),2,23) $+ " | dline @queues 1 | wfsrv options queues.in.use $calc($queues(0) -1) }
n101=alias -l _dur return $gettok($replace($duration($1-),wks,w,wk,w,days,d,day,d,secs,s,mins,m,hrs,h,sec,s,min,m,hr,h),1,32)
n102=alias -l issendfile {
n103= var %i = 1
n104= while ($send($1,%i)) {
n105= if ($2 == $send($1,%i).file) { return $true }
n106= inc %i
n107= }
n108= return $false
n109=}
n110=alias isqueue {
n111= if (!$window(@queues)) || ($queues(0) == 0) return $null
n112= var %i = 1
n113= while ($gettok($line(@queues,%i),1,23)) {
n114= if ($gettok($line(@queues,%i),1,23) == $1) && ($2 == $gettok($line(@queues,%i),2,23)) { return %i }
n115= inc %i
n116= }
n117= return $null
n118=}
n119=; global aliases
n120=alias fsrv.disp echo -a * /fserv: $1-
n121=alias fsrv return $readini(data\fserve.ini,$2,$1)
n122=alias msg.fsrv.ad {
n123= var %c = $replace($fsrv(chans,options),$chr(32),$chr(44),$str($chr(44),2),$chr(44)), %i = 1, %chan
n124= while (%i <= $calc($count(%c,$chr(44)) +1)) {
n125= %chan = $gettok(%c,%i,44)
n126= if ($me ison %chan) msg %chan [fserve] uptime: $_dur($calc(($ticks - $fsrv(ticks,options)) / 1000))) 路 trig: $fsrv(trig,options) 路 online: $fserv(0) 路 sends: $send(0) $+ / $+ $fsrv(totalsends,options) 路 queues: $queues(0) $+ / $+ $fsrv(totalqueues,options) 路 record cps: $fsize($gettok($fsrv(recordcps,options),1,32)) $+ /s by $gettok($fsrv(recordcps,options),2,32) 路 min cps: $fsize($fsrv(mincps,options)) $+ /s 路 sent: $fsize($fsrv(bytessent,options)) 路 note: $fsrv(note,options) [mdrop]
n127= inc %i
n128= }
n129=}
n130=alias check.q { if (!$window(@queues)) { wfsrv options queues.in.use 0 } }
n131=alias wfsrv writeini data\fserve.ini $1 $2 $3-
n132=alias fsize { if ($1 < 0) || ($1 !isnum) { return n/a } | if ($round($calc($1 / 1000000000024),2) >= 1) { return $round($calc($1 / 1099511627776),2) $+ tb } | if ($round($calc($1 / 1000000024),2) >= 1) { return $round($calc($1 / 1073741824),2) $+ gb } | if ($round($calc($1 / 1000024),1) >= 1) { return $round($calc($1 / 1048576),1) $+ mb } | if ($round($calc($1 / 1024),1) >= 1) { return $round($calc($1 / 1024),1) $+ kb } | return $int($1) $+ b }
n133=alias chk.cps {
n134= if ($send($1) == 0) { .timerchk.cps [ $+ [ $1 ] ] off | halt }
n135= var %i = 1
n136= while ($send($1,%i)) {
n137= if ($send($1,%i).cps < $fsrv(mincps,options)) && ($send($1,%i).status == active) {
n138= .notice $1 Your send ( $+ $send($1,%i).file $+ ) was cancelled because it was going too slow.. (min speed: $fsize($fsrv(mincps,options)) $+ /s)
n139= close -s [ $+ [ %i ] ] $1
n140= .timer 1 1 send.next.que
n141= }
n142= if ($send($1,0) == 0) .timerchk.cps [ $+ [ $1 ] ] off
n143= inc %i
n144= }
n145=}
n146=
n147=; other events
n148=on *:filesent:*:if ($send($nick).cps > $gettok($fsrv(recordcps,options),1,32)) wfsrv options recordcps $send($nick).cps $nick | .timer 1 1 send.next.que | wfsrv options bytessent $calc($fsrv(bytessent,options) + $file($filename).size)
n149=on *:sendfail:*:.timer 1 1 send.next.que
n150=on *:part:#:if ($send($nick)) { .notice $nick Your sends have been cancelled because you left $chan $+ . | close -s $nick | .timer 1 1 send.next.que }
n151=on *:quit:if ($send($nick)) { close -s $nick | .timer 1 1 send.next.que }
n152=
n153=; menus
n154=
n155=menu nicklist,query {
n156= fs&erve
n157= .ban
n158= ..quick:fserv +b $address($1,2)
n159= ..add
n160= ...$address($1,1):fserv +b $address($1,1) $input(reason (leave blank for none),1)
n161= ...$address($1,2):fserv +b $address($1,2) $input(reason (leave blank for none),1)
n162= ...$address($1,3):fserv +b $address($1,3) $input(reason (leave blank for none),1)
n163= ...$address($1,4):fserv +b $address($1,4) $input(reason (leave blank for none),1)
n164= ...$address($1,5):fserv +b $address($1,5) $input(reason (leave blank for none),1)
n165= ..unban:fserv -b $address($1,5)
n166=}