VistA-WorldVistAEHR/r/MAILMAN-XM/XMTDL1.m

42 lines
2.0 KiB
Mathematica

XMTDL1 ;ISC-SF/GMB-Deliver local mail to mailbox (cont.) ;04/15/2003 12:53
;;8.0;MailMan;**18**;Jun 28, 2002
BRODCAST(XMZ,XMZSUBJ,XMZFROM,XMFROM,XMK,XMDEL,XMZPDATE,XMZBSKT,XMACNT) ;
N XMTO,XMREC,XMIA,XMNOFWD
; Don't forward message if this is FORUM and it was sent to G.EVERYBODY.
S XMNOFWD=$S('$$FORUM^XMXADDRD:0,'$D(^XMB(3.9,XMZ,6,"B","G.EVERYBODY")):0,1:1)
D INIT^XMXADDR
S (XMTO,XMIA)=0
F S XMTO=$O(^XMB(3.7,XMTO)) Q:'XMTO D
. Q:$P($G(^VA(200,XMTO,0)),U,3)=""!($P($G(^(.1)),U,2)="")!($P($G(^(201)),U)="") ; Quit if no access code, or verify code, or primary menu
. Q:$D(^XUSEC("XM NO BROADCASTS",XMTO)) ; Quit if user doesn't want broadcast messages
. S XMACNT=XMACNT+1
. S XMREC=$G(^XMB(3.7,XMTO,0)) Q:XMREC=""
. I $P(XMREC,U,2)=""!XMNOFWD D DELIVER^XMTDL2(XMTO,XMZ,XMZSUBJ,XMZFROM,XMFROM,0,$G(XMK(XMTO)),$G(XMDEL(XMTO),XMZPDATE),XMZBSKT) Q
. N XMERROR,XMFULL,XMFWDADD
. S XMFWDADD=XMTO
. D REMOTE^XMXADDR3(.5,$P(XMREC,U,2),0,"","",.XMFULL)
. I $D(XMERROR) D DELFWD^XMVVITA(XMTO,$P(XMREC,U,2),XMERROR)
. I '$D(XMERROR),$D(^TMP("XMY",$J,XMFULL)) S ^TMP("XMY",$J,XMFULL,"F")=XMTO
. I $P(XMREC,U,8)!$D(XMERROR)!'$D(^TMP("XMY",$J,$G(XMFULL,"?"))) D DELIVER^XMTDL2(XMTO,XMZ,XMZSUBJ,XMZFROM,XMFROM,0,$G(XMK(XMTO)),$G(XMDEL(XMTO),XMZPDATE),XMZBSKT)
S XMTO=0
F S XMTO=$O(^TMP("XMY",$J,XMTO)) Q:+XMTO'=XMTO K ^(XMTO) ; Don't forward to locals
I $$GOTADDR^XMXADDR D
. N XMINSTR
. S XMINSTR("FWD BY")=""
. D FWD^XMKP(.5,XMZ,.XMINSTR)
D CLEANUP^XMXADDR
Q
STATS(XMGROUP,XMQUEUE,XMMCNT,XMRCNT,XMACNT) ;
; The following global is incremented in STATS^XMKPLQ
; # messages in queue^# recipients anticipated
N XMSTATS
L +^XMBPOST("QSTATS",XMGROUP,XMQUEUE)
S XMSTATS=^XMBPOST(XMGROUP,XMQUEUE),^(XMQUEUE)=($P(XMSTATS,U)-XMMCNT)_U_($P(XMSTATS,U,2)-XMRCNT)
L -^XMBPOST("QSTATS",XMGROUP,XMQUEUE)
; The following global is incremented here only.
; # recipients delivered
L +^XMBPOST("GSTATS",XMGROUP)
S ^(XMGROUP)=$G(^XMBPOST("STATS",XMGROUP))+$G(XMACNT)
L -^XMBPOST("GSTATS",XMGROUP)
Q