| 1 | RGUTALR ;CAIRO/DKM - Send alert to user(s) via kernel or mail;04-Sep-1998 11:26;DKM
 | 
|---|
| 2 |  ;;2.1;RUN TIME LIBRARY;;Mar 22, 1999
 | 
|---|
| 3 |  ;=================================================================
 | 
|---|
| 4 |  ; Send an alert.
 | 
|---|
| 5 |  ;   XQAMSG = Message to send
 | 
|---|
| 6 |  ;   RGUSR  = A semicolon-delimited list of users to receive alert.
 | 
|---|
| 7 |  ;=================================================================
 | 
|---|
| 8 | ALERT(XQAMSG,RGUSR) ;
 | 
|---|
| 9 |  N XQA,XQAOPT,XQAFLG,XQAROU,XQADATA,XQAID
 | 
|---|
| 10 |  S @$$TRAP^RGZOSF("EXIT^RGUTALR"),RGUSR=$G(RGUSR,"*"),XQAMSG=$TR(XQAMSG,U,"~")
 | 
|---|
| 11 |  D ENTRY^RGUTUSR(RGUSR,.XQA),SETUP^XQALERT:$D(XQA)
 | 
|---|
| 12 | EXIT Q
 | 
|---|
| 13 |  ;=================================================================
 | 
|---|
| 14 |  ; Send a mail message
 | 
|---|
| 15 |  ;   RGMSG  = Message to send (single node or array)
 | 
|---|
| 16 |  ;   XMY    = A semicolon-delimited list (or array) of users
 | 
|---|
| 17 |  ;   XMSUB  = Subject line (optional)
 | 
|---|
| 18 |  ;   XMDUZ  = DUZ of sender (optional)
 | 
|---|
| 19 |  ;=================================================================
 | 
|---|
| 20 | MAIL(RGMSG,XMY,XMSUB,XMDUZ) ;
 | 
|---|
| 21 |  N XMTEXT
 | 
|---|
| 22 |  S:$D(RGMSG)=1 RGMSG(1)=RGMSG
 | 
|---|
| 23 |  S XMTEXT="RGMSG(",@$$TRAP^RGZOSF("EXIT^RGUTALR"),XMY=$G(XMY)
 | 
|---|
| 24 |  S:$G(XMSUB)="" XMSUB=RGMSG
 | 
|---|
| 25 |  S:$G(XMDUZ)="" XMDUZ=$G(DUZ)
 | 
|---|
| 26 |  F  Q:'$L(XMY)  S X=$P(XMY,";"),XMY=$P(XMY,";",2,999) S:$L(X) XMY(X)=""
 | 
|---|
| 27 |  D ^XMD:$D(XMY)>9
 | 
|---|
| 28 |  Q
 | 
|---|