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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXMTDL1 2054 printed Oct 16, 2024@18:14:02 Page 2
XMTDL1 ;ISC-SF/GMB-Deliver local mail to mailbox (cont.) ;04/15/2003 12:53
+1 ;;8.0;MailMan;**18**;Jun 28, 2002
BRODCAST(XMZ,XMZSUBJ,XMZFROM,XMFROM,XMK,XMDEL,XMZPDATE,XMZBSKT,XMACNT) ;
+1 NEW XMTO,XMREC,XMIA,XMNOFWD
+2 ; Don't forward message if this is FORUM and it was sent to G.EVERYBODY.
+3 SET XMNOFWD=$SELECT('$$FORUM^XMXADDRD:0,'$DATA(^XMB(3.9,XMZ,6,"B","G.EVERYBODY")):0,1:1)
+4 DO INIT^XMXADDR
+5 SET (XMTO,XMIA)=0
+6 FOR
SET XMTO=$ORDER(^XMB(3.7,XMTO))
if 'XMTO
QUIT
Begin DoDot:1
+7 ; Quit if no access code, or verify code, or primary menu
if $PIECE($GET(^VA(200,XMTO,0)),U,3)=""!($PIECE($GET(^(.1)),U,2)="")!($PIECE($GET(^(201)),U)="")
QUIT
+8 ; Quit if user doesn't want broadcast messages
if $DATA(^XUSEC("XM NO BROADCASTS",XMTO))
QUIT
+9 SET XMACNT=XMACNT+1
+10 SET XMREC=$GET(^XMB(3.7,XMTO,0))
if XMREC=""
QUIT
+11 IF $PIECE(XMREC,U,2)=""!XMNOFWD
DO DELIVER^XMTDL2(XMTO,XMZ,XMZSUBJ,XMZFROM,XMFROM,0,$GET(XMK(XMTO)),$GET(XMDEL(XMTO),XMZPDATE),XMZBSKT)
QUIT
+12 NEW XMERROR,XMFULL,XMFWDADD
+13 SET XMFWDADD=XMTO
+14 DO REMOTE^XMXADDR3(.5,$PIECE(XMREC,U,2),0,"","",.XMFULL)
+15 IF $DATA(XMERROR)
DO DELFWD^XMVVITA(XMTO,$PIECE(XMREC,U,2),XMERROR)
+16 IF '$DATA(XMERROR)
IF $DATA(^TMP("XMY",$JOB,XMFULL))
SET ^TMP("XMY",$JOB,XMFULL,"F")=XMTO
+17 IF $PIECE(XMREC,U,8)!$DATA(XMERROR)!'$DATA(^TMP("XMY",$JOB,$GET(XMFULL,"?")))
DO DELIVER^XMTDL2(XMTO,XMZ,XMZSUBJ,XMZFROM,XMFROM,0,$GET(XMK(XMTO)),$GET(XMDEL(XMTO),XMZPDATE),XMZBSKT)
End DoDot:1
+18 SET XMTO=0
+19 ; Don't forward to locals
FOR
SET XMTO=$ORDER(^TMP("XMY",$JOB,XMTO))
if +XMTO'=XMTO
QUIT
KILL ^(XMTO)
+20 IF $$GOTADDR^XMXADDR
Begin DoDot:1
+21 NEW XMINSTR
+22 SET XMINSTR("FWD BY")=""
+23 DO FWD^XMKP(.5,XMZ,.XMINSTR)
End DoDot:1
+24 DO CLEANUP^XMXADDR
+25 QUIT
STATS(XMGROUP,XMQUEUE,XMMCNT,XMRCNT,XMACNT) ;
+1 ; The following global is incremented in STATS^XMKPLQ
+2 ; # messages in queue^# recipients anticipated
+3 NEW XMSTATS
+4 LOCK +^XMBPOST("QSTATS",XMGROUP,XMQUEUE)
+5 SET XMSTATS=^XMBPOST(XMGROUP,XMQUEUE)
SET ^(XMQUEUE)=($PIECE(XMSTATS,U)-XMMCNT)_U_($PIECE(XMSTATS,U,2)-XMRCNT)
+6 LOCK -^XMBPOST("QSTATS",XMGROUP,XMQUEUE)
+7 ; The following global is incremented here only.
+8 ; # recipients delivered
+9 LOCK +^XMBPOST("GSTATS",XMGROUP)
+10 SET ^(XMGROUP)=$GET(^XMBPOST("STATS",XMGROUP))+$GET(XMACNT)
+11 LOCK -^XMBPOST("GSTATS",XMGROUP)
+12 QUIT