/* ** $VER: ParseGrabs.br 1.0 (28.8.95) ** ** ParseGrabs.br will check for any grabs in the download directory and ** parse them. If there are active events which have not been deleted it ** will list these events and then ask the user whether to delete them or ** not. ** ** Requires C:List, C:Delete, C:Ask and C:Resident to be present. ** ** Set makeresident to 1 below for some extra speed. ** ** Todo: GUI interface if run from Thor ** */ options results pubscreen = "Workbench" /* Public screen to open progressbars on, usually "Workbench" */ makeresident = 1 /* Make list resident before starting. 0 = FALSE, 1 = TRUE */ remresident = 1 /* Remove list from resident list after finishing. 0 = FALSE, 1 = TRUE */ /* Open Thor and BBSREAD ARexx ports' */ if ~show('p', 'BBSREAD') then do; address command; "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"; "WaitForPort BBSREAD"; end call open(pn, 'ENV:Thor/THORPATH', 'R') thorpath = readln(pn) call close(pn) address(bbsread) GETGLOBALDATA globdata if rc ~= 0 then do say BBSREAD.LASTERROR exit(0) end GETBBSLIST bbslist if rc ~= 0 then do say BBSREAD.LASTERROR exit(0) end if makeresident = 1 then address(command) 'Resident C:LIST PURE' if bbslist.COUNT > 0 then do i = 1 to bbslist.COUNT address(bbsread) GETBBSDATA '"'bbslist.i'"' bbsdata if rc ~= 0 then do say BBSREAD.LASTERROR exit(0) end if bbsdata.DNLOADPATH ~= '' then dlpath = bbsdata.DNLOADPATH else dlpath = globdata.DNLOADPATH address(command) 'List >T:GrabList 'dlpath || bbsdata.GRABNAME'#? LFORMAT "%s"' if exists("T:GrabList") then do call open(gl, "T:GrabList", 'R') do until eof(gl) entry = readln(gl) if entry ~= '' then do say '1B'x'[1mParsing 'bbsdata.BBSTYPE' grab from 'bbsdata.NAME': "'dlpath || entry'"' || '1B'x'[0m' if bbsdata.NUMEVENTS > 0 then do readkbd: say 'There are active events on "'bbsdata.NAME'":' thorpath'bin/ListEvents "'bbsdata.NAME'" FULL' 'Ask "*NDelete these events? [y/N]"' if rc = 5 then do thorpath'bin/ScriptServ "'bbsdata.NAME'" PACKAGEDONE' address(bbsread) GETBBSDATA '"'bbslist.i'"' bbsdata address(command) if bbsdata.UPLOADPATH ~= '' then ulpath = bbsdata.UPLOADPATH else ulpath = globdata.UPLOADPATH 'Delete "'ulpath||bbsdata.REPLYPACKET'" QUIET FORCE' end end thorpath'bin/CfgType >T:TypeInfo 'bbsdata.BBSTYPE call open(ti, "T:TypeInfo", 'R') tmp = readln(ti); tmp = readln(ti); tmp = readln(ti); tmp = readln(ti) parser = subword(tmp, 4); parser = left(parser, index(parser, ',') - 1) call close(ti) thorpath || parser' "'bbsdata.NAME'" "'dlpath || entry'" ARCHIVE DELETE PUBSCREEN "'pubscreen'"' end end call close(gl) end end address(command) if exists("T:GrabList") then 'Delete T:GrabList QUIET' if exists("T:TypeInfo") then 'Delete T:TypeInfo QUIET' exit(0) if remresident = 1 then 'Resident C:LIST REMOVE'