/* ========================== */
/*  Mo-Down v1.00 sAFRA 1999  */
/* ========================== */

parse arg node
options results
address value "AERexxControl"node

ac = "[35m" ; bc = "[32m" ; cc = "[33m" ; dc = "[34m" ; ec = "[0m"
zc = "[36m" ; gt=GETUSER ; tr=TRANSMIT ; sm=SENDMESSAGE ; CLS=""

call addlib('rexxtricks.library',0,-30,0)

signal on syntax

header="doors:modown/header.txt"
tailer="doors:modown/tailer.txt"

gt 126 ; confname=result
fize=confname
gt 127 ; conf=strip(result,'t','/')
many=gettooltypevalue(conf,'NDIRS')

if many="" then do
tr ""
tr ec"The 'NDIRS=' CFG for this CONF does not exist! Inform SYSOP!"
tr ""
call exit
end

if many="0" then do
tr ""
tr ec"Config for this conference tells me that zER0 DIRs are available!"
tr ""
call exit
end

hany=right(many,2,' ')

confname=compress(confname,'-, ,:,!,/,>,<')
confname=left(confname,15)
confname=strip(confname,'B')

call main
call exit

MAIN:
check=0
if exists('t:'node||confname'.lha') then do
address command "c:delete >NIL: t:"node||confname".lha"
end

if exists("t:"node||confname".lzx") then do
address command "c:delete >NIL: t:"node||confname".lzx"
end

if exists("t:"node||confname".zip") then do
address command "c:delete >NIL: t:"node||confname".zip"
end

if exists('t:MoDown'node) then address command "c:delete >NIL: t:MoDown"node" all"
address command "c:makedir >NIL: T:MoDown"node

fize=left(fize,32,' ')
sm cls
tr ""
tr dc"[ "cc"Mo-Down v1.00"dc" - "bc"sAFRA/99"dc" ]"
tr ""
tr dc"[ "cc||fize||dc" ][ "cc"Which Directory: "ec"1"bc" -"ec||hany||dc" ]"dc"[ "ec"A"cc"-ll"dc" ]"dc"[ "ec"Q"cc"-uit"dc" ]"

tr ""
sm dc"[ "ec"Make your choice:"dc" ] "bc ; query ; whatis=result

if whatis="a" then call choseall

if whatis="q" then do
tr ""
call exit
end

if whatis="" then do
tr ""
call exit
end

if ~exists(conf"/DIR"whatis) then do
tr ""
tr ec"  That was either: "cc"An invalid choice!"
tr cc"                   Or the requested DIR listing is missing!"
tr ""
sm bc"                   Hit a key!"
getchar
call main
end

tr ""
sm dc"[ "cc"Copying..."dc" ] "
tr ""
address command "c:copy >NIL: "conf"/DIR"whatis" to T:MoDown"node"/"whatis"-"confname
call moveon

call exit

CHOSEALL:
 check=1
 tr ""
 sm dc"[ "cc"Copying..."dc" ] "
 do i=1 to many
 address command "c:copy >NIL: "conf"/DIR"i" to T:MoDown"node"/"i"-"confname
 end
 tr ""
 call MOVEON

SHIT:
tr ""
tr ""
tr ac"You chose [ALL] so you will have to pack them!"
sm ac"Or download individually! "
getchar
call main

MOVEON:
tr ""
tr dc"[ "cc"Select which packer to use:"dc" ]"
tr ""
tr dc"[ "ec"1"dc" ]"bc" LHA"
tr dc"[ "ec"2"dc" ]"bc" LZX"
tr dc"[ "ec"3"dc" ]"bc" ZIP"
tr dc"[ "ec"4"dc" ]"bc" NONE"
tr dc"[ "ec"Q"dc" ]"bc" QUIT"
tr ""
sm dc"[ "cc"Choice: "dc"] "

do forever
getchar
if result="1" then call lha
if result="2" then call lzx
if result="3" then call zip
if result="4" & check=0 then call none
if result="4" & check=1 then call shit
if result="q" then call main
end

LHA:
tr""
tr""
sm dc"[ "ac"LHA Pack...Please wait..."dc" ] "
address command "C:LHA -X a T:"node||confname".lha T:MoDown"node
tr ""
tr ""
sm dc"[ "ec"Done! Hit a key to receive!"dc" ] "
getchar
tr ""
putustr "T:"node||confname".lha"
putuser 137
if exists("t:"node||confname".lha") then do
address command "c:delete >NIL: t:"node||confname".lha"
end
call main

LZX:
tr""
tr""
sm dc"[ "ac"LZX Pack...Please wait..."dc" ] "
address command "C:LZX -X a T:"node||confname".lzx T:MoDown"node
tr ""
tr ""
sm dc"[ "ec"Done! Hit a key to receive!"dc" ] "
getchar
tr ""
putustr "T:"node||confname".lzx"
putuser 137
if exists("t:"node||confname".lzx") then do
address command "c:delete >NIL: t:"node||confname".lzx"
end
call main

ZIP:
tr""
tr""
sm dc"[ "ac"ZIP Pack...Please wait..."dc" ] "
address command "C:ZIP -r -j T:"node||confname".zip T:MoDown"node
tr ""
tr ""
sm dc"[ "ec"Done! Hit a key to receive!"dc" ] "
getchar
tr ""
putustr "T:"node||confname".zip"
putuser 137
if exists("t:"node||confname".zip") then do
address command "c:delete >NIL: t:"node||confname".zip"
end
call main

NONE:
tr ""
tr ""
sm dc"[ "ec"Hit a key to receive!"dc" ] "
getchar
putustr "T:MoDown"node"/"whatis"-"confname
putuser 137
call main

EXIT:
SHUTDOWN
EXIT
END

SYNTAX:
tr "An error has occured in line: "sigl" Please notify SYSOP."
SHUTDOWN
EXIT
END

