source: GuiMail/trunk/p/CWMAIL0.m@ 1751

Last change on this file since 1751 was 1139, checked in by George Lilly, 14 years ago

version 2.3 of GuiMail

File size: 4.4 KB
Line 
1CWMAIL0 ;INDPLS/PLS- DELPHI MAIL SERVER, CONT'D ;21-Jun-2005 06:34;CLC
2 ;;2.3;CWMAIL;;Jul 19, 2005
3 Q ;ROUTINE CAN'T BE CALLED DIRECTLY
4 ;
5PROCMS(CWDATA,CWMSGN,CWNMFLG) ;PROCESS MAIL MESSAGE THREAD
6 N CWRE,CWCNT,CWRSP,CWNWMSG,CWDATT,CWLCNT,CWLP,CWCONFRM,CW
7 N CWIM,CWIU,CWINSTR,CWFLAGS,CWIR
8 D INMSG^XMXUTIL2(XMDUZ,$$BSKT^XMXUTIL2(XMDUZ,CWMSGN),CWMSGN,,"F",.CWIM,.CWINSTR,.CWIU) ;SET-UP MESSAGE INFO
9 S CWDATA=$NA(^TMP($J,"CWMAIL"))
10 S CWNWMSG=$G(CWIM("FROM"))["@" ;NETWORK MESSAGE
11 S CWCNT=2,CWLCNT=0
12 S @CWDATA@(CWCNT)="Mail Message From: "_$G(CWIM("FROM NAME"))_" "_"Dated: "_$$FMDTE^CWMAIL4(CWIM("DATE FM"),"5MZ")
13 S CWCNT=$$INCNT(CWCNT),@CWDATA@(CWCNT)="Subject: "_$G(CWIM("SUBJ"))
14 S CWCNT=$$INCNT(CWCNT),@CWDATA@(CWCNT)=""
15 ;I 'CWNMFLG!(CWNMFLG&($G(CWIM("RESP"))<1))!(CWNMFLG&(+$G(CWIM("RESP"))=+$G(CWIM("RESPS"))))
16 I 'CWNMFLG!(CWNMFLG&(+$G(CWIU("RESP"))<1))!(CWNMFLG&(+$G(CWIU("RESP"))=+$G(CWIM("RESPS")))) D READM(.CWDATA,CWMSGN,.CWCNT)
17 S CWCONFRM=""
18 D LASTACC(CWMSGN,$$BSKT^XMXUTIL2(XMDUZ,CWMSGN),0,.CWCONFRM) ;UPDATE LAST ACCESS DATE/TIME
19 ;PROCESS RESPONSES
20 I $G(CWIM("RESPS"))>0 D
21 . S CWLP=$S(+$G(CWIU("RESP"))=+$G(CWIM("RESPS")):1,+$G(CWIU("RESP"))<1:1,CWNMFLG:+$G(CWIU("RESP")),1:1) F CWLP=CWLP:1:CWIM("RESPS") D
22 . . D INRESP^XMXUTIL2(CWMSGN,CWLP,"F",.CWIR) ;gather details on specific response
23 . . S CWCNT=$$INCNT(CWCNT),@CWDATA@(CWCNT)=""
24 . . S CWCNT=$$INCNT(CWCNT),@CWDATA@(CWCNT)="Response: "_CWLP_") "_$G(CWIR("FROM NAME"))_" "_$$FMDTE^CWMAIL4($G(CWIR("DATE FM")),"5MZ")
25 . . S CWCNT=$$INCNT(CWCNT),@CWDATA@(CWCNT)=""
26 . . D READM(.CWDATA,CWIR("XMZ"),.CWCNT)
27 . . D LASTACC(CWMSGN,$$BSKT^XMXUTIL2(XMDUZ,CWMSGN),CWLP) ;UPDATES LAST RESPONSE READ
28 D NONEW^XMXUTIL(XMDUZ,$$BSKT^XMXUTIL2(XMDUZ,CWMSGN),CWMSGN,1) ;UNNEW MESSAGE
29 I +CWCONFRM D ;SEND CONFIRMATION IF NEEDED
30 . S CWCNT=$$INCNT(CWCNT),@CWDATA@(CWCNT)=""
31 . S CWCNT=$$INCNT(CWCNT),@CWDATA@(CWCNT)=">>Confirmation Message Sent to Sender.<<"
32 I $O(@CWDATA@(1)) D
33 . S @CWDATA@(1)="1^^DATA HAS BEEN FOUND"
34 E S @CWDATA@(1)="1^^Message text could not be found."
35 S $P(@CWDATA@(1),U,2)=CWCNT-2
36 Q
37 ;
38LASTACC(XMZ,CWBIEN,CWLRSP,XMCONFRM) ;UPDATE LAST RESPONSE READ DATE
39 ;INPUT XMZ = MESSAGE NUMBER
40 ; CWBIEN = BASKET IEN
41 ; CWLRSP = LAST RESPONSE READ
42 ;
43 N CWIM,CWIU,CWINSTR,CWXINSTR,CWFLAGS
44 D INMSG1^XMXUTIL2(XMDUZ,XMZ,,.CWFLAGS,.CWIM,.CWIU) ;SET-UP FOR CALL
45 D INMSG2^XMXUTIL2(XMDUZ,XMZ,,.CWIM,.CWXINSTR,.CWIU)
46 S CWINSTR("FLAGS")=$S($G(CWXINSTR("FLAGS"))["R":"R",1:"")
47 D LASTACC^XMXUTIL(XMDUZ,CWBIEN,XMZ,CWLRSP,.CWIM,.CWINSTR,.CWIU,.XMCONFRM)
48 Q
49 ;
50READM(CWDATA,CWINPUT,CWCNT) ;OUTPUT MAIL MESSAGE IN ARRAY
51 S $ZT="READMER^CWMAIL"
52 N CWRDATA,XMZ,CWMTYPE,CWTFLG,XMER,XMPOS
53 S XMZ=+$G(CWINPUT),CWTFLG=0,CWMTYPE=$G(CWINSTR("TYPE"))
54 F S CWRDATA=$$READ^XMGAPI1() Q:XMER<0!(CWTFLG) S CWCNT=CWCNT+1,@CWDATA@(CWCNT)=CWRDATA I CWMTYPE="K"!(CWMTYPE="X") S:CWRDATA["$END TXT" CWTFLG=1
55 ;
56READMER Q
57 ;
58INCNT(CWCNT) ;INCREMENT COUNTER
59 Q CWCNT+1
60 ;
61ADDMP(CWXMZ,CWVAL) ;set data into DAT based on subscripted CWVAL
62 ;INPUT - CWXMZ = message ien
63 ; CWVAL = input array (i.e. CWVAL(1)=first piece...CWVAL(n)=last piece
64 ;OUTPUT - data string holding delimited ('^') data
65 S CWXMZ=$G(CWXMZ,0)
66 I +$G(CWXMZ) D
67 . N X,CWCONFRM,CWTYPE,CWCLOSED,CWINFO,CWCONFID,CWSDRDUZ,CWBRDCAS,CWSDRNAM,CWTRECPT,CWTREPLY
68 . N CWIM,CWIU,CWINSTR,CWPMSG,CWLP,CWDAT
69 . D INMSG^XMXUTIL2(XMDUZ,$$BSKT^XMXUTIL2(XMDUZ,CWXMZ),CWXMZ,,"F",.CWIM,.CWINSTR,.CWIU) ;SET-UP MESSAGE INFO
70 . S CWVAL(6)=$$UP^XLFSTR($G(CWINSTR("TYPE"))) ;message type(s)
71 . S:$G(CWINSTR("FLAGS"))["P" CWVAL(6)="P"_CWVAL(6) ;add priority flag as a type
72 . S CWVAL(7)=$G(CWINSTR("FLAGS"))["R" ;confirmation flag
73 . S CWVAL(8)=$G(CWINSTR("FLAGS"))["X" ;closed flag
74 . S CWVAL(9)=$G(CWINSTR("FLAGS"))["I" ;informational flag
75 . S CWVAL(10)=$G(CWINSTR("FLAGS"))["C" ;confidential flag
76 . S CWVAL(11)=$G(CWIM("FROM DUZ")) ;sender ien
77 . S CWVAL(13)=$G(CWIM("FROM NAME")) ;sender full name
78 . S CWVAL(12)=$$BCAST^XMXSEC(CWXMZ) ;broadcast flag
79 . S CWVAL(14)=$G(CWIM("RECIPS")) ;total # of recipients
80 . S CWVAL(15)=$G(CWIM("RESPS")) ;total # of replies
81 . S CWVAL(16)=$G(CWINSTR("FLAGS"))["P" ;priority flag
82 . S CWVAL(17)=+$G(CWIU("RESP")) ;# of last response read
83 . S CWVAL(20)=+$$ANSWER^XMXSEC(XMDUZ,CWXMZ,$$ZNODE^XMXUTIL2(CWXMZ)) ;can user answer message
84 ;set data into node
85 S CWLP="" F S CWLP=$O(CWVAL(CWLP)) Q:CWLP<1 D
86 . S $P(CWDAT,U,CWLP)=CWVAL(CWLP)
87 Q CWDAT
Note: See TracBrowser for help on using the repository browser.