procmail
[Top] [All Lists]

Re: Simple recipe to move uninteresting threads in separate mailbox

2006-12-31 11:29:41
On Sun, Dec 31, 2006 06:54:20 AM -0800, Professional Software
Engineering (PSE-L(_at_)mail(_dot_)professional(_dot_)org) wrote:

You might check my website and fetch the "sandbox" setup from there,
then run the recipe from within that to test it against _saved_
mail, like so:

Duly noted, thanks. I had already started testing "live" on another
account I only use for some, absolutely non critical, mailing lists
with separate procmailrc, but this is another nice way for sure.

I'll also test the procmail/formail invocation from mutt, thanks.
Right now, in the partial but live test I'm running as above,
everything seems to be working, with the notes below. Any comment is
appreciated.

Ciao and happy 2007!

Marco

1) I have realized that, unlike the .procmail_ignore.mua.file, the
   formail "ignore.cache" has all items on one line:

# cat ignore.cache
<msgid 1><msgid 2><msgid 3>....

   this shouldn't be a problem (unless grep has some undocumented max
   line lenght it can't handle, does it?). Was it intended?

2) I don't remember if I already posted this, but will it work with
   messages which have _both_ the I-R-T and References: headers?

3) I keep having the "Extraneous locallockfile ignored" warning in the
   procmail log. Here is one complete run of that recipe. What does it
   mean? Is it an error?

procmail: Assigning "INCLUDERC=/home/marco/.procmail_irrelevant_threads"
procmail: Assigning "REFS="
procmail: Assigning "MATCH="
procmail: Matched " <46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>"
procmail: Match on "In-Reply-To:[         ]*\/.*"
procmail: Assigning "REFS= 
<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>"
procmail: Assigning "MATCH="
procmail: Matched " 
<1167088906(_dot_)10243(_dot_)0(_dot_)camel(_at_)master(_dot_)site> 
<1167337463(_dot_)16848(_dot_)7(_dot_)camel(_at_)linux(_dot_)site> 
<46C4E444-25D0-4E69-8AFE-36
1FAC12145A(_at_)gmail(_dot_)com>"
procmail: Match on "^References:[         ]*\/.*"
procmail: Assigning "REFS= 
<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>  
<1167088906(_dot_)10243(_dot_)0(_dot_)camel(_at_)master(_dot_)site> <1167337
463(_dot_)16848(_dot_)7(_dot_)camel(_at_)linux(_dot_)site> 
<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>"
procmail: Executing "echo $REFS | tr -s "    " "\n\n" | sed -e 
'/^\([^<].*\|.*[^>]\|\)$/ d'"
procmail: Assigning 
"REFSNL=<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>
<1167088906(_dot_)10243(_dot_)0(_dot_)camel(_at_)master(_dot_)site>
<1167337463(_dot_)16848(_dot_)7(_dot_)camel(_at_)linux(_dot_)site>
<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>"
procmail: Match on "."
procmail: Executing 
"grep,-qF,<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>
<1167088906(_dot_)10243(_dot_)0(_dot_)camel(_at_)master(_dot_)site>
<1167337463(_dot_)16848(_dot_)7(_dot_)camel(_at_)linux(_dot_)site>
<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>,ignore.cache"
procmail: Non-zero exitcode (1) from "grep"
procmail: Score:       0       0 "grep -qF 
<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>
<1167088906(_dot_)10243(_dot_)0(_dot_)camel(_at_)master(_dot_)site>
<1167337463(_dot_)16848(_dot_)7(_dot_)camel(_at_)linux(_dot_)site>
<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com> ignore.cache"
procmail: Executing 
"grep,-qF,<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>
<1167088906(_dot_)10243(_dot_)0(_dot_)camel(_at_)master(_dot_)site>
<1167337463(_dot_)16848(_dot_)7(_dot_)camel(_at_)linux(_dot_)site>
<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>,/home/marco/.procmail_ignore.mua.file"
procmail: Non-zero exitcode (1) from "grep"
procmail: Score:       0       0 "grep -qF 
<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com>
<1167088906(_dot_)10243(_dot_)0(_dot_)camel(_at_)master(_dot_)site>
<1167337463(_dot_)16848(_dot_)7(_dot_)camel(_at_)linux(_dot_)site>
<46C4E444-25D0-4E69-8AFE-361FAC12145A(_at_)gmail(_dot_)com> 
/home/marco/.procmail_ignore.mua.file"
procmail: Extraneous locallockfile ignored

This is the recipe as I'm using it now:

#============================================================================
# 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" /home/marco/.procmail_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>