| 1 | XMXREPLY ;ISC-SF/GMB-Reply to a msg ;04/24/2002  10:29
 | 
|---|
| 2 |  ;;8.0;MailMan;;Jun 28, 2002
 | 
|---|
| 3 | REPLYMSG(XMDUZ,XMK,XMKZ,XMBODY,XMINSTR,XMZR) ;
 | 
|---|
| 4 |  ; XMDUZ    DUZ of who the msg is from
 | 
|---|
| 5 |  ; XMBODY   Body of the msg
 | 
|---|
| 6 |  ;          Must be closed root, passed by value.  See WP_ROOT
 | 
|---|
| 7 |  ;          definition for WP^DIE(), FM word processing filer.
 | 
|---|
| 8 |  ; XMINSTR("FROM")     String saying from whom (default is XMDUZ)
 | 
|---|
| 9 |  ; XMINSTR("STRIP")    String containing chars to strip from msg text
 | 
|---|
| 10 |  ; XMINSTR("SCR HINT") Hint to guess the scramble key
 | 
|---|
| 11 |  ;                     (must be the hint from original message)
 | 
|---|
| 12 |  ; XMINSTR("SCR KEY")  Scramble key, if original message was scrambled.
 | 
|---|
| 13 |  ;                     (must be the key from original message, as
 | 
|---|
| 14 |  ;                     entered by the user: unscrambled!)
 | 
|---|
| 15 |  ; *NOTE: SCR hint and key needed only for remote replies.  Even then,
 | 
|---|
| 16 |  ;        they are ignored.  That info is gotten from the original msg.
 | 
|---|
| 17 |  ; XMINSTR("NET REPLY") Should reply go over the network? 1=yes; 0=no
 | 
|---|
| 18 |  ; XMINSTR("NET SUBJ") Subject for network reply msg, else default to
 | 
|---|
| 19 |  ;          "Re: original msg subject"
 | 
|---|
| 20 |  ; XMZSENDR XMDUZ of the person who created and sent the msg
 | 
|---|
| 21 |  ; If you are not a recipient or the sender, you may not reply.
 | 
|---|
| 22 |  ; If msg is in SHARED,MAIL and your DUZ is .6, ERROR! G H^XUS ***
 | 
|---|
| 23 |  ; If msg is info only AND you are not the sender, you may not reply.
 | 
|---|
| 24 |  ; If msg is info only and broadcast to all local users, may not reply
 | 
|---|
| 25 |  ; If you are info only, you may not reply.
 | 
|---|
| 26 |  ; If msg is from a remote POSTMASTER, may not reply.
 | 
|---|
| 27 |  ; If msg is in waste basket or no basket, move it to a basket.
 | 
|---|
| 28 |  ;
 | 
|---|
| 29 |  ; Output:
 | 
|---|
| 30 |  ; XMZR     msg # holding the reply to XMZ
 | 
|---|
| 31 |  N XMZ,XMZREC,XMZSENDR,XMNETMSG
 | 
|---|
| 32 |  K XMERR,^TMP("XMERR",$J)
 | 
|---|
| 33 |  D CHKMSG^XMXSEC1(XMDUZ,.XMK,.XMKZ,.XMZ,.XMZREC) Q:$D(XMERR)
 | 
|---|
| 34 |  Q:'$$REPLY^XMXSEC(XMDUZ,XMZ,XMZREC)
 | 
|---|
| 35 |  D:XMK<1 FLTR^XMXMSGS2(XMDUZ,XMK,$S(XMK=.5:$$EZBLD^DIALOG(37004),1:""),XMZ) ; Move msg from WASTE basket
 | 
|---|
| 36 |  D CRE8XMZ^XMXSEND("R"_XMZ,.XMZR) Q:$D(XMERR)  ; Create a place for the response in the msg file
 | 
|---|
| 37 |  D MOVEBODY^XMXSEND(XMZR,XMBODY) ; Put the msg body in place
 | 
|---|
| 38 |  D CHEKBODY^XMXSEND(XMZR,$G(XMINSTR("STRIP")))
 | 
|---|
| 39 |  D DOREPLY(XMDUZ,XMZ,XMZR,.XMINSTR)
 | 
|---|
| 40 |  S XMZSENDR=$P(XMZREC,U,2)
 | 
|---|
| 41 |  S XMNETMSG=$S(XMZSENDR["@":1,1:0)
 | 
|---|
| 42 |  I 'XMNETMSG!'$G(XMINSTR("NET REPLY")) Q
 | 
|---|
| 43 |  N XMFROM,XMREPLTO
 | 
|---|
| 44 |  D REPLYTO(XMZ,.XMFROM,.XMREPLTO)
 | 
|---|
| 45 |  D INIT^XMXADDR
 | 
|---|
| 46 |  S XMINSTR("EXACT")=1 ; Match on exact domain name
 | 
|---|
| 47 |  D CHKADDR^XMXADDR(XMDUZ,$$REMADDR^XMXADDR3($G(XMREPLTO,XMFROM)),.XMINSTR)
 | 
|---|
| 48 |  K XMINSTR("EXACT")
 | 
|---|
| 49 |  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:
 | 
|---|
| 50 |  D CLEANUP^XMXADDR
 | 
|---|
| 51 |  Q
 | 
|---|
| 52 | DOREPLY(XMDUZ,XMZ,XMZR,XMINSTR) ;
 | 
|---|
| 53 |  D:$D(XMSECURE) ENCMSG^XMJMCODE(XMZR) ; Scramble the msg, if needed
 | 
|---|
| 54 |  D MOVER(XMDUZ,XMZ,XMZR,.XMINSTR) ; Point from response back to original msg
 | 
|---|
| 55 |  D RPOST^XMKP(XMDUZ,XMZ,XMZR) ; Point from original msg to response and send the msg
 | 
|---|
| 56 |  D CHECK^XMKPL
 | 
|---|
| 57 |  Q
 | 
|---|
| 58 | NETREPLY(XMDUZ,XMZ,XMZR,XMZRSUBJ,XMINSTR) ;
 | 
|---|
| 59 |  N XMFDA,XMIENS
 | 
|---|
| 60 |  S XMIENS=XMZR_","
 | 
|---|
| 61 |  S XMFDA(3.9,XMIENS,.01)=XMZRSUBJ
 | 
|---|
| 62 |  I $D(XMSECURE) D  ; Scramble hint / Scramble key
 | 
|---|
| 63 |  . S XMFDA(3.9,XMIENS,1.8)=$P(^XMB(3.9,XMZ,0),U,10) ;XMINSTR("SCR HINT")
 | 
|---|
| 64 |  . S XMFDA(3.9,XMIENS,1.85)=^XMB(3.9,XMZ,"K") ;XMINSTR("SCR KEY")
 | 
|---|
| 65 |  I $G(^XMB(3.9,XMZ,5))'="" D  ; In response to remote msg id
 | 
|---|
| 66 |  . S XMFDA(3.9,XMIENS,9.5)=$E(^XMB(3.9,XMZ,5),1,110)
 | 
|---|
| 67 |  D FILE^DIE("","XMFDA")
 | 
|---|
| 68 |  D SEND^XMKP(XMDUZ,XMZR)
 | 
|---|
| 69 |  Q
 | 
|---|
| 70 | MOVER(XMDUZ,XMZ,XMZR,XMINSTR) ;
 | 
|---|
| 71 |  N XMFDA,XMIENS
 | 
|---|
| 72 |  S XMIENS=XMZR_","
 | 
|---|
| 73 |  I $D(XMINSTR("FROM")) D
 | 
|---|
| 74 |  . S XMFDA(3.9,XMIENS,1)=XMINSTR("FROM")
 | 
|---|
| 75 |  . ;S XMFDA(3.9,XMIENS,1.1)=DUZ
 | 
|---|
| 76 |  E  D
 | 
|---|
| 77 |  . S XMFDA(3.9,XMIENS,1)=XMDUZ
 | 
|---|
| 78 |  . S:XMDUZ'=DUZ XMFDA(3.9,XMIENS,1.1)=DUZ
 | 
|---|
| 79 |  S XMFDA(3.9,XMIENS,1.4)=$$NOW^XLFDT()
 | 
|---|
| 80 |  S XMFDA(3.9,XMIENS,1.35)=XMZ
 | 
|---|
| 81 |  D FILE^DIE("","XMFDA")
 | 
|---|
| 82 |  Q
 | 
|---|
| 83 | REPLYTO(XMZ,XMFROM,XMREPLTO) ; Get from and reply-to address, if any
 | 
|---|
| 84 |  N XMHDR,XMFIND
 | 
|---|
| 85 |  S XMFIND="^FROM^REPLY-TO^"
 | 
|---|
| 86 |  D HDRFIND^XMR3(XMZ,XMFIND,.XMHDR)
 | 
|---|
| 87 |  I $D(XMHDR("FROM")) S XMFROM=XMHDR("FROM")
 | 
|---|
| 88 |  E  S XMFROM=$P($G(^XMB(3.9,XMZ,0)),U,2)  ; not really remote msg?
 | 
|---|
| 89 |  I $D(XMHDR("REPL")) S XMREPLTO=XMHDR("REPL")
 | 
|---|
| 90 |  Q
 | 
|---|
| 91 | REPLYTO1(XMZ) ;
 | 
|---|
| 92 |  N XMFROM,XMREPLTO
 | 
|---|
| 93 |  D REPLYTO(XMZ,.XMFROM,.XMREPLTO)
 | 
|---|
| 94 |  Q $$REMADDR^XMXADDR3($G(XMREPLTO,XMFROM))
 | 
|---|