home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $VER: KeepMsg.thor 1.2 (15.5.95) Eirik Synnes
- **
- ** Copies the current message to a "Keep" conference and sets the KEEP flag
- ** Specify the conference name in the toconf string below. If the conference
- ** doesn't exist it will be created.
- **
- ** New in 1.1:
- ** o Supports hazelevels
- **
- ** New in 1.2:
- ** o Updates conference window after the deed is done
- ** o Uses copyback buffer
- **
- */
-
- options results
-
- toconf = 'The Keep'
-
- CDF_NOT_ON_BBS = '00008000'x /* This conference is not on the bbs. */
-
- /* 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)
- trace off; CURRENTMSG curmsg; trace on
-
- if rc ~= 0 then do
- REQUESTNOTIFY '"'THOR.LASTERROR'"' '"_Abort"'
- exit(0)
- end
-
- address(bbsread)
- READBRMESSAGE '"'curmsg.BBSNAME'"' '"'curmsg.CONFNAME'"' '"'curmsg.MSGNR'"' TEXTSTEM text HEADSTEM head DATASTEM data
- if rc ~= 0 then do
- address(thorport)
- REQUESTNOTIFY '"'BBSREAD.LASTERROR'"' '"_Abort"'
- exit(0)
- end
-
- if head.fromname ~= "HEAD.FROMNAME" then text.fromname = head.fromname
- if head.fromaddr ~= "HEAD.FROMADDR" then text.fromaddr = head.fromaddr
- if head.toname ~= "HEAD.TONAME" then text.toname = head.toname
- if head.toaddr ~= "HEAD.TOADDR" then text.toaddr = head.toaddr
- if head.msgid ~= "HEAD.MSGID" then text.msgid = head.msgid
- if head.refid ~= "HEAD.REFID" then text.refid = head.refid
- if head.creationdate ~= "HEAD.CREATIONDATE" then text.creationdate = head.creationdate
- if head.creationdatetxt ~= "HEAD.CREATIONDATETXT" then text.creationdatetxt = head.creationdatetxt
- if head.subject ~= "HEAD.SUBJECT" then text.subject = head.subject
-
- if text.TEXT.COUNT = 0 then do
- address(thorport)
- REQUESTNOTIFY '"'No message body.'"' '"'_Ok'"'
- exit(0)
- end
-
- text.replyconf = curmsg.CONFNAME
-
- priv = ""; urg = ""; imp = ""
-
- if bittst(data.flags,2) then priv = "PRIVATE"
- if bittst(data.flags,11) then urg = "URGENT"
- if bittst(data.flags,12) then imp = "IMPORTANT"
-
- BUFMODE COPYBACK
-
- WRITEBRMESSAGE '"'curmsg.BBSNAME'"' '"'toconf'"' STEM text priv urg imp
- if rc ~= 0 then do
- errmsg = BBSREAD.LASTERROR
- if errmsg = 'Unknown conference' then do
- CONFIGCONF '"'curmsg.BBSNAME'"' '"'toconf'"' SET c2x(CDF_NOT_ON_BBS)
- WRITEBRMESSAGE '"'curmsg.BBSNAME'"' '"'toconf'"' STEM text priv
- if rc ~= 0 then do
- address(thorport)
- REQUESTNOTIFY '"Couldn''t write message:\n'errmsg'"' '"_Ok"'
- BUFMODE ENDCOPYBACK
- exit(0)
- end
- end
- else do
- address(thorport)
- REQUESTNOTIFY '"Couldn''t write message:\n'errmsg'"' '"_Ok"'
- BUFMODE ENDCOPYBACK
- exit(0)
- end
- end
-
- mnr = result
- repl = ""
- if bittst(data.flags, 1) then repl = "SETREPLIED"
-
- address(bbsread)
- UPDATEBRMESSAGE '"'curmsg.BBSNAME'"' '"'toconf'"' mnr SETKEEP repl HAZELEVEL data.HAZELEVEL
- if rc ~= 0 then do
- address(thorport)
- REQUESTNOTIFY '"Couldn''t update message:\n'BBSREAD.LASTERROR'"' '"_Ok"'
- end
-
- BUFMODE ENDCOPYBACK
-
- address(thorport)
- UPDATECONFWINDOW
-
- exit(0)
-