On 8 Apr 99 18:46:44 +0100, Jon Wareham wrote about:
> 
> The script will not work as it is. It could do with a few more lines
> of code. It was really only an idea, I'm sure there is a Rexxaphobe
> that can sort it out.

Should have been Rexxaphile :)
> 
I had Idle hands last night. This script might work, as usual its
use at your own risk. I just traced it offline and it looked like it
was doing what it was supposed to. All the settings that need
changed are in the top 2 or 3 lines. A couple of others that might be
usefull are included if they get thru listar.

1. CheckMailEvery, checks mail every x mins, set to 10, I dont know
how to find out if we actually got any mail.

2. GetNewNewsGroups, Creats an e-mail of new news groups since the
last time it was run and imports to priv>>. To subscribe highlight
the group name then select "Create new newsgroup" from the group
window and paste in the name. It works ok here at .demon.co.uk 




-- Listar MIME Decryption --------------
-- Name   : CheckMailEvery.mdrx
/* --- user    prefs ---- */
mins = 10
amin = 50*60 /* 60*60 tics*seconds */
/* ---------------------- */

options results
 
if ~SHOW('LIBRARIES','rexxsupport.library') THEN DO
  if ~ADDLIB('rexxsupport.library',9,-30,0) THEN DO
        exit(10)
  end
end
address "MD.1" 
elapsed=mins
do forever
        if ~show(p,"MD.1") THEN BREAK
        if (elapsed = mins) THEN DO
                'CHECKMAILNEWS MAIL'
                amount=RC
                /* if amount ~= 0 THEN 'SHOW' */ /* just a guess:) */
                elapsed=0
        end
        delay(amin)
        elapsed=elapsed+1
end
exit


-- Listar MIME Decryption --------------
-- Name   : GetNewNewsGroups.mdrx
/* -user  prefs- */
server = 'news.demon.co.uk'
port = 119
offset = ' +01:00'
/* ------------ */

cr = '0d'x

options results

if ~SHOW('LIBRARIES','rexxsupport.library') then do
  if ~ADDLIB('rexxsupport.library',9,-30,0) then do
    exit
  end
end

/* Date of last access in format 'YYMMDD HHMMSS' default midnight 01 mar 1998 */
lastdate = '990301'
lasttime = '000001'

if open(prefs,'.LastNewNewsDate') then do
        lastdate = readln(prefs)
        lasttime = readln(prefs)
        close(prefs)
end

/* start building fake mail */
open(fakemail,'t:'lastdate||lasttime,W)

/* fake mail header, for importing into MD, might not need as much headers */
curdate = date('N')||' 'time('N')||offset
call writeln(fakemail,'From: "New News Manager" <>')
call writeln(fakemail,'Date: 'curdate)
call writeln(fakemail,'Subject: New News Groups')
call writeln(fakemail,'Message-Id: <'lastdate||lasttime'@New.News.Manager>')
call writeln(fakemail,'To: me@here')
call writeln(fakemail,'Content-Type: text/plain; charset=us-ascii')
call writeln(fakemail,'Content-Transfer-Encoding: 7bit')
call writeln(fakemail,'')

if open(news,'tcp:'server'/'port) then do
        line = readln(news)
        call writeln(fakemail,line) 
        call writeln(news,'NEWGROUPS 'lastdate' 'lasttime)
        resp = ''
        do until resp = '.'||cr
                resp = readln(news)
                call writeln(fakemail,resp)
                end
        call writeln(news,'QUIT')
        resp = readln(news)      /* "205 goodbye?" */
        call writeln(fakemail,resp)
        end
        close(news)
close(fakemail)

MAILIMPORT 't:'lastdate||lasttime

/* date and time needs to be updated in YYMMDD HHMMSS format */
open(prefs,'.LastNewNewsDate',W)
lastdate = substr( date('S'),3 )
lt = time('N')
lasttime = substr(lt,1,2)||substr(lt,4,2)||substr(lt,7,2)
call writeln(prefs,lastdate)
call writeln(prefs,lasttime)
close(prefs)

exit

Reply via email to