XMGAPI4 ;(WASH ISC)/CAP-Get New Msg Info ;04/17/2002 09:01
;;8.0;MailMan;;Jun 28, 2002
; Entry points (DBIA 1201 - Private!):
; $$NU Get new message info
NU(XMFORCE,XMMOVE,XMOUT) ;API for new message display
;Usage: S X=$$NU^XMGAPI4(1) = Display on screen
; S X=$$NU^XMGAPI4(0) = Do not display
; S X=$$NU^XMGAPI4(1,1,"ABC") Return displayable array "ABC"
;
;Inputs: DUZ must exist
; XMDUZ will exist if the context is in MailMan
;
;XMFORCE=1 to force new display
; =0 for no display
;XMMOVE =1 will cause an array to be passed back in array XMOUT,
; which should be passed in by value (as a quoted string).
N XMARRAY,XMI,XMNEW
D CHKMASTR($G(XMDUZ,DUZ),XMFORCE,.XMNEW,.XMARRAY,.XMI)
I $G(XMMOVE),$G(XMOUT)?1.AN S XMARRAY=+$G(XMI) M @XMOUT=XMARRAY Q XMNEW
;Return values or write
I XMFORCE S XMI=0 F S XMI=$O(XMARRAY(XMI)) Q:'XMI W !,XMARRAY(XMI)
Q XMNEW
CHK ; Sets Y = number of new messages for the user.
S:$G(XMDUZ)'=.6 Y=$$TNMSGCT^XMXUTIL($G(XMDUZ,DUZ))
D CLEANUP^XMXADDR
Q
CHKMASTR(XMUSER,XMFORCE,XMNEW,XMARRAY,XMI) ;
D CHKUSER(XMUSER,XMFORCE,.XMNEW,.XMARRAY,.XMI)
D CHKPRI(XMUSER,.XMARRAY,.XMI)
Q:XMUSER=.5!'XMFORCE!'$D(^XMB(3.7,"AB",XMUSER,.5))
Q:'$$TNMSGCT^XMXUTIL(.5)
S XMI=$G(XMI)+1,XMARRAY(XMI)=""
S XMI=XMI+1,XMARRAY(XMI)=$$EZBLD^DIALOG(38162) ; Checking POSTMASTER mailbox.
D CHKUSER(.5,XMFORCE,.XMNEW,.XMARRAY,.XMI)
Q
CHKUSER(XMUSER,XMFORCE,XMNEW,XMARRAY,XMI) ;
I '$D(^XMB(3.7,XMUSER,0)) S XMNEW=0 Q
N XMREC,XMPARM
S XMREC=$$NEWS^XMXUTIL(XMUSER,$D(DUZ("SAV")))
S XMNEW=$P(XMREC,U,1) ; new messages
Q:'XMFORCE!'XMNEW
S XMPARM(1)=$P(XMREC,U,1) S:XMUSER=.5 XMPARM(2)=$$NAME^XMXUTIL(.5)
S XMI=$G(XMI)+1,XMARRAY(XMI)=$$EZBLD^DIALOG($S(XMUSER=DUZ:38155,1:38156)+$S(XMPARM(1)>1:0,'XMPARM(1):.2,1:.1),.XMPARM) ; You have/|2| has |1|/no new message(s).
I $P(XMREC,U,6) D ; new messages in the default read (usually IN) basket.
. S XMPARM(1)=$P(XMREC,U,6),XMPARM(2)=$P(XMREC,U,8)
. S XMARRAY(XMI)=XMARRAY(XMI)_$$EZBLD^DIALOG(38157,.XMPARM) ; (|1| in the '|2|' basket)
I $P(XMREC,U,5) D ; if last arrival > latest notification...
. S XMI=XMI+1,XMARRAY(XMI)=$$EZBLD^DIALOG(38158,$$MMDT^XMXUTIL1($P(XMREC,U,4))) ; (Last arrival: |1|)"
Q:XMUSER=.5
S XMI=XMI+1,XMARRAY(XMI)=""
S XMI=XMI+1,XMARRAY(XMI)=$$EZBLD^DIALOG(38161) ; Enter '^NML' to read your new messages.
Q
CHKPRI(XMUSER,XMARRAY,XMI) ;
Q:'$D(^XMB(3.7,XMUSER,"N"))
I '$D(IORVON) N IORVON,IORVOFF,IOBON,IOBOFF D ZIS^XM
S XMI=$G(XMI)+1,XMARRAY(XMI)=$G(IORVON)_$$EZBLD^DIALOG(38159)_$G(IORVOFF) ; You've got PRIORITY mail!
Q
; >>>> I don't think anything after here is used. <<<<
LST(A,X,Y) ;List NEW message (or any other) array
; A=Array to list
; X=X address of box
; Y=Y address of box
N I,S
S I="",$P(S," ",IOM+1)=""
F S I=$O(A(I)) Q:I="" D
. I $G(X) S DX=X,DY=Y X IOXY
. E W !
. W $E(A(I)_S,1,IOM-$G(X))
. I $D(Y) S Y=Y+1
Q
PRIALRT ; Priority Mail Alert
N XQAID
S XQAID="XM-PRIOMESS" D ALERT
I '$D(XMDUZ) N XMDUZ S XMDUZ=DUZ
W !,"Select new PRIORITY messages (one at a time) from the list given."
D INIT^XMVVITAE
D LISTALL^XMJMLN(XMDUZ,"N")
Q
NEWALRT ; Alert for NEW Mail
N XQAID
S XQAID="XM-NEWMESS" D ALERT
I '$D(XMDUZ) N XMDUZ S XMDUZ=DUZ
W !,"Select NEW messages (one at a time) from the list given."
D INIT^XMVVITAE
D LISTALL^XMJMLN(XMDUZ,"N0")
Q
ALERT ;
N X,XQAKILL
S X=$$NU(1,1,"X")
D LST(.X)
S XQA($S($G(XMDUZ):XMDUZ,1:DUZ))="",XQAKILL=1
D DELETEA^XQALERT
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXMGAPI4 3553 printed Oct 16, 2024@18:12:25 Page 2
XMGAPI4 ;(WASH ISC)/CAP-Get New Msg Info ;04/17/2002 09:01
+1 ;;8.0;MailMan;;Jun 28, 2002
+2 ; Entry points (DBIA 1201 - Private!):
+3 ; $$NU Get new message info
NU(XMFORCE,XMMOVE,XMOUT) ;API for new message display
+1 ;Usage: S X=$$NU^XMGAPI4(1) = Display on screen
+2 ; S X=$$NU^XMGAPI4(0) = Do not display
+3 ; S X=$$NU^XMGAPI4(1,1,"ABC") Return displayable array "ABC"
+4 ;
+5 ;Inputs: DUZ must exist
+6 ; XMDUZ will exist if the context is in MailMan
+7 ;
+8 ;XMFORCE=1 to force new display
+9 ; =0 for no display
+10 ;XMMOVE =1 will cause an array to be passed back in array XMOUT,
+11 ; which should be passed in by value (as a quoted string).
+12 NEW XMARRAY,XMI,XMNEW
+13 DO CHKMASTR($GET(XMDUZ,DUZ),XMFORCE,.XMNEW,.XMARRAY,.XMI)
+14 IF $GET(XMMOVE)
IF $GET(XMOUT)?1.AN
SET XMARRAY=+$GET(XMI)
MERGE @XMOUT=XMARRAY
QUIT XMNEW
+15 ;Return values or write
+16 IF XMFORCE
SET XMI=0
FOR
SET XMI=$ORDER(XMARRAY(XMI))
if 'XMI
QUIT
WRITE !,XMARRAY(XMI)
+17 QUIT XMNEW
CHK ; Sets Y = number of new messages for the user.
+1 if $GET(XMDUZ)'=.6
SET Y=$$TNMSGCT^XMXUTIL($GET(XMDUZ,DUZ))
+2 DO CLEANUP^XMXADDR
+3 QUIT
CHKMASTR(XMUSER,XMFORCE,XMNEW,XMARRAY,XMI) ;
+1 DO CHKUSER(XMUSER,XMFORCE,.XMNEW,.XMARRAY,.XMI)
+2 DO CHKPRI(XMUSER,.XMARRAY,.XMI)
+3 if XMUSER=.5!'XMFORCE!'$DATA(^XMB(3.7,"AB",XMUSER,.5))
QUIT
+4 if '$$TNMSGCT^XMXUTIL(.5)
QUIT
+5 SET XMI=$GET(XMI)+1
SET XMARRAY(XMI)=""
+6 ; Checking POSTMASTER mailbox.
SET XMI=XMI+1
SET XMARRAY(XMI)=$$EZBLD^DIALOG(38162)
+7 DO CHKUSER(.5,XMFORCE,.XMNEW,.XMARRAY,.XMI)
+8 QUIT
CHKUSER(XMUSER,XMFORCE,XMNEW,XMARRAY,XMI) ;
+1 IF '$DATA(^XMB(3.7,XMUSER,0))
SET XMNEW=0
QUIT
+2 NEW XMREC,XMPARM
+3 SET XMREC=$$NEWS^XMXUTIL(XMUSER,$DATA(DUZ("SAV")))
+4 ; new messages
SET XMNEW=$PIECE(XMREC,U,1)
+5 if 'XMFORCE!'XMNEW
QUIT
+6 SET XMPARM(1)=$PIECE(XMREC,U,1)
if XMUSER=.5
SET XMPARM(2)=$$NAME^XMXUTIL(.5)
+7 ; You have/|2| has |1|/no new message(s).
SET XMI=$GET(XMI)+1
SET XMARRAY(XMI)=$$EZBLD^DIALOG($SELECT(XMUSER=DUZ:38155,1:38156)+$SELECT(XMPARM(1)>1:0,'XMPARM(1):.2,1:.1),.XMPARM)
+8 ; new messages in the default read (usually IN) basket.
IF $PIECE(XMREC,U,6)
Begin DoDot:1
+9 SET XMPARM(1)=$PIECE(XMREC,U,6)
SET XMPARM(2)=$PIECE(XMREC,U,8)
+10 ; (|1| in the '|2|' basket)
SET XMARRAY(XMI)=XMARRAY(XMI)_$$EZBLD^DIALOG(38157,.XMPARM)
End DoDot:1
+11 ; if last arrival > latest notification...
IF $PIECE(XMREC,U,5)
Begin DoDot:1
+12 ; (Last arrival: |1|)"
SET XMI=XMI+1
SET XMARRAY(XMI)=$$EZBLD^DIALOG(38158,$$MMDT^XMXUTIL1($PIECE(XMREC,U,4)))
End DoDot:1
+13 if XMUSER=.5
QUIT
+14 SET XMI=XMI+1
SET XMARRAY(XMI)=""
+15 ; Enter '^NML' to read your new messages.
SET XMI=XMI+1
SET XMARRAY(XMI)=$$EZBLD^DIALOG(38161)
+16 QUIT
CHKPRI(XMUSER,XMARRAY,XMI) ;
+1 if '$DATA(^XMB(3.7,XMUSER,"N"))
QUIT
+2 IF '$DATA(IORVON)
NEW IORVON,IORVOFF,IOBON,IOBOFF
DO ZIS^XM
+3 ; You've got PRIORITY mail!
SET XMI=$GET(XMI)+1
SET XMARRAY(XMI)=$GET(IORVON)_$$EZBLD^DIALOG(38159)_$GET(IORVOFF)
+4 QUIT
+5 ; >>>> I don't think anything after here is used. <<<<
LST(A,X,Y) ;List NEW message (or any other) array
+1 ; A=Array to list
+2 ; X=X address of box
+3 ; Y=Y address of box
+4 NEW I,S
+5 SET I=""
SET $PIECE(S," ",IOM+1)=""
+6 FOR
SET I=$ORDER(A(I))
if I=""
QUIT
Begin DoDot:1
+7 IF $GET(X)
SET DX=X
SET DY=Y
XECUTE IOXY
+8 IF '$TEST
WRITE !
+9 WRITE $EXTRACT(A(I)_S,1,IOM-$GET(X))
+10 IF $DATA(Y)
SET Y=Y+1
End DoDot:1
+11 QUIT
PRIALRT ; Priority Mail Alert
+1 NEW XQAID
+2 SET XQAID="XM-PRIOMESS"
DO ALERT
+3 IF '$DATA(XMDUZ)
NEW XMDUZ
SET XMDUZ=DUZ
+4 WRITE !,"Select new PRIORITY messages (one at a time) from the list given."
+5 DO INIT^XMVVITAE
+6 DO LISTALL^XMJMLN(XMDUZ,"N")
+7 QUIT
NEWALRT ; Alert for NEW Mail
+1 NEW XQAID
+2 SET XQAID="XM-NEWMESS"
DO ALERT
+3 IF '$DATA(XMDUZ)
NEW XMDUZ
SET XMDUZ=DUZ
+4 WRITE !,"Select NEW messages (one at a time) from the list given."
+5 DO INIT^XMVVITAE
+6 DO LISTALL^XMJMLN(XMDUZ,"N0")
+7 QUIT
ALERT ;
+1 NEW X,XQAKILL
+2 SET X=$$NU(1,1,"X")
+3 DO LST(.X)
+4 SET XQA($SELECT($GET(XMDUZ):XMDUZ,1:DUZ))=""
SET XQAKILL=1
+5 DO DELETEA^XQALERT
+6 QUIT