Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XMGAPI2

XMGAPI2.m

Go to the documentation of this file.
  1. XMGAPI2 ;(WASH ISC)/JKL-Get Msg Header Info API ;04/17/2002 08:57
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ; Entry points (DBIA 1144):
  1. ; $$HDR Get message header information
  1. ;
  1. ;USAGE: S X=$$HDR^XMGAPI2(A,.B,C)
  1. ;WHERE: A=message or response #
  1. ; .B=array into which data is placed
  1. ; C=flag that determines what data is returned as follows:
  1. ;Not defined or 0 = returns a function value of 0 if successful, an
  1. ; error message if unsuccessful, and a value array:
  1. ; L("BROADCAST")= 1 if the message was broadcast; 0 otherwise
  1. ; L("BSKT") = basket (of local user)
  1. ; L("BSKT IEN") = basket IEN (of local user)
  1. ; L("DATE") = origination date
  1. ; L("DATE FM") = origination date in FileMan format
  1. ; L("LINES") = number of lines in the original message
  1. ; L("NEW") = 1 if the message is new; 0 otherwise
  1. ; L("PXMZ") = pointer to the original message
  1. ; L("SENDER") = sender name
  1. ; L("SENDER DUZ") = sender DUZ
  1. ; L("SUBJ") = subject
  1. ; L("SURROG") = surrogate (DUZ if local user or string if not)
  1. ; L("TYPE") = message type(s)
  1. ; L("XMZ") = message or response number
  1. ;1 = returns function value and value array above, also
  1. ; additional value array as follows:
  1. ; L("RRED") = responses read
  1. ; L("RRCV") = responses received
  1. ; L("BLOBCNT") = number of non-textual body parts attached
  1. ;91= returns function value, value array as with flag 1,
  1. ; and an array of response nodes and values as follows:
  1. ; L("RSP",counter)= (pointer to 3.9 file) / array of responses
  1. ;92= returns function value, value array as with flag 1,
  1. ; and an array of non-textual body parts as follows:
  1. ; L("BLOB",counter) = (pointer to 2005 file) array of BLOBS
  1. ;93= returns function value, value array as with flag 1,
  1. ; response node array, and an array of non-textual body parts.
  1. HDR(XMZ,L,F) ;Entry for non-MailMan (documented)
  1. GO N %,%0,D,XMBCAST
  1. S %=$G(XMZ) I +%'=%!(%<1) S %="1-Undefined message number" G ERR
  1. I XMZ="" S %="1-No message number" G ERR
  1. S %0=$G(^XMB(3.9,XMZ,0)) I %0="" S %="1-No such message" G ERR
  1. S D=$S($G(XMDUZ):XMDUZ,1:DUZ)
  1. I $S(+D'=D:1,D'>0:1,'$D(^XMB(3.7,D,0)):1,1:0) S %="4-Invalid user" G ERR
  1. S %=$P(%0,U,8),%=$S(%:%,1:XMZ)
  1. S XMBCAST=$S($D(^XMB(3.9,%,1,"C","* (Broadcast to all local users)")):1,$D(^XMB(3.9,%,1,"C","* (Broadcast to all local user")):1,1:0)
  1. I $S($P(%0,U,2)=D:0,$D(^XMB(3.9,%,1,"C",D)):0,XMBCAST:0,1:1) S %="2-User is not a sender or recipient." G ERR
  1. I $G(F)=""!'$G(F) S F=0 ;Default FLAG
  1. N %1,%2,XMK
  1. S %1=$$NET^XMRENT(XMZ) ;get message information
  1. I %1="" S %="4-Message not defined" G ERR
  1. S L("BROADCAST")=XMBCAST
  1. S L("XMZ")=XMZ ;set message number into array
  1. S L("DATE")=$P(%1,U) ;get origination date
  1. S %2=$P(%0,U,3)
  1. S L("DATE FM")=$S(%2?7N1".".N:%2,%2?7N:%2,1:$$CONVERT^XMXUTIL1(%2))
  1. S:L("DATE FM")<2000000 L("DATE FM")=""
  1. S L("SENDER")=$P(%1,U,3) ;get sender
  1. S L("SENDER DUZ")=$S($P(%0,U,2):$P(%0,U,2),1:"")
  1. S L("PXMZ")=$P(%1,U,7) ;get pointer to original message
  1. S L("TYPE")=$P(%1,U,8) ;Message Type(s)
  1. ;get number of message lines
  1. S L("LINES")=$S($D(^XMB(3.9,XMZ,2,0)):$P(^(0),U,4),1:"")
  1. S L("SUBJ")=$P(%1,U,6) ;get subject
  1. S L("SURROG")=$P(%1,U,5) ;get surrogate
  1. S XMK=$O(^XMB(3.7,"M",XMZ,D,0)) ;get basket
  1. I XMK,$D(^XMB(3.7,D,2,XMK,0)) D
  1. . S L("BSKT")=$P(^(0),U)
  1. . S L("BSKT IEN")=XMK
  1. E D
  1. . S L("BSKT")=""
  1. . S L("BSKT IEN")=""
  1. I $G(XMK) S L("NEW")=$S($D(^XMB(3.7,D,"N0",XMK,XMZ)):1,1:0)
  1. G Q:F=0
  1. ;get responses read/received
  1. S L("RRED")="",L("RRCV")="",%1=$O(^XMB(3.9,XMZ,1,"C",D,0))
  1. I %1 S L("RRED")=$P(^XMB(3.9,XMZ,1,%1,0),U,2)
  1. I $D(^XMB(3.9,XMZ,3,0)) S L("RRCV")=$P(^(0),U,4)
  1. S L("BLOBCNT")=0 ;get blob count
  1. I $D(^XMB(3.9,XMZ,2005,0)) S L("BLOBCNT")=$P(^(0),U,3)
  1. G Q:F=1,BLOB:F=92
  1. ;flag=91 - get response numbers and values
  1. S %1=0 F S %1=$O(^XMB(3.9,XMZ,3,%1)) Q:'%1 S L("RSP",%1)=^(%1,0)
  1. I F=91 G Q
  1. ;flag=92 - get nodes and values of non-textual body parts
  1. BLOB S %1=0 F S %1=$O(^XMB(3.9,XMZ,2005,%1)) Q:'%1 S L("BLOB",%1)=^(%1,0)
  1. Q Q 0
  1. ERR Q %