XMXREPLY ;ISC-SF/GMB-Reply to a msg ;04/24/2002 10:29
;;8.0;MailMan;;Jun 28, 2002
REPLYMSG(XMDUZ,XMK,XMKZ,XMBODY,XMINSTR,XMZR) ;
; XMDUZ DUZ of who the msg is from
; XMBODY Body of the msg
; Must be closed root, passed by value. See WP_ROOT
; definition for WP^DIE(), FM word processing filer.
; XMINSTR("FROM") String saying from whom (default is XMDUZ)
; XMINSTR("STRIP") String containing chars to strip from msg text
; XMINSTR("SCR HINT") Hint to guess the scramble key
; (must be the hint from original message)
; XMINSTR("SCR KEY") Scramble key, if original message was scrambled.
; (must be the key from original message, as
; entered by the user: unscrambled!)
; *NOTE: SCR hint and key needed only for remote replies. Even then,
; they are ignored. That info is gotten from the original msg.
; XMINSTR("NET REPLY") Should reply go over the network? 1=yes; 0=no
; XMINSTR("NET SUBJ") Subject for network reply msg, else default to
; "Re: original msg subject"
; XMZSENDR XMDUZ of the person who created and sent the msg
; If you are not a recipient or the sender, you may not reply.
; If msg is in SHARED,MAIL and your DUZ is .6, ERROR! G H^XUS ***
; If msg is info only AND you are not the sender, you may not reply.
; If msg is info only and broadcast to all local users, may not reply
; If you are info only, you may not reply.
; If msg is from a remote POSTMASTER, may not reply.
; If msg is in waste basket or no basket, move it to a basket.
;
; Output:
; XMZR msg # holding the reply to XMZ
N XMZ,XMZREC,XMZSENDR,XMNETMSG
K XMERR,^TMP("XMERR",$J)
D CHKMSG^XMXSEC1(XMDUZ,.XMK,.XMKZ,.XMZ,.XMZREC) Q:$D(XMERR)
Q:'$$REPLY^XMXSEC(XMDUZ,XMZ,XMZREC)
D:XMK<1 FLTR^XMXMSGS2(XMDUZ,XMK,$S(XMK=.5:$$EZBLD^DIALOG(37004),1:""),XMZ) ; Move msg from WASTE basket
D CRE8XMZ^XMXSEND("R"_XMZ,.XMZR) Q:$D(XMERR) ; Create a place for the response in the msg file
D MOVEBODY^XMXSEND(XMZR,XMBODY) ; Put the msg body in place
D CHEKBODY^XMXSEND(XMZR,$G(XMINSTR("STRIP")))
D DOREPLY(XMDUZ,XMZ,XMZR,.XMINSTR)
S XMZSENDR=$P(XMZREC,U,2)
S XMNETMSG=$S(XMZSENDR["@":1,1:0)
I 'XMNETMSG!'$G(XMINSTR("NET REPLY")) Q
N XMFROM,XMREPLTO
D REPLYTO(XMZ,.XMFROM,.XMREPLTO)
D INIT^XMXADDR
S XMINSTR("EXACT")=1 ; Match on exact domain name
D CHKADDR^XMXADDR(XMDUZ,$$REMADDR^XMXADDR3($G(XMREPLTO,XMFROM)),.XMINSTR)
K XMINSTR("EXACT")
D:'$D(XMERR) NETREPLY(XMDUZ,XMZ,XMZR,$S($G(XMINSTR("NET SUBJ"))'="":XMINSTR("NET SUBJ"),$E($P(XMZREC,U,1),1,4)=$$EZBLD^DIALOG(37006):$E($P(XMZREC,U,1),1,65),1:$E($$EZBLD^DIALOG(37006)_$P(XMZREC,U,1),1,65)),.XMINSTR) ;Re:
D CLEANUP^XMXADDR
Q
DOREPLY(XMDUZ,XMZ,XMZR,XMINSTR) ;
D:$D(XMSECURE) ENCMSG^XMJMCODE(XMZR) ; Scramble the msg, if needed
D MOVER(XMDUZ,XMZ,XMZR,.XMINSTR) ; Point from response back to original msg
D RPOST^XMKP(XMDUZ,XMZ,XMZR) ; Point from original msg to response and send the msg
D CHECK^XMKPL
Q
NETREPLY(XMDUZ,XMZ,XMZR,XMZRSUBJ,XMINSTR) ;
N XMFDA,XMIENS
S XMIENS=XMZR_","
S XMFDA(3.9,XMIENS,.01)=XMZRSUBJ
I $D(XMSECURE) D ; Scramble hint / Scramble key
. S XMFDA(3.9,XMIENS,1.8)=$P(^XMB(3.9,XMZ,0),U,10) ;XMINSTR("SCR HINT")
. S XMFDA(3.9,XMIENS,1.85)=^XMB(3.9,XMZ,"K") ;XMINSTR("SCR KEY")
I $G(^XMB(3.9,XMZ,5))'="" D ; In response to remote msg id
. S XMFDA(3.9,XMIENS,9.5)=$E(^XMB(3.9,XMZ,5),1,110)
D FILE^DIE("","XMFDA")
D SEND^XMKP(XMDUZ,XMZR)
Q
MOVER(XMDUZ,XMZ,XMZR,XMINSTR) ;
N XMFDA,XMIENS
S XMIENS=XMZR_","
I $D(XMINSTR("FROM")) D
. S XMFDA(3.9,XMIENS,1)=XMINSTR("FROM")
. ;S XMFDA(3.9,XMIENS,1.1)=DUZ
E D
. S XMFDA(3.9,XMIENS,1)=XMDUZ
. S:XMDUZ'=DUZ XMFDA(3.9,XMIENS,1.1)=DUZ
S XMFDA(3.9,XMIENS,1.4)=$$NOW^XLFDT()
S XMFDA(3.9,XMIENS,1.35)=XMZ
D FILE^DIE("","XMFDA")
Q
REPLYTO(XMZ,XMFROM,XMREPLTO) ; Get from and reply-to address, if any
N XMHDR,XMFIND
S XMFIND="^FROM^REPLY-TO^"
D HDRFIND^XMR3(XMZ,XMFIND,.XMHDR)
I $D(XMHDR("FROM")) S XMFROM=XMHDR("FROM")
E S XMFROM=$P($G(^XMB(3.9,XMZ,0)),U,2) ; not really remote msg?
I $D(XMHDR("REPL")) S XMREPLTO=XMHDR("REPL")
Q
REPLYTO1(XMZ) ;
N XMFROM,XMREPLTO
D REPLYTO(XMZ,.XMFROM,.XMREPLTO)
Q $$REMADDR^XMXADDR3($G(XMREPLTO,XMFROM))
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXMXREPLY 4316 printed Dec 13, 2024@02:14:22 Page 2
XMXREPLY ;ISC-SF/GMB-Reply to a msg ;04/24/2002 10:29
+1 ;;8.0;MailMan;;Jun 28, 2002
REPLYMSG(XMDUZ,XMK,XMKZ,XMBODY,XMINSTR,XMZR) ;
+1 ; XMDUZ DUZ of who the msg is from
+2 ; XMBODY Body of the msg
+3 ; Must be closed root, passed by value. See WP_ROOT
+4 ; definition for WP^DIE(), FM word processing filer.
+5 ; XMINSTR("FROM") String saying from whom (default is XMDUZ)
+6 ; XMINSTR("STRIP") String containing chars to strip from msg text
+7 ; XMINSTR("SCR HINT") Hint to guess the scramble key
+8 ; (must be the hint from original message)
+9 ; XMINSTR("SCR KEY") Scramble key, if original message was scrambled.
+10 ; (must be the key from original message, as
+11 ; entered by the user: unscrambled!)
+12 ; *NOTE: SCR hint and key needed only for remote replies. Even then,
+13 ; they are ignored. That info is gotten from the original msg.
+14 ; XMINSTR("NET REPLY") Should reply go over the network? 1=yes; 0=no
+15 ; XMINSTR("NET SUBJ") Subject for network reply msg, else default to
+16 ; "Re: original msg subject"
+17 ; XMZSENDR XMDUZ of the person who created and sent the msg
+18 ; If you are not a recipient or the sender, you may not reply.
+19 ; If msg is in SHARED,MAIL and your DUZ is .6, ERROR! G H^XUS ***
+20 ; If msg is info only AND you are not the sender, you may not reply.
+21 ; If msg is info only and broadcast to all local users, may not reply
+22 ; If you are info only, you may not reply.
+23 ; If msg is from a remote POSTMASTER, may not reply.
+24 ; If msg is in waste basket or no basket, move it to a basket.
+25 ;
+26 ; Output:
+27 ; XMZR msg # holding the reply to XMZ
+28 NEW XMZ,XMZREC,XMZSENDR,XMNETMSG
+29 KILL XMERR,^TMP("XMERR",$JOB)
+30 DO CHKMSG^XMXSEC1(XMDUZ,.XMK,.XMKZ,.XMZ,.XMZREC)
if $DATA(XMERR)
QUIT
+31 if '$$REPLY^XMXSEC(XMDUZ,XMZ,XMZREC)
QUIT
+32 ; Move msg from WASTE basket
if XMK<1
DO FLTR^XMXMSGS2(XMDUZ,XMK,$SELECT(XMK=.5:$$EZBLD^DIALOG(37004),1:""),XMZ)
+33 ; Create a place for the response in the msg file
DO CRE8XMZ^XMXSEND("R"_XMZ,.XMZR)
if $DATA(XMERR)
QUIT
+34 ; Put the msg body in place
DO MOVEBODY^XMXSEND(XMZR,XMBODY)
+35 DO CHEKBODY^XMXSEND(XMZR,$GET(XMINSTR("STRIP")))
+36 DO DOREPLY(XMDUZ,XMZ,XMZR,.XMINSTR)
+37 SET XMZSENDR=$PIECE(XMZREC,U,2)
+38 SET XMNETMSG=$SELECT(XMZSENDR["@":1,1:0)
+39 IF 'XMNETMSG!'$GET(XMINSTR("NET REPLY"))
QUIT
+40 NEW XMFROM,XMREPLTO
+41 DO REPLYTO(XMZ,.XMFROM,.XMREPLTO)
+42 DO INIT^XMXADDR
+43 ; Match on exact domain name
SET XMINSTR("EXACT")=1
+44 DO CHKADDR^XMXADDR(XMDUZ,$$REMADDR^XMXADDR3($GET(XMREPLTO,XMFROM)),.XMINSTR)
+45 KILL XMINSTR("EXACT")
+46 ;Re:
if '$DATA(XMERR)
DO NETREPLY(XMDUZ,XMZ,XMZR,$SELECT($GET(XMINSTR("NET SUBJ"))'="":XMINSTR("NET SUBJ"),$EXTRACT($PIECE(XMZREC,U,1),1,4)=$$EZBLD^DIALOG(37006):$EXTRACT($PIECE(XMZREC,U,1),1,65),1:$EXTRACT($$EZBLD^DIALOG(37006)_$PIECE(XMZREC,U,1),1,65)),.XMINST
R)
+47 DO CLEANUP^XMXADDR
+48 QUIT
DOREPLY(XMDUZ,XMZ,XMZR,XMINSTR) ;
+1 ; Scramble the msg, if needed
if $DATA(XMSECURE)
DO ENCMSG^XMJMCODE(XMZR)
+2 ; Point from response back to original msg
DO MOVER(XMDUZ,XMZ,XMZR,.XMINSTR)
+3 ; Point from original msg to response and send the msg
DO RPOST^XMKP(XMDUZ,XMZ,XMZR)
+4 DO CHECK^XMKPL
+5 QUIT
NETREPLY(XMDUZ,XMZ,XMZR,XMZRSUBJ,XMINSTR) ;
+1 NEW XMFDA,XMIENS
+2 SET XMIENS=XMZR_","
+3 SET XMFDA(3.9,XMIENS,.01)=XMZRSUBJ
+4 ; Scramble hint / Scramble key
IF $DATA(XMSECURE)
Begin DoDot:1
+5 ;XMINSTR("SCR HINT")
SET XMFDA(3.9,XMIENS,1.8)=$PIECE(^XMB(3.9,XMZ,0),U,10)
+6 ;XMINSTR("SCR KEY")
SET XMFDA(3.9,XMIENS,1.85)=^XMB(3.9,XMZ,"K")
End DoDot:1
+7 ; In response to remote msg id
IF $GET(^XMB(3.9,XMZ,5))'=""
Begin DoDot:1
+8 SET XMFDA(3.9,XMIENS,9.5)=$EXTRACT(^XMB(3.9,XMZ,5),1,110)
End DoDot:1
+9 DO FILE^DIE("","XMFDA")
+10 DO SEND^XMKP(XMDUZ,XMZR)
+11 QUIT
MOVER(XMDUZ,XMZ,XMZR,XMINSTR) ;
+1 NEW XMFDA,XMIENS
+2 SET XMIENS=XMZR_","
+3 IF $DATA(XMINSTR("FROM"))
Begin DoDot:1
+4 SET XMFDA(3.9,XMIENS,1)=XMINSTR("FROM")
+5 ;S XMFDA(3.9,XMIENS,1.1)=DUZ
End DoDot:1
+6 IF '$TEST
Begin DoDot:1
+7 SET XMFDA(3.9,XMIENS,1)=XMDUZ
+8 if XMDUZ'=DUZ
SET XMFDA(3.9,XMIENS,1.1)=DUZ
End DoDot:1
+9 SET XMFDA(3.9,XMIENS,1.4)=$$NOW^XLFDT()
+10 SET XMFDA(3.9,XMIENS,1.35)=XMZ
+11 DO FILE^DIE("","XMFDA")
+12 QUIT
REPLYTO(XMZ,XMFROM,XMREPLTO) ; Get from and reply-to address, if any
+1 NEW XMHDR,XMFIND
+2 SET XMFIND="^FROM^REPLY-TO^"
+3 DO HDRFIND^XMR3(XMZ,XMFIND,.XMHDR)
+4 IF $DATA(XMHDR("FROM"))
SET XMFROM=XMHDR("FROM")
+5 ; not really remote msg?
IF '$TEST
SET XMFROM=$PIECE($GET(^XMB(3.9,XMZ,0)),U,2)
+6 IF $DATA(XMHDR("REPL"))
SET XMREPLTO=XMHDR("REPL")
+7 QUIT
REPLYTO1(XMZ) ;
+1 NEW XMFROM,XMREPLTO
+2 DO REPLYTO(XMZ,.XMFROM,.XMREPLTO)
+3 QUIT $$REMADDR^XMXADDR3($GET(XMREPLTO,XMFROM))