procmail
[Top] [All Lists]

First tests of: Simple recipe to move uninteresting threads in separate mailbox

2006-12-31 06:44:34
On Sat, Dec 30, 2006 17:46:47 PM -0800, Professional Software
Engineering (PSE-L(_at_)mail(_dot_)professional(_dot_)org) wrote:

So, the tweaked recipe looks like:


I have copied the recipe in a separate file and included it from
procmailrc changing just the cache file names.

The result of the very first run is below. The "extraneous locallock
file" warning is my fault, because I did not change the lock file name
according to the cache names I changed, right?

Apart from that, there is the fact that, when a message has both I-R-T
and References headers it gives a duplicate entry. This should be
solved, I think, piping the output of sed to uniq.

Comments?

procmail: Assigning "INCLUDERC=/home/marco/.procmail_irrelevant_threads"
procmail: Assigning "REFS="
procmail: Assigning "MATCH="
procmail: Matched " <45972349(_dot_)7040708(_at_)tacocat(_dot_)net>"
procmail: Match on "In-Reply-To:[         ]*\/.*"
procmail: Assigning "REFS= <45972349(_dot_)7040708(_at_)tacocat(_dot_)net>"
procmail: Assigning "MATCH="
procmail: Matched " <45972349(_dot_)7040708(_at_)tacocat(_dot_)net>"
procmail: Match on "^References:[         ]*\/.*"
procmail: Assigning "REFS= <45972349(_dot_)7040708(_at_)tacocat(_dot_)net>  
<45972349(_dot_)7040708(_at_)tacocat(_dot_)net>"
procmail: Executing "echo $REFS | tr -s "    " "\n\n" | sed -e 
'/^\([^<].*\|.*[^>]\|\)$/ d'"
procmail: Assigning "REFSNL=<45972349(_dot_)7040708(_at_)tacocat(_dot_)net>
<45972349(_dot_)7040708(_at_)tacocat(_dot_)net>"
procmail: Match on "."
procmail: Executing "grep,-qF,<45972349(_dot_)7040708(_at_)tacocat(_dot_)net>
<45972349(_dot_)7040708(_at_)tacocat(_dot_)net>,/home/marco/.procmail_ignore.cache"
grep: /home/marco/.procmail_ignore.cache: No such file or directory
procmail: Non-zero exitcode (2) from "grep"
procmail: Score:       0       0 "grep -qF 
<45972349(_dot_)7040708(_at_)tacocat(_dot_)net>
<45972349(_dot_)7040708(_at_)tacocat(_dot_)net> 
/home/marco/.procmail_ignore.cache"
procmail: Executing "grep,-qF,<45972349(_dot_)7040708(_at_)tacocat(_dot_)net>
<45972349(_dot_)7040708(_at_)tacocat(_dot_)net>,/home/marco/.procmail_ignore.mua.file"
procmail: Non-zero exitcode (1) from "grep"
procmail: Score:       0       0 "grep -qF 
<45972349(_dot_)7040708(_at_)tacocat(_dot_)net>
<45972349(_dot_)7040708(_at_)tacocat(_dot_)net> 
/home/marco/.procmail_ignore.mua.file"
procmail: Extraneous locallockfile ignored


#============================================================================
# 20061230 SBS

# file away ignored threads, based on messageid references.

# Process:
# get ids from In-Reply-To and References, clean them up, then check to
# see if any of them are in the ignore cache or in the mua_ignore cache.
# If you set your MUA to invoke formail to cache ignored threads using the
# same ignore.cache file, then you can eliminate the additional grep
# invocation necessary to check the MUA specific one.
# if we have a match in the MUA id file or current cache, then ADD the
# messageid of THIS message to the cache so that replies to this message
# will also be ignored.

# ensure it's blank, not set to something you might have used it for
# previously
REFS=

:0
* In-Reply-To:[         ]*\/.*
{
         # Assign the results to REFS
         REFS=${MATCH}
}

:0
* ^References:[         ]*\/.*
{
         # Append the results to REFS
         # no consideration as to whether REFS was null or not.
         REFS="${REFS} ${MATCH}"
}

# Scrub the references, placing each token on a separate line,
# eliminating blank lines and elements not matching the basic <bracketed>
# syntax of a messageid.
REFSNL=`echo $REFS | tr -s "    " "\n\n" | sed -e '/^\([^<].*\|.*[^>]\|\)$/ 
d'`

:0 : ignore.cache.lock
* $REFSNL ?? .
* 9876543210^0 ? grep -qF "$REFSNL" ignore.cache
* 9876543210^0 ? grep -qF "$REFSNL" ignore.mua.file
{
         # lockfile above already (which locked for the greps as well)
         # 40KB is a lot of messages, but it's also a paltry size these days
         # anyway.  This might be about 800 messages worth of typical sized
         # messageids.
         :0Whc
         | formail -D 40000 ignore.cache

         # File this message away as irrelevant
         # (I'm using mbx format)
         :0:
         irrelevant.threads
}

#============================================================================

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>