[comp.mail.elm] Status question

ajk@mace.cc.purdue.edu (Jeff Boerio) (03/05/90)

When using Elm, and if a message is in /usr/spool/mail, Elm will print the
little Status symbols for each message.  However, if I use "elm -f <folder>,
Elm will not extract the Status field and display it.

Can someone tell me why?  I use filter to send 98% of my mail to folders,
leaving very little in /usr/spool/mail.  It would be helpful to KNOW which
messages haven't been read (by looking at the status symbol), instead of
guessing which ones haven't been read.

Or, is there some method for knowing that I don't know about?

Thanks in advance for your help.

      - Jeff

-- 
Jeff Boerio                     : Purdue University Dept. of Computer Science
ajk@mace.cc.purdue.edu          : Purdue University Computing Center Volunteer
boerio@orchestra.ecn.purdue.edu : Purdue University ECN Student Programmer

syd@DSI.COM (Syd Weinstein) (03/06/90)

ajk@mace.cc.purdue.edu (Jeff Boerio) writes:


>When using Elm, and if a message is in /usr/spool/mail, Elm will print the
>little Status symbols for each message.  However, if I use "elm -f <folder>,
>Elm will not extract the Status field and display it.

>Can someone tell me why?  I use filter to send 98% of my mail to folders,
>leaving very little in /usr/spool/mail.  It would be helpful to KNOW which
>messages haven't been read (by looking at the status symbol), instead of
>guessing which ones haven't been read.
Elm doesn't know the difference between spooled mail and mail folders
as far as displaying the status symbols is concerned.

I think what you are seeing is that you have already read all
the mail in the folder.  The symbol for read mail is ' ', for
old unread mail is 'O' and for new unread mail is 'N'.

Note that once a message is read, irregardless of where it is
read, the symbol becomes ' '.
-- 
=====================================================================
Sydney S. Weinstein, CDP, CCP                   Elm Coordinator
Datacomp Systems, Inc.				Voice: (215) 947-9900
syd@DSI.COM or {bpa,vu-vlsi}!dsinc!syd	        FAX:   (215) 938-0235

ajk@mace.cc.purdue.edu (Jeff Boerio) (03/06/90)

In article <1990Mar5.171928.12129@DSI.COM> syd@DSI.COM (Syd Weinstein) writes:


>Elm doesn't know the difference between spooled mail and mail folders
>as far as displaying the status symbols is concerned.

>I think what you are seeing is that you have already read all
>the mail in the folder.  The symbol for read mail is ' ', for
>old unread mail is 'O' and for new unread mail is 'N'.

>Note that once a message is read, irregardless of where it is
>read, the symbol becomes ' '.

Hmmmm .... OK, then how come I never see an 'N' whenever filter puts a
message in a folder?  Don't mean to argue, I'm just wondering why I don't
see the difference between new and spooled mail.  If I use the SAVECOPY
command in filter, the one in /usr/spool/mail will prepend it with a N when
I try to use it, while the one that's placed in a folder prepends with
nothiing (or the SPACE, as you said).

Thanks again for the information.

     - Jeff
-- 
Jeff Boerio                     : Purdue University Dept. of Computer Science
ajk@mace.cc.purdue.edu          : Purdue University Computing Center Volunteer
boerio@orchestra.ecn.purdue.edu : Purdue University ECN Student Programmer

darrell@urbana.mcd.mot.com (Darrell McIntosh) (03/09/90)

In article <1990Mar5.171928.12129@DSI.COM> syd@DSI.COM writes:
>ajk@mace.cc.purdue.edu (Jeff Boerio) writes:
>
>
>>When using Elm, and if a message is in /usr/spool/mail, Elm will print the
>>little Status symbols for each message.  However, if I use "elm -f <folder>,
>>Elm will not extract the Status field and display it.
>
>>Can someone tell me why?  I use filter to send 98% of my mail to folders,
>>leaving very little in /usr/spool/mail.  It would be helpful to KNOW which
>>messages haven't been read (by looking at the status symbol), instead of
>>guessing which ones haven't been read.
>Elm doesn't know the difference between spooled mail and mail folders
>as far as displaying the status symbols is concerned.

Actually elm does make a distinction between the user's system mailbox
(e.g., /usr/mail/darrell) and other mailboxes.  Here is some code from
src/newmbox.c:

	      /* set default status - always 'visible'  - and
	       * if a spool file, presume 'new', otherwise
	       * 'read', for the time being until overridden
	       * by a Status: header.
	       * We presume 'read' for nonspool mailfile messages
	       * to be compatible messages stored with older versions of elm,
	       * which didn't support a Status: header.
	       */
	      if(folder_type == SPOOL)
	       		current_header->status = VISIBLE | NEW | UNREAD;
	      else
	       		current_header->status = VISIBLE;

This code sets the initial status for mail being read from a file.  If
it's the spool file it will show as new ('N') unless a Status: header
exists which indicates differently.  Note that if you're reading your
spool file and save some mail to a file, the Status: gets saved along
with the rest of the mail.  filter (and deliver) don't add a Status:
header when storing mail. 

I use deliver to sort my incoming mail into many different files or my
spool file.  I've hacked this code to always use the initial status of
VISIBLE|NEW|UNREAD for any file.  This allows me to be able to identify
any mail that arrived since I last read the file.

If there is enough interest I'll submit my changes to Syd as a patch.

-- 
Darrell McIntosh, Motorola Microcomputer Division, Urbana [IL] Design Center
Phone:  +1 217 384 8509
Email:  darrell@urbana.mcd.mot.com, udc!darrell, uunet!uiucuxc!udc!darrell

chip@tct.uucp (Chip Salzenberg) (03/13/90)

According to darrell@urbana.mcd.mot.com (Darrell McIntosh):
>I use deliver to sort my incoming mail into many different files or my
>spool file.  I've hacked [Elm to treat all mailboxes like system mailbox].
>This allows me to be able to identify any mail that arrived
>since I last read the file.

There's no need to hack Elm for this purpose.  It just so happens
that, when Elm discovers a new message (status "N") and you don't read
it, it saves the message with status "O".  Furthermore, that status is
saved in the message header, with a line like this:

	Status: O

However, there's no reason why some other program can't insert that
line in Elm's behalf.  So (here it comes), if you use Deliver, you can
do it with your user delivery file:

	# We assume here that $box is a mailbox to receive the message

	( header -nv -f status $HEADER | grep -v '^$'
	  echo "Status: O"
	  echo ""
	  cat $BODY ) | deliver -b $box

Presto!  All newly arrived messages are neatly labeled "O" on the Elm menu.
-- 
Chip Salzenberg at ComDev/TCT   <chip%tct@ateng.com>, <uunet!ateng!tct!chip>
          "The Usenet, in a very real sense, does not exist."