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

XMXMSGS.m

Go to the documentation of this file.
  1. XMXMSGS ;ISC-SF/GMB-Message APIs ;08/06/2002 06:45
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. DELMSG(XMDUZ,XMK,XMKZA,XMMSG) ; Delete msgs in mailbox
  1. K XMERR,^TMP("XMERR",$J)
  1. I XMDUZ'=DUZ,'$$RPRIV^XMXSEC Q
  1. D ACTMSG("XDEL^XMXMSGS2",34302) ;,XMDUZ,XMK,.XMKZA,"",.XMMSG)
  1. Q
  1. FLTRMSG(XMDUZ,XMK,XMKZA,XMMSG) ; Filter msgs
  1. K XMERR,^TMP("XMERR",$J)
  1. I XMDUZ'=DUZ,'$$RPRIV^XMXSEC Q
  1. N XMKN,XMKTO,XMKNTO
  1. I $G(XMK)'=.5,'$G(XMK),'$D(^XMB(3.7,XMDUZ,15,"AF")) D ERRSET^XMXUTIL(37204.1) Q ; You have no message filters defined.
  1. I $G(XMK) S XMKN=$P(^XMB(3.7,XMDUZ,2,XMK,0),U,1)
  1. D ACTMSG("XFLTR^XMXMSGS2",34306) ;,XMDUZ,XMK,XMKN,.XMKZA,"",.XMMSG)
  1. Q
  1. FWDMSG(XMDUZ,XMK,XMKZA,XMTO,XMINSTR,XMMSG) ; Forward msgs
  1. ; XMINSTR("SHARE DATE") delete date if SHARED,MAIL is recipient
  1. ; XMINSTR("SHARE BSKT") basket if SHARED,MAIL is recipient
  1. K XMERR,^TMP("XMERR",$J)
  1. I XMDUZ'=DUZ,'$$RPRIV^XMXSEC Q
  1. N XMRTN
  1. I $$ONEMSG(.XMKZA) D
  1. . S XMRTN="XFWDONE^XMXMSGS1" ; just one msg
  1. E D
  1. . S XMRTN="XFWD^XMXMSGS1"
  1. . I $G(XMINSTR("ADDR FLAGS"))'["I" D INIT^XMXADDR
  1. . D CHKADDR^XMXADDR(XMDUZ,.XMTO,.XMINSTR)
  1. D ACTMSG(XMRTN,34309) ;,XMDUZ,XMK,.XMKZA,.XMINSTR,.XMMSG)
  1. D CLEANUP^XMXADDR
  1. Q
  1. ONEMSG(XMKZA) ; Function decides if just one message
  1. N XMONE,XMMSGS
  1. I $G(XMKZA)]"" D Q XMONE
  1. . I $O(XMKZA(""))="",+XMKZA=XMKZA S XMONE=1 Q
  1. . S XMONE=0
  1. S XMMSGS=$O(XMKZA(""))
  1. I $O(XMKZA(XMMSGS))'="" Q 0
  1. I +XMMSGS=XMMSGS Q 1
  1. Q 0
  1. LATERMSG(XMDUZ,XMK,XMKZA,XMINSTR,XMMSG) ; Later msgs
  1. ; XMINSTR("LATER") FM date/time when msg should be made new.
  1. K XMERR,^TMP("XMERR",$J)
  1. Q:'$$LATER^XMXSEC(XMDUZ)
  1. N XMWHEN
  1. S XMWHEN=$G(XMINSTR("LATER"),$G(XMINSTR))
  1. D ACTMSG("XLATER^XMXMSGS2",34312) ;,XMDUZ,XMK,.XMKZA,.XMINSTR,.XMMSG)
  1. Q
  1. MOVEMSG(XMDUZ,XMK,XMKZA,XMKTO,XMMSG) ; Move msgs to a basket
  1. K XMERR,^TMP("XMERR",$J)
  1. I XMDUZ'=DUZ,'$$RPRIV^XMXSEC Q
  1. Q:$G(XMK)=XMKTO
  1. D ACTMSG("XMOVE^XMXMSGS2",34324) ;,XMDUZ,XMK,.XMKZA,XMKTO,.XMMSG)
  1. Q
  1. NTOGLMSG(XMDUZ,XMK,XMKZA,XMMSG) ; New toggle msgs
  1. K XMERR,^TMP("XMERR",$J)
  1. Q:'$$LATER^XMXSEC(XMDUZ)
  1. N XMKN,XMKTO,XMKNTO
  1. S:XMK XMKN=$P(^XMB(3.7,XMDUZ,2,XMK,0),U,1)
  1. D ACTMSG("XNTOGL^XMXMSGS2",34315) ;,XMDUZ,XMK,XMKN,.XMKZA,"",.XMMSG)
  1. Q
  1. PRTMSG(XMDUZ,XMK,XMKZA,XMPRTTO,XMINSTR,XMMSG,XMTASK,XMSUBJ,XMTO) ; Print msgs
  1. K XMERR,^TMP("XMERR",$J),^TMP("XM",$J,"XMZ")
  1. D ACTMSG("XPRT^XMXMSGS1",34320) ;,XMDUZ,XMK,.XMKZA,.XMINSTR,.XMMSG)
  1. Q:+XMMSG=0
  1. I +XMMSG=1 D
  1. . D PRINT1^XMXPRT(XMDUZ,$O(^TMP("XM",$J,"XMZ","")),XMPRTTO,.XMINSTR,.XMTASK,.XMSUBJ,.XMTO)
  1. E D
  1. . D PRINTM^XMXPRT(XMDUZ,XMPRTTO,.XMINSTR,.XMTASK,.XMSUBJ,.XMTO)
  1. K ^TMP("XM",$J,"XMZ")
  1. Q:$D(XMTASK)
  1. S XMMSG=$$EZBLD^DIALOG(34321) ; 0 messages sent to printer. TaskMan Problem.
  1. D ERRSET^XMXUTIL(34311) ; Task creation not successful.
  1. Q
  1. TERMMSG(XMDUZ,XMK,XMKZA,XMMSG) ; Terminate msgs
  1. K XMERR,^TMP("XMERR",$J)
  1. I XMDUZ'=DUZ,'$$RPRIV^XMXSEC Q
  1. D ACTMSG("XTERM^XMXMSGS2",34329) ;,XMDUZ,XMK,.XMKZA,"",.XMMSG)
  1. Q
  1. VAPORMSG(XMDUZ,XMK,XMKZA,XMINSTR,XMMSG) ; Set vaporize dates for msgs in mailbox
  1. K XMERR,^TMP("XMERR",$J)
  1. I XMDUZ'=DUZ,'$$RPRIV^XMXSEC Q
  1. N XMWHEN
  1. S XMWHEN=$G(XMINSTR("VAPOR"),$G(XMINSTR))
  1. D ACTMSG("XVAPOR^XMXMSGS2",$S(XMWHEN="@":34337.2,1:34337)) ;,XMDUZ,XMK,.XMKZA,XMWHEN,.XMMSG)
  1. Q
  1. XPMSG(XMDUZ,XMK,XMKZA,XMINSTR,XMMSG) ; Postmaster transmit priority toggle
  1. K XMERR,^TMP("XMERR",$J)
  1. I XMDUZ'=DUZ,'$$RPRIV^XMXSEC Q
  1. I XMDUZ'=.5!(XMK'>999) D ERRSET^XMXUTIL(37219.5) Q ;Transmission Priority toggle valid only for Postmaster Transmission Queues.
  1. N XMTPRI
  1. S XMTPRI=$G(XMINSTR("XMIT PRI"),$G(XMINSTR))
  1. D ACTMSG("XXP^XMXMSGS1",34334) ;,XMDUZ,XMK,.XMKZA,XMTPRI,.XMMSG)
  1. Q
  1. ACTMSG(XMRTN,XMSUM) ;,XMDUZ,XMK,XMKZA,XMKTO,XMMSG)
  1. ; XMKZA Array of msg numbers DEL("1-3,7,11-15")
  1. ; XMKZL List of msg numbers 1-3,7,11-15
  1. ; (It is OK if the list ends with a comma)
  1. ; XMKZR Range of msg numbers 1-3
  1. ; XMKZ1 First number in range 1
  1. ; XMKZN Last number in range 3
  1. ; XMKZ Message number
  1. N XMCNT,XMI,XMZ,XMPIECES
  1. S XMCNT=0
  1. I $G(XMK) D
  1. . N XMKZ,XMKZL,XMKZR,XMKZ1,XMKZN
  1. . ; is this an array or a variable?
  1. . I $G(XMKZA)]"",$O(XMKZA(""))="" S XMKZA(XMKZA)=""
  1. . S XMKZL=""
  1. . F S XMKZL=$O(XMKZA(XMKZL)) Q:XMKZL="" D
  1. . . S XMPIECES=$L(XMKZL,",")
  1. . . S:$P(XMKZL,",",XMPIECES)="" XMPIECES=XMPIECES-1
  1. . . F XMI=1:1:XMPIECES D
  1. . . . S XMKZR=$P(XMKZL,",",XMI)
  1. . . . I XMKZR["-" D
  1. . . . . ; deal with a range of msg #s
  1. . . . . S XMKZ1=$P(XMKZR,"-",1)
  1. . . . . S XMKZN=$P(XMKZR,"-",2)
  1. . . . . I XMKZ1>XMKZN D Q
  1. . . . . . N XMPARM
  1. . . . . . S XMPARM(1)=XMKZ1,XMPARM(2)=XMKZN
  1. . . . . . D ERRSET^XMXUTIL(34350,.XMPARM) ; Range '_XMKZ1_-_XMKZN_' invalid.
  1. . . . . S XMKZ=XMKZ1-.1
  1. . . . . F S XMKZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ)) Q:'XMKZ!(XMKZ>XMKZN) D
  1. . . . . . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ,""))
  1. . . . . . I 'XMZ D Q
  1. . . . . . . N XMPARM
  1. . . . . . . S XMPARM(1)=XMKZ,XMPARM(2)=XMK
  1. . . . . . . D ERRSET^XMXUTIL(34351,.XMPARM) ; Message _XMKZ_ in basket _XMK_ does not exist.
  1. . . . . . I '$D(^XMB(3.9,XMZ,0)) D Q
  1. . . . . . . N XMPARM
  1. . . . . . . S XMPARM(1)=XMZ,XMPARM(2)=XMKZ,XMPARM(3)=XMK
  1. . . . . . . D ERRSET^XMXUTIL(34352,.XMPARM) ; Message '_XMZ_' (message _XMKZ_ in basket _XMK_) does not exist.
  1. . . . . . D @XMRTN ;(XMDUZ,XMK,XMZ)
  1. . . . E D
  1. . . . . S XMKZ=XMKZR
  1. . . . . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ,""))
  1. . . . . I 'XMZ D Q
  1. . . . . . N XMPARM
  1. . . . . . S XMPARM(1)=XMKZ,XMPARM(2)=XMK
  1. . . . . . D ERRSET^XMXUTIL(34351,.XMPARM) ; Message _XMKZ_ in basket _XMK_ does not exist.
  1. . . . . I '$D(^XMB(3.9,XMZ,0)) D Q
  1. . . . . . N XMPARM
  1. . . . . . S XMPARM(1)=XMZ,XMPARM(2)=XMKZ,XMPARM(3)=XMK
  1. . . . . . D ERRSET^XMXUTIL(34352,.XMPARM) ; Message '_XMZ_' (message _XMKZ_ in basket _XMK_) does not exist.
  1. . . . . D @XMRTN ;(XMDUZ,XMK,XMZ)
  1. E D
  1. . N XMZL,XMZREC
  1. . ; is this an array or a variable?
  1. . I $G(XMKZA)]"",$O(XMKZA(""))="" S XMKZA(XMKZA)=""
  1. . S XMZL=""
  1. . F S XMZL=$O(XMKZA(XMZL)) Q:XMZL="" D
  1. . . I XMZL["-" D ERRSET^XMXUTIL(34353) Q ; XMZ message ranges are not allowed.
  1. . . S XMPIECES=$L(XMZL,",")
  1. . . S:'$P(XMZL,",",XMPIECES) XMPIECES=XMPIECES-1
  1. . . F XMI=1:1:XMPIECES D
  1. . . . N XMK
  1. . . . S XMZ=$P(XMZL,",",XMI)
  1. . . . I '$D(^XMB(3.9,XMZ,0)) D ERRSET^XMXUTIL(34354,XMZ) Q ; Message '_XMZ_' does not exist."
  1. . . . S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. . . . Q:'$$ACCESS^XMXSEC(XMDUZ,XMZ,XMZREC)
  1. . . . D @XMRTN ;(XMDUZ,XMK,XMZ)
  1. S XMMSG=$$EZBLD^DIALOG($S(XMCNT=1:XMSUM+.1,1:XMSUM),XMCNT)
  1. D INCRDECR(XMDUZ,.XMCNT)
  1. Q
  1. INCRDECR(XMDUZ,XMCNT) ; Update the "new messages" counts.
  1. N XMK
  1. S XMK=0
  1. F S XMK=$O(XMCNT(XMK)) Q:'XMK D
  1. . S XMCNT=$G(XMCNT(XMK,"INCR"))-$G(XMCNT(XMK,"DECR"))
  1. . Q:'XMCNT
  1. . I XMCNT<0 D DECRNEW^XMXUTIL(XMDUZ,XMK,-XMCNT) Q
  1. . D INCRNEW^XMXUTIL(XMDUZ,XMK,XMCNT)
  1. Q