namehelp = 'You can use a ''_'' to create a shortcut in the \nrequester which pops up. ''S'' is already used,\nso don''t put a ''_'' in front of an ''S''.'
cmdlinehelp = 'You can use the following tokens, which will be\ntranslated before the commandline is executed.\n\n%%FileName -> name of the decoded file\n%%ThorScreen -> name of THOR''s public screen\n%%RequestDir -> name of dir gotten with a filerequester\n%%RequestFile -> name of file gotten with a filerequester\n\nAnd you may use either of these internal commands,\nwhich show data in THOR''s main listview.\n\nSHOWPICTURE %%FileName [CLEAR]\nSHOWTEXT %%FileName'
uucmdlinehelp = 'You MUST use the following tokens, which will be translated\nbefore the commandline is executed.\n\n%%TmpFile -> a temporary file for erroroutput from the uudecoder.\n You MUST redirect all output to this file.\n%%MsgFilename -> path and filename of the textfile with the file(s)\n%%DestDir -> destination directory for the decoding\n\nDo NOT use any real paths in this commandline, use only the tokens\ndescribed above. UUDecode.thor will not work correctly otherwise.'
/* Open THOR and BBSREAD ARexx ports' */
p=address()||' '||show('P',,);if pos('THOR.',p)>0 then thorport=word(substr(p,pos('THOR.',p)),1);else do;say 'No THOR port found!';exit(0);end
if ~show('p', 'BBSREAD') then do; address command; "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"; "WaitForPort BBSREAD"; end
address(thorport)
/* See if another copy of CfgUUDecode is already running */
if exists("T:CfgUUDecode.tmp") then
do
REQUESTNOTIFY '"Another copy of CfgUUDecode\nis probably running."' '"_Continue|_Abort"'
REQUESTLIST INSTEM menulist TITLE '"CfgUUDecode 1.1 by Troels Walsted Hansen"' SIZEGADGET
if rc ~= 0 then do
if exists("T:CfgUUDecode.tmp") then do
address(command)
"Delete T:CfgUUDecode.tmp QUIET"
end
exit(0)
end
choice = result
/* Check user input */
select
when choice = menulist.1 then
do
do i=1 to uudecoder.count
uumenu.i = uudecoder.i.longname
end
uumenu.count = uudecoder.count
address(thorport)
REQUESTLIST INSTEM uumenu TITLE '"Select uudecoder:"' SIZEGADGET
if rc ~= 0 then break
do i=1 to uudecoder.count
if(result = uudecoder.i.longname) then uudecoder = uudecoder.i.shortname
end
call writecfg(cfgfile)
end
when choice = menulist.2 then
do
address(thorport)
REQUESTSTRING TITLE '"Enter uudecoder path"' BT '"_Ok|_Cancel"' ID '"'uuprogpath'"' BODY '"You may either enter the path to your\nchosen uudecoder program here, or your\nmay leave the stringgadget empty if the\nuudecoder program is in your path."' MAXCHARS 256
REQUESTSTRING TITLE '"Enter temporary directory"' BT '"_Ok|_Cancel"' ID '"'tmpdir'"' BODY '"Enter a path to suitable temporary directory\nfor UUDecode.thor. If you intend to decode\nmany, large files it had better be a\ndirectory/device with plenty of space."' MAXCHARS 256
REQUESTSTRING TITLE '"Enter destination directory"' BT '"_Ok|_Cancel"' ID '"'destdir'"' BODY '"Enter a path to where you want all decoded files\nto end up. If you enter GLOBAL, the global\ndownload dir configured in THOR, will be used."' MAXCHARS 256
REQUESTNOTIFY TEXT '"Would you like to have UUDecode.thor add a\nfilenote to decoded files, stating who sent\nthe message, and in which conference and on\nwhich system the file was found?"' BT '"_Yes|_No"'
if(result = 0) then filenotes = 0
else filenotes = 1
call writecfg(cfgfile)
end
when choice = menulist.7 then
do
address(thorport)
REQUESTNOTIFY TEXT '"Would you like to have UUDecode.thor try\nto recognize the type of decoded files,\nbased on their extensions, in order to\nperform actions you define on them?"' BT '"_Yes|_No"'
if(result = 0) then filerecog = 0
else filerecog = 1
call writecfg(cfgfile)
end
when choice = menulist.9 then call cfgfiletype
when choice = menulist.10 then call cfguudecoder
when choice = menulist.12 then
do
address(thorport)
REQUESTNOTIFY TEXT '"Not implemented yet..."' BT '"_Ok"'
REQUESTLIST INSTEM menulist TITLE '"Configure filetypes"' SIZEGADGET
if rc ~= 0 then return
choice = result
if choice = menulist.1 then signal addfiletype
if choice = menulist.2 then signal editfiletype
if choice = menulist.3 then signal delfiletype
signal filetypemenu
addfiletype:
REQUESTSTRING TITLE '"Enter filetype name"' BODY '"Use a format like ''a picture'' or ''an archive'' if\nyou like grammatically correct sentences. :-)"' BT '"_Ok|_Cancel"' ID '"a"' MAXCHARS 80
if rc ~= 0 then signal filetypemenu
filetypecount = filetypecount + 1
filetype.filetypecount.name = result
namenr = filetypecount
filetype.namenr.actioncount = 0
edit = 0
signal editfiletypedata
editfiletype:
if filetypecount > 0 then
do
do n = 1 to filetypecount; filetypelist.n = filetype.n.name; end
filetypelist.count = filetypecount
REQUESTLIST INSTEM filetypelist TITLE '"Select a filetype"' SIZEGADGET
if rc ~= 0 then signal filetypemenu
thisname = result
do n = 1 to filetypecount; if thisname = filetype.n.name then namenr = n; end
end
else
do
REQUESTNOTIFY '"There are no configured filetypes."' '"_Abort"'
signal filetypemenu
end
edit = 1
editfiletypedata:
if(filetype.namenr.ext = 'FILETYPE.'namenr'.EXT') then filetype.namenr.ext = 'NONE'
REQUESTSTRING TITLE '"Enter fileextensions for this action"' BODY '"You may use comma to separate file-\nextensions which you want to match.\n'ALL' will match all files."' BT '"_Ok|_Cancel"' ID '"'filetype.namenr.ext'"' MAXCHARS 40
REQUESTSTRING TITLE '"Enter a commandline for this action"' BODY '"'cmdlinehelp'"' BT '"_Ok|_Cancel"' ID '"Run <>NIL: <COMMAND> *"%FileName*" PUBSCREEN=*"%ThorScreen*""' MAXCHARS 256
REQUESTLIST INSTEM menulist TITLE '"Configure uudecoders"' SIZEGADGET
if rc ~= 0 then return
choice = result
select
when choice = menulist.1 then
do
uudecoder.count = uudecoder.count + 1
uudecoders = uudecoder.count
REQUESTSTRING TITLE '"Enter a short name for this uudecoder"' BODY '"I.e. ''UUOUT'' or ''UUXT''."' BT '"_Ok|_Cancel"' ID '"UU"' MAXCHARS 40
if rc ~= 0 then
do
uudecoder.count = uudecoder.count - 1
signal uudecodermenu
end
else uudecoder.uudecoders.shortname = result
REQUESTSTRING TITLE '"Enter a long, descriptive name this uudecoder"' BODY '"I.e. ''uuOut v1.14 by Nicolas Dade''\nor ''UUxT v3.1 by Asher Feldman''"' BT '"_Ok|_Cancel"' ID '"UU vx.xx by John Doe"' MAXCHARS 256
if rc ~= 0 then
do
uudecoder.count = uudecoder.count - 1
signal uudecodermenu
end
else uudecoder.uudecoders.longname = result
REQUESTSTRING TITLE '"Enter a commandline for this uudecoder"' BODY '"'uucmdlinehelp'"' BT '"_Ok|_Cancel"' ID '"uu >%TmpFile FROM *"%MsgFilename*" TO *"%DestDir*""' MAXCHARS 256
if rc ~= 0 then
do
uudecoder.count = uudecoder.count - 1
signal uudecodermenu
end
else uudecoder.uudecoders.commandline = result
call writecfg(cfgfile)
end
when choice = 'HELP' then
do
REQUESTNOTIFY TEXT '"Not implemented yet..."' BT '"_Ok"'
/*call help('CFGuudecoder')*/
end
otherwise
do
do i = 1 to uudecoder.count
if choice = uudecoder.i.longname then
do
REQUESTNOTIFY '"Do you want to edit\nor delete this item?"' '"_Edit|_Delete"'
if result = 0 then
do
REQUESTNOTIFY '"Sure you want to remove\n'choice'\nas a uudecoder?"' '"_Yes|_No"'
if result = 1 then
do
k = 1
do j = 1 to uudecoder.count
if uudecoder.j.longname ~= choice then
do
uudecoder.k.longname = uudecoder.j.longname
uudecoder.k.shortname = uudecoder.j.shortname
uudecoder.k.commandline = uudecoder.j.commandline
k = k + 1
end
end
uudecoder.count = uudecoder.count - 1
call writecfg(cfgfile)
end
end
else
do
REQUESTSTRING TITLE '"Edit uudecoder short name"' BODY '"I.e. ''UUOUT'' or ''UUXT''."' BT '"_Ok|_Cancel"' ID '"'uudecoder.i.shortname'"' MAXCHARS 40
if rc = 0 then
do
uudecoder.i.shortname = result
REQUESTSTRING TITLE '"Enter a long, descriptive name this uudecoder"' BODY '"I.e. ''uuOut v1.14 by Nicolas Dade''\nor ''UUxT v3.1 by Asher Feldman''"' BT '"_Ok|_Cancel"' ID '"'uudecoder.i.longname'"' MAXCHARS 256