[prev in list] [next in list] [prev in thread] [next in thread] 

List:       exmh-users
Subject:    Re: procmail vs. slocal question
From:       Diego Zamboni <zamboni () cerias ! purdue ! edu>
Date:       2001-04-03 2:06:43
[Download RAW message or body]

On Mon, Apr 02, 2001 at 09:31:22PM -0400, Leigh Orf wrote:
> BTW, your mailstore script wasn't attached to your message.

Agh, happens all the time. Not enough caffeine in my brain.

Should be there now, thanks for letting me know.

--Diego



#!/usr/local/bin/ksh
#
# Call rcvstore, not adding to the unseen sequence if the mail
# is from me.
# If the -alwaysflag arg is given, messages are added to the
# unseen sequence no matter what
# If the -noflag arg is given, messages are never added to the
# unseen sequence.

# My address
ME='(zamboni@cerias\.purdue\.edu|zamboni@palm\.net)'

# Temporary file
TMP=$HOME/systmp/mailstore.$$
# Flag to rcvstore to prevent adding to unseen sequence
NOUNSEEN="-nounseen"

RM=/bin/rm
CAT=/bin/cat
GREP=/usr/local/bin/egrep
SED=/usr/bin/sed
RCVSTORE="/usr/local/nmh/lib/rcvstore -nocreate"

# Check argument
if [[ "$1" == "-alwaysflag" ]]
then
    NOUNSEEN=""
    shift
fi
if [[ "$1" == "-noflag" ]]
then
    NOUNSEEN=""
    RCVSTORE="$RCVSTORE -nounseen"
    shift
fi
    
FLAG=""

# Store incoming message in tmp file
$RM -f $TMP
$CAT > $TMP
# Add -nounseen if it's from me
if $SED -n '1,/^$/p' $TMP | $GREP "^From:.*$ME" > /dev/null
then
  FLAG=$NOUNSEEN
fi
# Pass it to rcvstore
$CAT $TMP | $RCVSTORE $FLAG $*
# Record the exit status from rcvstore to return the correct value
STATUS=$?
$RM -f $TMP
exit $STATUS


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic