Subject: mail notification agent

From: Michael Thomas Cope <[email-masked]>
Date: Thu, 30 Jul 1998 17:15:17 -0700 (PDT)

>From http://www.washington.edu/pine/QandA/problems.html#pseudo-message
>Another disadvantage of having these pseudo messages is that, when found
>in folders used to receive new messages, some mail notification tools
>may be confused and behave incorrectly. There are several solutions to
>this problem. For example, some sites have modified the notification 
>tools to ignore mailboxes whose length corresponds to the pseudo message.

We are having precisely this minor problem at our site, 
We use /bin/mail -E to check for mail/new mail in our users' default
.tcshrc
 
/bin/mail -E
switch ( $status )
        case 0:
                echo "You have new mail."
                breaksw;
        case 2:
                echo "You have mail."
                breaksw;
endsw

This reports mail even when the inbox is empty because of the pseudo
message.  
	Does anyone have a simple notification agent that will check for
mail presence with the psuedo message.  Otherwise I will code a simple one
in Perl.  /bin/mail -E was due for a change anyway because the -E switch
and the return code 2 are both undocumented (deprecated?).
-- 
Michael Cope: Harvey Mudd College '00; Armand Hammer UWC '96
E-mail: [email-masked]

-----------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/pine/pine-info/
-----------------------------------------------------------------

---

From: Michael Thomas Cope <[email-masked]>
Date: Thu, 30 Jul 1998 18:05:45 -0700 (PDT)

> and the return code 2 are both undocumented (deprecated?).
I went ahead and wrote a perl script to replace /bin/mail -e

#!/usr/local/bin/perl
#to replace /bin/mail -e and ignore Pine 4.0x pseudo message
#takes single argument of mbox path or uses $ENV{MAIL}
#returns 0 if there is mail, 2 if there is new mail, 1 otherwise
#Michael Cope <[email-masked]> 
#This script is released under the same license as Perl

$magicsize = 515;                        # Pine 4.0x psuedo message size 
$mail = defined $ARGV[0] ? $ARGV[0] : $ENV{MAIL};
if(-e $mail) {
    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
       $atime,$mtime,$ctime,$blksize,$blocks)
	= stat($mail);
    if ($atime < $mtime ) { exit 2 };    #new mail
    if ($size != $magicsize) { exit 0 }; #mail
}
exit 1;                                  # file does not exist or is empty

---

From: "Ed Greshko" <[email-masked]>
Date: Fri, 31 Jul 1998 10:39:06 +0800

Michael,

> $magicsize = 515;                        # Pine 4.0x psuedo message size

Since this message contains items like the Fully Qualified Domain Name of
the system the size will vary from system to system.  Mine is 520.  Beware.

Ed

---

From: Brad Giaccio <[email-masked]>
Date: Fri, 31 Jul 1998 07:07:59 -0400 (EDT)

in 4.02 you can supress the psuedo message so you won't need to check for
it

-- 
--- There are two kinds of knowledge, you either know the answer or
			you know where to find it
		      -Kane, Johnson, and anonymous

---

From: "Ed Greshko" <[email-masked]>
Date: Fri, 31 Jul 1998 19:25:13 +0800

Brad,

> in 4.02 you can supress the psuedo message so you won't need to check for

I don't worry about it....  Others do.  :-)

But thanks all the same.

Ed

---

From: Adem MECiT <[email-masked]>
Date: Fri, 31 Jul 1998 15:33:46 +0300 (MEST)

Hi
I am from Turkey. I am using ISO8859-9 character set. I have a problem
with postponing a message. After postpoining a message, When I want to
continue to the message I won't get the message properly. I get the
message at the queue-encoded mode. For this reason I couldn't use the
postponing feature of the pine. What can I do for this problem. Is it a
bug?

Thanks for your answers ...

Adem MECIT
Hacettepe University 
Computer Center

---

From: Michael Thomas Cope <[email-masked]>
Date: Fri, 31 Jul 1998 11:40:47 -0700 (PDT)

> exit 1;                                  # file does not exist or is empty
The first script has some bugs, the return values are the opposite of
/bin/mail -e and 0 length mboxes used by people using other mail agents
are flagged as having messages
#!/usr/local/bin/perl
#to replace /bin/mail -e and ignore Pine 4.0x pseudo message
#takes single argument of mbox path or uses $ENV{MAIL}
#returns 0 if there is new mail, 2 if there is mail, 1 otherwise
#MTC 7/30/98

$magicsize = 515; # Pine 4.0x psuedo message size for orion.ac.hmc.edu
# THIS WILL VARY FROM SYSTEM TO SYSTEM and may change with Pine versions

$mail = defined $ARGV[0] ? $ARGV[0] : $ENV{MAIL};
if(-e $mail) {
    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
       $atime,$mtime,$ctime,$blksize,$blocks)
	= stat($mail);
    if ($atime < $mtime ) { exit 0 };               #new mail
    if ($size && ($size != $magicsize)) { exit 2 }; #mail
}
exit 1;                                  # file does not exist or is empty