| 1 | XMXAPI ;ISC-SF/GMB-Message APIs ;03/26/2003  07:56
 | 
|---|
| 2 |  ;;8.0;MailMan;**15**;Jun 28, 2002
 | 
|---|
| 3 |  ; All entry points covered by DBIA 2729.
 | 
|---|
| 4 |  ; Variables input:
 | 
|---|
| 5 |  ; XMATTACH  Imaging system BLOB attachment array
 | 
|---|
| 6 |  ; XMBODY    Message text (MUST NOT BE "XMBODY")
 | 
|---|
| 7 |  ;              (must be closed root, passed by value.  See WP_ROOT
 | 
|---|
| 8 |  ;               definition for WP^DIE(), FM word processing filer)
 | 
|---|
| 9 |  ; XMDUZ     User's DUZ, or enough of user's name for a positive ID
 | 
|---|
| 10 |  ;              eg: 1301 or "lastname,firs"
 | 
|---|
| 11 |  ; XMK       Basket number, or enough of a name for a positive ID
 | 
|---|
| 12 |  ;              eg: 1 or "IN"
 | 
|---|
| 13 |  ; XMKZ      Message number in basket XMK
 | 
|---|
| 14 |  ;           OR
 | 
|---|
| 15 |  ;           if $G(XMK)="", Message number in ^XMB(3.9
 | 
|---|
| 16 |  ; XMKZA     Message number list or list array in basket XMK
 | 
|---|
| 17 |  ;              eg: "1,3,5-7" or ARRAY("1,3")=""
 | 
|---|
| 18 |  ;                               ARRAY("5-7")=""
 | 
|---|
| 19 |  ;              (list may end in comma)
 | 
|---|
| 20 |  ;              (ARRAY must be passed by reference)
 | 
|---|
| 21 |  ;           OR
 | 
|---|
| 22 |  ;           if $G(XMK)="", Message number list or list array in ^XMB(3.9
 | 
|---|
| 23 |  ;              (same rules, but number ranges are NOT allowed)
 | 
|---|
| 24 |  ; XMSUBJ    Message subject
 | 
|---|
| 25 |  ; XMTO      Addressee or addressee array
 | 
|---|
| 26 |  ;              (array must be passed by reference)
 | 
|---|
| 27 |  ;           User's DUZ, or enough of user's name for a positive ID
 | 
|---|
| 28 |  ;              eg: 1301 or "lastname,firs" or ARRAY(1301)=""
 | 
|---|
| 29 |  ;                                             ARRAY("lastname,firs")=""
 | 
|---|
| 30 |  ;           G.group name (enough for positive ID)
 | 
|---|
| 31 |  ;           S.server name (enough for positive ID)
 | 
|---|
| 32 |  ;           D.device name (enough for positive ID)
 | 
|---|
| 33 |  ;           prefix above (except devices and servers) by:
 | 
|---|
| 34 |  ;              I: for 'information only' recipient (may not reply)
 | 
|---|
| 35 |  ;                 eg: "I:1301" or "I:lastname,firs"
 | 
|---|
| 36 |  ;              C: for 'copy' recipient (not expected to reply)
 | 
|---|
| 37 |  ;                 eg: "C:1301" or "C:lastname,firs"
 | 
|---|
| 38 |  ;              L@datetime: for when (in future) to send to this recipient
 | 
|---|
| 39 |  ;                 (datetime may be anything accepted by FM)
 | 
|---|
| 40 |  ;                 eg: "L@25 DEC@0500:1301" or "L@1 JAN:lastname,firs"
 | 
|---|
| 41 |  ;                     or "L@2981225.05:1301"
 | 
|---|
| 42 |  ;              (may combine IL@datetime:  or  CL@datetime:)
 | 
|---|
| 43 |  ;           To delete recipient, prefix by -
 | 
|---|
| 44 |  ;                 eg: -1301 or "-lastname,firs"
 | 
|---|
| 45 |  ; XMZ       message number in ^XMB(3.9,
 | 
|---|
| 46 |  ;
 | 
|---|
| 47 |  ; Variables output (must be passed by reference):
 | 
|---|
| 48 |  ; XMFULL    expanded address of last addressee
 | 
|---|
| 49 |  ; XMMSG     simple message telling how many messages were acted on
 | 
|---|
| 50 |  ; XMZ       message number created in ^XMB(3.9,
 | 
|---|
| 51 |  ;
 | 
|---|
| 52 |  ; Errors
 | 
|---|
| 53 |  ; XMERR     if there's any errors, then XMERR is set to the number of
 | 
|---|
| 54 |  ;           errors, otherwise XMERR is undefined.
 | 
|---|
| 55 |  ;           ^TMP("XMERR",$J,error number,"TEXT",line number)=error text
 | 
|---|
| 56 | ANSRMSG(XMDUZ,XMK,XMKZ,XMSUBJ,XMBODY,XMTO,XMINSTR,XMZR) ; Answer a msg (Send new msg with copy of original msg inside)
 | 
|---|
| 57 |  ; In:  User, basket, msg #
 | 
|---|
| 58 |  ; Out: XMZR (message number of answer)
 | 
|---|
| 59 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 60 |  D ANSRMSG^XMXPARM(.XMDUZ,.XMK,.XMKZ,.XMSUBJ,.XMBODY,.XMTO,.XMINSTR) Q:$D(XMERR)
 | 
|---|
| 61 |  D ANSRMSG^XMXANSER(XMDUZ,.XMK,XMKZ,.XMSUBJ,XMBODY,.XMTO,.XMINSTR,.XMZR)
 | 
|---|
| 62 |  Q
 | 
|---|
| 63 | DELMSG(XMDUZ,XMK,XMKZA,XMMSG) ; Delete msgs from a basket
 | 
|---|
| 64 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 65 |  D ACTMSGS^XMXPARM(.XMDUZ,.XMK,.XMKZA) Q:$D(XMERR)
 | 
|---|
| 66 |  D DELMSG^XMXMSGS(XMDUZ,.XMK,.XMKZA,.XMMSG)
 | 
|---|
| 67 |  Q
 | 
|---|
| 68 | FLTRMSG(XMDUZ,XMK,XMKZA,XMMSG) ; Filters msgs in a basket
 | 
|---|
| 69 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 70 |  D ACTMSGS^XMXPARM(.XMDUZ,.XMK,.XMKZA) Q:$D(XMERR)
 | 
|---|
| 71 |  D FLTRMSG^XMXMSGS(XMDUZ,.XMK,.XMKZA,.XMMSG)
 | 
|---|
| 72 |  Q
 | 
|---|
| 73 | FWDMSG(XMDUZ,XMK,XMKZA,XMTO,XMINSTR,XMMSG) ; Forward msgs
 | 
|---|
| 74 |  ; XMINSTR("SHARE DATE")
 | 
|---|
| 75 |  ; XMINSTR("SHARE BSKT")
 | 
|---|
| 76 |  ; XMINSTR("SELF BSKT")
 | 
|---|
| 77 |  ; XMINSTR("FWD BY") substitute any string instead of XMDUZ name
 | 
|---|
| 78 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 79 |  D FWDMSG^XMXPARM(.XMDUZ,.XMK,.XMKZA,.XMTO,.XMINSTR) Q:$D(XMERR)
 | 
|---|
| 80 |  D FWDMSG^XMXMSGS(XMDUZ,.XMK,.XMKZA,.XMTO,.XMINSTR,.XMMSG)
 | 
|---|
| 81 |  Q
 | 
|---|
| 82 | LATERMSG(XMDUZ,XMK,XMKZA,XMINSTR,XMMSG) ; Later msgs
 | 
|---|
| 83 |  ; XMINSTR("LATER")
 | 
|---|
| 84 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 85 |  D LATERMSG^XMXPARM(.XMDUZ,.XMK,.XMKZA,.XMINSTR) Q:$D(XMERR)
 | 
|---|
| 86 |  D LATERMSG^XMXMSGS(XMDUZ,.XMK,.XMKZA,.XMINSTR,.XMMSG)
 | 
|---|
| 87 |  Q
 | 
|---|
| 88 | MOVEMSG(XMDUZ,XMK,XMKZA,XMKTO,XMMSG) ; Move msgs from one basket to another
 | 
|---|
| 89 |  ; XMKTO   Basket number, or enough of a name for a positive ID.
 | 
|---|
| 90 |  ;         Identifies basket to move to
 | 
|---|
| 91 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 92 |  D MOVEMSG^XMXPARM(.XMDUZ,.XMK,.XMKZA,.XMKTO) Q:$D(XMERR)
 | 
|---|
| 93 |  D MOVEMSG^XMXMSGS(XMDUZ,.XMK,.XMKZA,XMKTO,.XMMSG)
 | 
|---|
| 94 |  Q
 | 
|---|
| 95 | NTOGLMSG(XMDUZ,XMK,XMKZA,XMMSG) ; New Toggle msgs
 | 
|---|
| 96 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 97 |  D ACTMSGS^XMXPARM(.XMDUZ,.XMK,.XMKZA) Q:$D(XMERR)
 | 
|---|
| 98 |  D NTOGLMSG^XMXMSGS(XMDUZ,.XMK,.XMKZA,.XMMSG)
 | 
|---|
| 99 |  Q
 | 
|---|
| 100 | PRTMSG(XMDUZ,XMK,XMKZA,XMPRTTO,XMINSTR,XMMSG,XMTASK,XMSUBJ,XMTO) ; Print msgs
 | 
|---|
| 101 |  ; XMINSTR("HDR"), "RESPS", "RECIPS", "WHEN"
 | 
|---|
| 102 |  ; XMPRTTO Printer name
 | 
|---|
| 103 |  ; XMSUBJ & XMTO used only if XMPRTTO is a P-MESSAGE device.  Even then, they're optional.
 | 
|---|
| 104 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 105 |  D PRTMSG^XMXPARM(.XMDUZ,.XMK,.XMKZA,.XMPRTTO,.XMINSTR,.XMSUBJ,.XMTO) Q:$D(XMERR)
 | 
|---|
| 106 |  D PRTMSG^XMXMSGS(XMDUZ,.XMK,.XMKZA,XMPRTTO,.XMINSTR,.XMMSG,.XMTASK,.XMSUBJ,.XMTO)
 | 
|---|
| 107 |  Q
 | 
|---|
| 108 | PUTSERV(XMKN,XMZ) ; Put a message in a server basket
 | 
|---|
| 109 |  ; XMKN   full server name, including "S."
 | 
|---|
| 110 |  D SERV^XMXPARMB(.XMKN,.XMZ) Q:$D(XMERR)
 | 
|---|
| 111 |  D PUTSERV^XMXMSGS1(XMKN,XMZ)
 | 
|---|
| 112 |  Q
 | 
|---|
| 113 | REPLYMSG(XMDUZ,XMK,XMKZ,XMBODY,XMINSTR,XMZR) ; Reply to msg (Attach reply to original msg)
 | 
|---|
| 114 |  ; XMINSTR("NET REPLY") 1=send over the network; 0=don't (default)
 | 
|---|
| 115 |  ; XMINSTR("NET SUBJ")  Network Reply subject (see XMSUBJ)
 | 
|---|
| 116 |  ; Out: XMZR (message number of answer)
 | 
|---|
| 117 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 118 |  D REPLYMSG^XMXPARM(.XMDUZ,.XMK,.XMKZ,.XMBODY,.XMINSTR) Q:$D(XMERR)
 | 
|---|
| 119 |  D REPLYMSG^XMXREPLY(XMDUZ,.XMK,XMKZ,XMBODY,.XMINSTR,.XMZR)
 | 
|---|
| 120 |  Q
 | 
|---|
| 121 | SENDBULL(XMDUZ,XMBN,XMPARM,XMBODY,XMTO,XMINSTR,XMZ,XMATTACH) ; Send a bulletin (returns XMZ)
 | 
|---|
| 122 |  ; In:  User, bulletin name, bulletin parameters, add'l text,
 | 
|---|
| 123 |  ;      add'l recipients, send now or later (when?), opt'l BLOB
 | 
|---|
| 124 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 125 |  D BULLETIN^XMXPARM(.XMDUZ,.XMBN,.XMPARM,.XMBODY,.XMTO,.XMINSTR,.XMATTACH) Q:$D(XMERR)
 | 
|---|
| 126 |  D SENDBULL^XMXBULL(XMDUZ,XMBN,.XMPARM,.XMBODY,.XMTO,.XMINSTR,.XMZ,.XMATTACH)
 | 
|---|
| 127 |  Q
 | 
|---|
| 128 | SENDMSG(XMDUZ,XMSUBJ,XMBODY,XMTO,XMINSTR,XMZ,XMATTACH) ; Send a msg
 | 
|---|
| 129 |  ; In:  User, basket (if you are recipient), all msg parts,
 | 
|---|
| 130 |  ;      priority?, closed?, (info?,cc?), send now or later (when?),
 | 
|---|
| 131 |  ;      (KIDS,MIME,text,PackMan), delete date (if to shared,mail)
 | 
|---|
| 132 |  ; XMINSTR("RCPT BSKT")
 | 
|---|
| 133 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 134 |  D SENDMSG^XMXPARM(.XMDUZ,.XMSUBJ,.XMBODY,.XMTO,.XMINSTR,.XMATTACH) Q:$D(XMERR)
 | 
|---|
| 135 |  D SENDMSG^XMXSEND(XMDUZ,XMSUBJ,XMBODY,.XMTO,.XMINSTR,.XMZ,.XMATTACH)
 | 
|---|
| 136 |  Q
 | 
|---|
| 137 | TASKBULL(XMDUZ,XMBN,XMPARM,XMBODY,XMTO,XMINSTR,XMTASK,XMATTACH) ; Send a bulletin (Task it - does not return XMZ)
 | 
|---|
| 138 |  ; XMBN     Bulletin name (must be full name)
 | 
|---|
| 139 |  ; XMPARM   Array of parameters necessary for bulletin
 | 
|---|
| 140 |  ;             ARRAY(1)="parameter 1"
 | 
|---|
| 141 |  ;             ARRAY(2)="parameter 2"
 | 
|---|
| 142 |  ; XMBODY   Additional text to append to the bulletin text
 | 
|---|
| 143 |  ;              (must be closed root, passed by value.  See WP_ROOT
 | 
|---|
| 144 |  ;               definition for WP^DIE(), FM word processing filer)
 | 
|---|
| 145 |  ; XMTO     Additional addressee(s)
 | 
|---|
| 146 |  ; XMINSTR("SELF BSKT")
 | 
|---|
| 147 |  ;  ***ETC.***
 | 
|---|
| 148 |  ; In:  User, bulletin name, bulletin parameters, add'l text,
 | 
|---|
| 149 |  ;      add'l recipients, send now or later (when?), opt'l BLOB
 | 
|---|
| 150 |  ; Out: XMTASK (task number)
 | 
|---|
| 151 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 152 |  D BULLETIN^XMXPARM(.XMDUZ,.XMBN,.XMPARM,.XMBODY,.XMTO,.XMINSTR,.XMATTACH) Q:$D(XMERR)
 | 
|---|
| 153 |  D TASKBULL^XMXBULL(XMDUZ,XMBN,.XMPARM,.XMBODY,.XMTO,.XMINSTR,.XMTASK,.XMATTACH)
 | 
|---|
| 154 |  Q
 | 
|---|
| 155 | TERMMSG(XMDUZ,XMK,XMKZA,XMMSG) ; Terminate msgs
 | 
|---|
| 156 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 157 |  D ACTMSGS^XMXPARM(.XMDUZ,.XMK,.XMKZA) Q:$D(XMERR)
 | 
|---|
| 158 |  D TERMMSG^XMXMSGS(XMDUZ,.XMK,.XMKZA,.XMMSG)
 | 
|---|
| 159 |  Q
 | 
|---|
| 160 | VAPORMSG(XMDUZ,XMK,XMKZA,XMINSTR,XMMSG) ; Set vaporize date for msgs in a basket
 | 
|---|
| 161 |  ; XMINSTR("VAPOR")
 | 
|---|
| 162 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 163 |  D VAPORMSG^XMXPARM(.XMDUZ,.XMK,.XMKZA,.XMINSTR) Q:$D(XMERR)
 | 
|---|
| 164 |  D VAPORMSG^XMXMSGS(XMDUZ,.XMK,.XMKZA,.XMINSTR,.XMMSG)
 | 
|---|
| 165 |  Q
 | 
|---|
| 166 | ZAPSERV(XMKN,XMZ) ; Delete a message from a server basket
 | 
|---|
| 167 |  ; XMKN   full server name, including "S."
 | 
|---|
| 168 |  D SERV^XMXPARMB(.XMKN,.XMZ) Q:$D(XMERR)
 | 
|---|
| 169 |  D ZAPSERV^XMXMSGS1(XMKN,XMZ)
 | 
|---|
| 170 |  Q
 | 
|---|
| 171 |  ; ***** other actions
 | 
|---|
| 172 | ADDRNSND(XMDUZ,XMZ,XMTO,XMINSTR) ; Build a message part 2 (address and send)
 | 
|---|
| 173 |  ; XMZ (in)
 | 
|---|
| 174 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 175 |  D ADDRNSND^XMXPARM(.XMDUZ,.XMZ,.XMTO,.XMINSTR) Q:$D(XMERR)
 | 
|---|
| 176 |  D ADDRNSND^XMXSEND(XMDUZ,XMZ,.XMTO,.XMINSTR)
 | 
|---|
| 177 |  Q
 | 
|---|
| 178 | CRE8XMZ(XMSUBJ,XMZ) ; Build a message part 1 (create)
 | 
|---|
| 179 |  ; In:  subject
 | 
|---|
| 180 |  ; Out: XMZ
 | 
|---|
| 181 |  D VSUBJ^XMXPARM(.XMSUBJ) Q:$D(XMERR)
 | 
|---|
| 182 |  D CRE8XMZ^XMXSEND(XMSUBJ,.XMZ)
 | 
|---|
| 183 |  Q
 | 
|---|
| 184 | MOVEBODY(XMZ,XMBODY) ; Move text to the message
 | 
|---|
| 185 |  D MOVEBODY^XMXPARM(.XMZ,.XMBODY) Q:$D(XMERR)
 | 
|---|
| 186 |  D MOVEBODY^XMXSEND(XMZ,XMBODY)
 | 
|---|
| 187 |  Q
 | 
|---|
| 188 | TOWHOM(XMDUZ,XMZ,XMTYPE,XMTO,XMINSTR,XMFULL) ; Check ONE msg addressee
 | 
|---|
| 189 |  ; XMFULL   Expanded address of the addressee
 | 
|---|
| 190 |  I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
 | 
|---|
| 191 |  D TOWHOM^XMXPARM(.XMDUZ,.XMZ,.XMTYPE,XMTO,.XMINSTR) Q:$D(XMERR)
 | 
|---|
| 192 |  D TOWHOM^XMXTO(XMDUZ,.XMZ,XMTYPE,XMTO,.XMINSTR,.XMFULL)
 | 
|---|
| 193 |  Q
 | 
|---|
| 194 | VSUBJ(XMSUBJ) ; Validate a subject
 | 
|---|
| 195 |  D VSUBJ^XMXPARM(.XMSUBJ)
 | 
|---|
| 196 |  Q
 | 
|---|