From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 18-MAY-1989 08:51
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Re: New Mail Count fix (NOT read/new)

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Wed, 17 MAY 89 15:53:11 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Wed, 17 May 89 15:34:20 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.36)
	id AA27706; Wed, 17 May 89 15:22:03 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 17 May 89 07:59:17 GMT
From: munnari!murtoa.cs.mu.oz.au!murdu!ucsvc!jonathan@uunet.uu.net  (Jonathan Ridler)
Organization: The University of Melbourne
Subject: Re: New Mail Count fix (NOT read/new)
Message-Id: <42@ucsvc.unimelb.edu.au>
References: <43@vaxa.uwa.oz>, <89@decus.com.au>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

In article <89@decus.com.au>, wadem@decus.com.au (Malcolm Wade) writes:
> Another interesting way to zero the new mail count for someone who can't issue
> READ/NEW is to zap their entry in VMSMAIL_PROFILE.DATA (under V5 of course).
   [ Details of how to zap a user's MAIL profile entry omitted ]
> This deletes the user's mail profile entry from the central file.
> 
> Malcolm

The desired effect can be acheived without deleting the user's profile entry,
by simply changing the actual NEWMAIL count - try the following DCL procedure.
(Users of this procedure must have write access to the V5.n MAIL_PROFILE file).

$! Command procedure to examine and (optionally) update the NEWMAIL counter
$! for a VAX MAIL user.
$!
$! Author:  Jonathan Ridler.
$!
$! Use as follows:
$!  $ cm :== @disk:[directory]this_file.com
$!  $ cm [ Username [ Update_Count ]]
$!
$! If no username is specified, the current user's username is used.
$! Without an Update_Count the current NEWMAIL count is displayed.
$! With an Update_Count the current NEWMAIL count may _optionally_ be changed.
$! (To update the current user's NEWMAIL count, specify the username explicitly)
$
$ if .not. f$privilege("SYSPRV")  then  exit (10548)	! SS$_NOSECURITY.
$ if p1 .eqs. ""  then  p1 = f$getjpi ("","USERNAME")
$ p1 = f$edit (p1,"COLLAPSE")
$ if p2 .nes. ""  then  p2 = f$edit (p2,"COLLAPSE")
$
$ on error  then  goto  END
$ open /share=write /read  /write  Mailfile  VMSMAIL_PROFILE	! Use logical.
$ read /index=0 /key="''p1'" /error=NO_REC  Mailfile  User_Rec
$ new_cnt = f$cvui (35*8,16,User_Rec)		! Determine NEWMAIL count.
$ if new_cnt .eq. 0
$ then
$   ws "''p1' has no new MAIL messages."
$ else
$   ws f$fao ("!AS has !SL new MAIL message!%S.",p1,new_cnt)
$ endif
$
$ if p2 .nes. ""
$ then
$   if f$type (p2) .eqs. "INTEGER"
$   then
$     p2i = f$integer (p2)
$     if (p2i .lt. 0) .or. (p2i .gt. 32000)
$     then
$       ws "Invalid integer replacement NEW MAIL count."
$     else
$       inquire /nopunct ans -
	   "Change NEW MAIL count for ''p1' from ''new_cnt' to ''p2'? [No]: "
$	ans = f$edit (ans,"COLLAPSE")
$	if ans .eqs. ""  then  ans = "NO"
$       if ans
$       then
$         User_Rec[35*8,16] = p2i		! Update field.
$         write /update  Mailfile  User_Rec	! Replace record.
$	  ws "NEW MAIL count for ''p1' updated to ''p2'."
$	else
$	  ws "MAIL record for ''p1' NOT updated."
$       endif
$     endif
$   else
$     ws "Invalid replacement NEW MAIL count - must be integer."
$   endif
$ endif
$
$ goto  END
$
$NO_REC:
$ ws "No MAIL record for ''p1'."
$
$END:
$ close Mailfile
$ EXIT

Hope this is useful.
Jonathan.

--------------------------------------------------------------------------------
Sender:        Jonathan Ridler
Organization:  The University of Melbourne. (University Computing Services)
ACSnet,CSNET:  jonathan@ucsvc.unimelb.edu.au  (or jonathan@ucsvc.dn.mu.oz)
INTERNET:      jonathan%ucsvc.unimelb.edu.au@uunet.uu.net
PSI_MAIL:      PSI%0505233430003::jonathan
UUCP: {uunet,ubc-vision,nttlab,mcvax,ukc}!munnari!ucsvc.unimelb.edu.au!jonathan
--------------------------------------------------------------------------------

