CWMAIL	;INDPLS/PLS- DELPHI VISTA MAIL SERVER ;16-Sep-1999 07:47;PS
	;;2.1;CWMA GuiMail;;Jan 06, 1999
	Q   ;ROUTINE CAN'T BE CALLED DIRECTLY
ENTRY(CWDATA,CWINPUT,CWTEXT)	;CALL WITH CWINPUT=CALL;DUZ;MSG;BASKET;NEW BASKET;NEWMAIL, TEXT=TEXT ARRAY
	N CWCALL,X,DUZ,CWMHDR,CWMST,U,CWSVER
	;REMOVED XMDUZ FROM BEING NEW STATEMENT
	I $$NEWERR^%ZTER N $ET S $ET=""
	S U="^"
	S $ZT="ERR^CWMAIL"
	K CWDATA
	S CWDATA(1)="0^^AN ERROR HAS OCCURRED"
	S CWCALL="%"_$$UP^XLFSTR($P(CWINPUT,";"))   ;HOLDS TAG
	S DUZ=$P(CWINPUT,";",2)
	D DUZ^XUP(DUZ)   ;SETUP DUZ ARRAY
	D INIT^XMVVITAE  ;UPDATE MAILMAN STATUS
	S CWINPUT=$P(CWINPUT,";",3,999)
	D PURGNAM
	I CWCALL?1"%"1.7A,$T(@CWCALL)'="" D @(CWCALL_"(.CWDATA,CWINPUT,.CWTEXT)")
	Q
ERR	D @^%ZOSF("ERRTN")
	D RETGNAM
	Q   ;
%READ(CWDATA,CWINPUT,CWTEXT)	;
	D %READ^CWMAILA(.CWDATA,CWINPUT)
	Q
%LIST(CWDATA,CWINPUT,CWTEXT)	;
	;CWINPUT = MAIL TYPE OR MAILBOX NUMBER;
	D %LIST^CWMAILA(.CWDATA,CWINPUT),RETGNAM
	Q
%DELETE(CWDATA,CWINPUT,CWTEXT)	;
	D %DELETE^CWMAILA(.CWDATA,CWINPUT),RETGNAM
	Q
%SAVE(CWDATA,CWINPUT,CWTEXT)	;
	D %SAVE^CWMAILA(.CWDATA,CWINPUT),RETGNAM
	Q
%MAKNEW(CWDATA,CWINPUT,CWTEXT)	;
	D %MAKNEW^CWMAILA(.CWDATA,CWINPUT),RETGNAM
	Q
%NEWBSK(CWDATA,CWINPUT,CWTEXT)	;CREATE A NEW MAIL BASKET
	D %NEWBSK^CWMAILA(.CWDATA,CWINPUT),RETGNAM
	Q
%RESEQ(CWDATA,CWINPUT,CWTEXT)	;RESEQUENCE A VISTA MAIL BASKET
	D %RESEQ^CWMAILA(.CWDATA,CWINPUT),RETGNAM
	Q
%REPLY(CWDATA,CWINPUT,CWTEXT)	;
	D %REPLY^CWMAILB(.CWDATA,CWINPUT,.CWTEXT),RETGNAM
	Q
%FORWARD(CWDATA,CWINPUT,CWTEXT)	;
	;M ^TMP("CWMAIL","FORWARD",$H)=CWTEXT
	;S ^TMP("CWMAIL","CWINPUT",$J)=CWINPUT
	D %FORWARD^CWMAILB(.CWDATA,CWINPUT,.CWTEXT),RETGNAM
	Q
%ANSWER(CWDATA,CWINPUT,CWTEXT)	;
	D %ANSWER^CWMAILB(.CWDATA,CWINPUT,.CWTEXT),RETGNAM
	Q
%TERMIN(CWDATA,CWINPUT,CWTEXT)	;TERMINATE A MESSAGE THREAD
	D %TERMIN^CWMAILB(.CWDATA,CWINPUT),RETGNAM
	Q
%CREATE(CWDATA,CWINPUT,CWTEXT)	;CREATE A NEW MESSAGE
	D %CREATE^CWMAIL2(.CWDATA,CWINPUT,.CWTEXT),RETGNAM
	Q
%LATER(CWDATA,CWINPUT,CWTEXT)	;LATER A MESSAGE
	D %LATER^CWMAILC(.CWDATA,CWINPUT),RETGNAM
	Q
	;
%MBOX(CWDATA,CWINPUT,CWTEXT)	;RETRIEVE MAILBOXES
	D %MBOX^CWMAILC(.CWDATA,CWINPUT),RETGNAM
	Q
%PMBOX(CWDATA,CWINPUT,CWTEXT)	;PURGE ENTIRE MAIL BOX
	D %PMBOX^CWMAILC(.CWDATA,CWINPUT),RETGNAM
	Q
%RNMBOX(CWDATA,CWINPUT,CWTEXT)	;RENAME EXISTING MAILBOX
	D %RNMBOX^CWMAILC(.CWDATA,CWINPUT),RETGNAM
	Q
%MSGRCP(CWDATA,CWINPUT,CWTEXT)	; RETURNS A LIST OF MESSAGE RECIPIENTS
	D %MSGRCP^CWMAILC(.CWDATA,CWINPUT)    ;,RETGNAM
	Q
%NETINFO(CWDATA,CWINPUT,CWTEXT)	; RETURNS NETWORK TRANSMISSION INFO
	D %NETINFO^CWMAILC(.CWDATA,CWINPUT)    ;,RETGNAM
	Q
%ADRSTO(CWDATA,CWINPUT,CWTEXT)	;RETURNS ARRAY OF ADDRESSED TO
	D %ADRSTO^CWMAILC(.CWDATA,CWINPUT)   ;,RETGNAM
	Q
%GRPINF(CWDATA,CWINPUT,CWTEXT)	;MAIL GROUP INFO
	D %GRPINF^CWMAILC(.CWDATA,CWINPUT),RETGNAM
	Q
%USRINF(CWDATA,CWINPUT,CWTEXT)	; MAIL USER INFO
	;CWINPUT = MAIL USER IEN
	D %USRINF^CWMAILC(.CWDATA,CWINPUT),RETGNAM
	Q
%PERPREF(CWDATA,CWINPUT,CWTEXT)	;RETRIEVE PERSONAL PREFERENCES
	;CWINPUT = MAIL USER IEN;SAVE NAME
	D %PERPREF^CWMAILD(.CWDATA,CWINPUT),RETGNAM
	Q
%USRLOG(CWDATA,CWINPUT,CWTEXT)	;LOG USER INTO GUI MAIL LOG
	;CWINPUT = DUZ
	D %USRLOG^CWMAILD(.CWDATA,DUZ),RETGNAM
	Q
%BMSGD(CWDATA,CWINPUT,CWTEXT)	;BUILD MSG INFO INTO GLOBAL
	;
	D %BMSGD^CWMAILD(.CWDATA,CWINPUT,.CWTEXT),RETGNAM
	Q
%SUPREF(CWDATA,CWINPUT,CWTEXT)	;SET USER PREFERENCES
	;
	D %SUPREF^CWMAILD(.CWDATA,CWINPUT,.CWTEXT),RETGNAM
	Q
RETGNAM	;RETURNS A $NAME FOR GLOBAL AFTER MERGING
	M ^TMP($J,"CWMAIL")=CWDATA
	K CWDATA S CWDATA=$NA(^TMP($J,"CWMAIL"))
	Q
PURGNAM	;PURGE GLOBAL ARRAY USED FOR DATA RETURN
	K ^TMP($J,"CWMAIL")
	Q
%CHKMAIL(CWDATA,CWINPUT,CWTEXT)	;CHECK FOR NEW MAIL
	;CWINPUT = DUZ
	D %CHKMAIL^CWMAILD(.CWDATA,DUZ),RETGNAM
	Q
%PRINT(CWDATA,CWINPUT,CWTEXT)	;PRINT A MESSAGE
	;
	D %PRTMSG^CWMAILD(.CWDATA,CWINPUT),RETGNAM
	Q
%GETSVER(CWDATA,CWINPUT,CWTEXT)	;GET SERVER VERSION
	;
	D %GETSVER^CWMAILD(.CWDATA,CWINPUT),RETGNAM
	Q
%MSGSRC(CWDATA,CWINPUT,CWTEXT)	;SEARCH AND RETURN SELECTED MESSAGES
	;
	D %MSGSRC^CWMAILA(.CWDATA,CWINPUT,.CWTEXT),RETGNAM
	Q
%MSGISRC(CWDATA,CWINPUT,CWTEXT)	;SEARCH FOR A SPECIFIC MESSAGE NUMBER
	;
	D %MSGISRC^CWMAILF(.CWDATA,CWINPUT),RETGNAM
	Q
	;
