home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 18
/
aminetcdnumber181997.iso
/
Aminet
/
comm
/
fido
/
polly10.lha
/
polly
/
_poll.spot
next >
Wrap
Text File
|
1997-02-16
|
3KB
|
117 lines
/*
** $VER: Polly 1.0 (16.2.97) Rolf Rotvel
**
** Uses rexxreqtools.library and traplist.library (Optional)
*/
cfgpath = 'mail:max/spot.prefs' /* Path to Spot cfg file */
outpath = 'out:' /* Your outbound directory */
pollcmd = 'cc:brun trapdoor call' /* Generic poll cmd. Must be able to call */
/* a nodenumber directly like TrapDoor */
traplist? = 1 /* Set to 1 if you have traplist.library */
/* installed. 0 if not */
/*
** End of cfg.
*/
call addlib('rexxreqtools.library', 0, -30, 0)
call addlib('rexxsupport.library', 0, -30, 0)
if traplist? then call addlib('traplist.library', 0, -30, 0)
nl = '0a'x
version = 'Polly '||word(sourceline(2), 4)
pollnodes = ''
oldstamp = getclip('pollspot.stamp')
parse value statef(cfgpath) with . . . . days mins ticks .
newstamp = days||mins||ticks
if oldstamp ~= newstamp then do
if ~open('cfg', cfgpath, 'r') then exit 10
cfgtxt = readch('cfg', 65535)
call close('cfg')
call setclip('pollspot.stamp', newstamp)
count = 1
reqbody = ''
reqgads = ''
do forever /* Terminates if no more POLL statements */
parse var cfgtxt . 'ADDRESS ' node '.' cfgtxt
pollmark = pos('POLL ', cfgtxt)
if pollmark = 0 then leave
nodemark = pos('ADDRESS', cfgtxt)
/* POLL comes before next ADDRESS or it's the last ADDRESS */
if pollmark < nodemark | nodemark = 0 then do
reqbody = reqbody||nl||count||' : '||node
reqgads = reqgads||'_'||count||'|'
pollnodes = pollnodes||node||' '
count = count + 1
end
end
call setclip('pollspot.reqbody', reqbody)
call setclip('pollspot.reqgads', reqgads)
call setclip('pollspot.pollnodes', pollnodes)
end
else do
pollnodes = getclip('pollspot.pollnodes')
count = words(pollnodes) + 1
reqbody = getclip('pollspot.reqbody')
reqgads = getclip('pollspot.reqgads')
end
outfiles = upper(showdir(outpath, 'f'))
if outfiles ~= '' then do
outnodes = ''
cut = pos('.CUT', outfiles)
req = pos('.REQ', outfiles)
do forever
if cut = 0 & req = 0 then leave
if (req > cut & cut > 0) | req = 0 then do
call getnode('.CUT')
cut = pos('.CUT', outfiles)
end
else do
call getnode('.REQ')
req = pos('.REQ', outfiles)
end
end
end
parse var reqbody (nl) reqbody
reqgads = reqgads||'_Node|_Quit'
ans = rtezrequest(reqbody, reqgads, version)
allnodes = pollnodes||outnodes
select
when ans = 0 then exit
when ans = count then do /* Count = nodes + 1 */
node = rtgetstring(,,'Type nodenumber', '_Ok|_Quit')
if rtresult = 0 | (traplist? & ~word(findnode(node), 1)) then exit
end
otherwise node = word(allnodes, ans)
end
if pos(node, pollnodes) > 0 & show('p', 'SPOT') then address 'SPOT' 'poll node '||node||'.0'
else address command pollcmd node
exit
GETNODE:
arg suff
parse var outfiles start (suff) outfiles
parse value word(start, words(start)) with z '.' r '.' n '.' .
node = z||':'||r||'/'||n
if (traplist? & ~word(findnode(node), 1)) | pos(node, pollnodes) > 0 then return
outnodes = outnodes||node||' '
reqbody = reqbody||nl||count||' : '||node||' ('||suff||')'
reqgads = reqgads||'_'||count||'|'
count = count + 1
return