| 1 | XMA21 ;ISC-SF/GMB-Address lookup APIs ;07/17/2003  13:03
 | 
|---|
| 2 |  ;;8.0;MailMan;**20**;Jun 28, 2002
 | 
|---|
| 3 |  ; Was (WASH ISC)/CAP
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 |  ; Entry points (DBIA 10067):
 | 
|---|
| 6 |  ; CHK   Check to see if a user is a member of a mail group.
 | 
|---|
| 7 |  ; DES   Interactive addressing.  Set next default recipient.
 | 
|---|
| 8 |  ; DEST  Interactive addressing.  Set first default recipient.
 | 
|---|
| 9 |  ; INST  Non-interactive addressing. (Same as WHO)
 | 
|---|
| 10 |  ; WHO   Non-interactive addressing.
 | 
|---|
| 11 |  ;
 | 
|---|
| 12 |  ; Entry points used by MailMan options (not covered by DBIA):
 | 
|---|
| 13 |  ; DX    XMDXNAME - Test name resolution (interactive)
 | 
|---|
| 14 |  ;
 | 
|---|
| 15 | CHK ; Check to see if a user is a member of a mail group.
 | 
|---|
| 16 |  ; Sets $T if member.
 | 
|---|
| 17 |  ; Needs:
 | 
|---|
| 18 |  ; XMDUZ  DUZ of the user
 | 
|---|
| 19 |  ; Y      IEN of the mail group
 | 
|---|
| 20 |  I $D(^XMB(3.8,Y,1,"B",XMDUZ)) Q
 | 
|---|
| 21 |  Q
 | 
|---|
| 22 | DX ;
 | 
|---|
| 23 |  N XMINSTR,XMV,XMABORT
 | 
|---|
| 24 |  D INITAPI^XMVVITAE
 | 
|---|
| 25 |  S XMABORT=0
 | 
|---|
| 26 |  D INIT^XMXADDR
 | 
|---|
| 27 |  D TOWHOM^XMJMT(XMDUZ,$$EZBLD^DIALOG(34110),.XMINSTR,"",XMABORT) ;Send
 | 
|---|
| 28 |  D CLEANUP^XMXADDR
 | 
|---|
| 29 |  Q
 | 
|---|
| 30 | DES ; Interactive addressing.  Set next default recipient.
 | 
|---|
| 31 |  ; XMY is not killed upon entry.
 | 
|---|
| 32 |  ; Needs:
 | 
|---|
| 33 |  ; XMMG    Next default recipient
 | 
|---|
| 34 |  ; See entry point TO for other needs and outputs associated with
 | 
|---|
| 35 |  ; this entry point.
 | 
|---|
| 36 |  D TO(.XMMG)
 | 
|---|
| 37 |  Q
 | 
|---|
| 38 | DEST ; Interactive addressing.  Set first default recipient.
 | 
|---|
| 39 |  ; XMY is killed upon entry.
 | 
|---|
| 40 |  ; Needs:
 | 
|---|
| 41 |  ; XMDUN   First default recipient
 | 
|---|
| 42 |  ; See entry point TO for other needs and outputs associated with
 | 
|---|
| 43 |  ; this entry point.
 | 
|---|
| 44 |  K XMY
 | 
|---|
| 45 |  D TO(XMDUN)
 | 
|---|
| 46 |  Q
 | 
|---|
| 47 | TO(XMTO) ;
 | 
|---|
| 48 |  ; Entry points DES and DEST also Need:
 | 
|---|
| 49 |  ; XMDUZ   DUZ of user
 | 
|---|
| 50 |  ; XMDF    if $D(XMDF) then do not restrict addressees
 | 
|---|
| 51 |  ; Output:
 | 
|---|
| 52 |  ; XMY(    Array of addressees:  XMY(addressee)=""
 | 
|---|
| 53 |  ; XMOUT   if $D(XMOUT) user aborted addressing
 | 
|---|
| 54 |  ; X       if X="^" user aborted addressing, else X=""
 | 
|---|
| 55 |  N XMV,XMINSTR,XMABORT,XMDUN
 | 
|---|
| 56 |  S XMABORT=0
 | 
|---|
| 57 |  I XMDUZ'>0 N XMDUZ S XMDUZ=DUZ
 | 
|---|
| 58 |  D INITAPI^XMVVITAE
 | 
|---|
| 59 |  I $D(XMDF) S XMINSTR("ADDR FLAGS")="R" ; No addressee restrictions
 | 
|---|
| 60 |  I $D(XMTO) S XMINSTR("TO PROMPT")=XMTO
 | 
|---|
| 61 |  D INIT^XMXADDR
 | 
|---|
| 62 |  D TOWHOM^XMJMT(XMDUZ,$$EZBLD^DIALOG(34110),.XMINSTR,"",.XMABORT) ;Send
 | 
|---|
| 63 |  I XMABORT D  Q
 | 
|---|
| 64 |  . S XMOUT=1,X=U
 | 
|---|
| 65 |  . D CLEANUP^XMXADDR
 | 
|---|
| 66 |  K XMOUT
 | 
|---|
| 67 |  S X=""
 | 
|---|
| 68 |  D SW
 | 
|---|
| 69 |  I $D(XMINSTR("SELF BSKT")) S XMY(XMDUZ,0)=XMINSTR("SELF BSKT")
 | 
|---|
| 70 |  I $D(XMINSTR("SHARE BSKT")) S XMY(.6,0)=XMINSTR("SHARE BSKT")
 | 
|---|
| 71 |  I $D(XMINSTR("SHARE DATE")) S XMY(.6,"D")=XMINSTR("SHARE DATE")
 | 
|---|
| 72 |  D CLEANUP^XMXADDR
 | 
|---|
| 73 |  Q
 | 
|---|
| 74 | SW ;
 | 
|---|
| 75 |  N %X,%Y
 | 
|---|
| 76 |  S %X="^TMP(""XMY"","_$J_",",%Y="XMY(" D %XY^%RCR
 | 
|---|
| 77 |  Q
 | 
|---|
| 78 | INST ; Non-interactive addressing (Just fall thru to WHO)
 | 
|---|
| 79 | WHO ; Non-interactive addressing
 | 
|---|
| 80 |  ; Needs:
 | 
|---|
| 81 |  ; XMDUZ user's DUZ
 | 
|---|
| 82 |  ; X     local or remote address
 | 
|---|
| 83 |  ;       (-X will remove address)
 | 
|---|
| 84 |  ; XMDF  if $D(XMDF) then do not restrict addressees
 | 
|---|
| 85 |  ; XMLOC if $D(XMLOC), forces output of XMMG error message if error
 | 
|---|
| 86 |  ; Output:
 | 
|---|
| 87 |  ; XMY   address: XMY(address)=""
 | 
|---|
| 88 |  ; Y     if Y=-1, then lookup has failed
 | 
|---|
| 89 |  ;       = <DUZ^full name> if local addressee
 | 
|---|
| 90 |  ;       = <domain ien^domain name> if remote addressee
 | 
|---|
| 91 |  ; XMMG  contains error message if Y=-1
 | 
|---|
| 92 |  ;       = "" if local addressee
 | 
|---|
| 93 |  ;       = via domain message if remote addressee
 | 
|---|
| 94 |  N XMV,XMINSTR,XMSTRIKE
 | 
|---|
| 95 |  I XMDUZ'>0 N XMDUZ S XMDUZ=DUZ
 | 
|---|
| 96 |  D INITAPI^XMVVITAE
 | 
|---|
| 97 |  I $D(XMDF) S XMINSTR("ADDR FLAGS")="R" ; No addressee restrictions
 | 
|---|
| 98 |  D INIT^XMXADDR
 | 
|---|
| 99 |  I $E(X)="-" S XMSTRIKE=1,X=$E(X,2,99)
 | 
|---|
| 100 |  K XMERR,^TMP("XMERR",$J)
 | 
|---|
| 101 |  D CHKADDR^XMXADDR(XMDUZ,X,.XMINSTR,"",.Y)
 | 
|---|
| 102 |  I $D(XMERR) D  Q
 | 
|---|
| 103 |  . S XMMG=^TMP("XMERR",$J,1,"TEXT",1)
 | 
|---|
| 104 |  . K XMERR,^TMP("XMERR",$J)
 | 
|---|
| 105 |  . S Y=-1
 | 
|---|
| 106 |  . I $D(XMLOC) W "  ",XMMG
 | 
|---|
| 107 |  . D CLEANUP^XMXADDR
 | 
|---|
| 108 |  I $G(XMSTRIKE) D  Q
 | 
|---|
| 109 |  . N XMADDR
 | 
|---|
| 110 |  . S X=Y
 | 
|---|
| 111 |  . S XMADDR=""
 | 
|---|
| 112 |  . F  S XMADDR=$O(^TMP("XMY",$J,XMADDR)) Q:XMADDR=""  K XMY(XMADDR)
 | 
|---|
| 113 |  . S XMMG=""
 | 
|---|
| 114 |  . D CLEANUP^XMXADDR
 | 
|---|
| 115 |  I Y["@" D  Q
 | 
|---|
| 116 |  . N XMIEN
 | 
|---|
| 117 |  . S XMIEN=^TMP("XMY",$J,Y)  ; IEN
 | 
|---|
| 118 |  . S XMY(Y)=XMIEN
 | 
|---|
| 119 |  . S X=$P(Y,"@",2)
 | 
|---|
| 120 |  . S Y=XMIEN_U_$P(^DIC(4.2,XMIEN,0),U,1)
 | 
|---|
| 121 |  . S XMMG=$$EZBLD^DIALOG(39101,$P(Y,U,2)) ; via |1|
 | 
|---|
| 122 |  . D CLEANUP^XMXADDR
 | 
|---|
| 123 |  D SW
 | 
|---|
| 124 |  I $E(X,1,2)="G." D
 | 
|---|
| 125 |  . S X=$E(Y,3,99)
 | 
|---|
| 126 |  . S Y=$O(^XMB(3.8,"B",X,0))_U_X  ; ien^mail group name
 | 
|---|
| 127 |  E  I $L(X>2),".D.H.S."[("."_$E(X,1,2)) D
 | 
|---|
| 128 |  . S X=$E(Y,3,99)
 | 
|---|
| 129 |  . S Y=XMY(Y)_U_X  ; ien^full name
 | 
|---|
| 130 |  E  D
 | 
|---|
| 131 |  . S X=Y ; full name
 | 
|---|
| 132 |  . S Y=$O(XMY(""))_U_Y  ; duz^full name
 | 
|---|
| 133 |  S XMMG=""
 | 
|---|
| 134 |  D CLEANUP^XMXADDR
 | 
|---|
| 135 |  Q
 | 
|---|