procmail
[Top] [All Lists]

Re: Can These 2 Recipes Be Or'd?

2004-05-10 02:46:08
On Sun, May 09, 2004 at 08:54:13PM -0500, David W. Tamkin wrote:

A recipe can have only one action.  You have two different actions 
there, so you can't possibly get them out of a single recipe.

David's right, of course, except that whenever I hear "can't
possibly" with relation to computers, the hair on the back of my
neck stands up.  There Must Be A Way.  ;->

So (I'm not recommending this at all for Marvin, or anyone, for that
matter; it's just to counter the "impossible" claim): how about we
use the ability of MATCH to be reinstantiated inside a recipe, to
create a variable action?  To wit:

 DRYRUN = -0.00001             # de minimus negative decimal number
 ALIST   = "/dev/null:spam/"   # a list that will be reparsed
 :0
 * $  $DRYRUN^0  ALIST ?? ^^\/[^:]+
 * 9876543210^0 ^(To|Cc|Bcc):.*xxxxxxx@(teebookglobal|303Sport)[.]com
 * $  $DRYRUN^0  ALIST ?? :\/.+^^
 * 9876543210^0 ^Received:.*boxer[.]([a-z0-9_-]+[.])?com[.]au
 $MATCH


Btw to Marvin: I highly doubt you'll ever see an actual Bcc: field
(and note that I've added the previously missing header-name colon),
unless your MTA is very specially set up non-stock.



More generally:

 DRYRUN = -0.00001           # de minimus negative decimal number
 ALIST   = "choco:vanilla"   # a list that will be reparsed
 :0
 * $  $DRYRUN^0  ALIST ?? ^^\/[^:]+
 * 9876543210^0  one condition
 * $  $DRYRUN^0  ALIST ?? :\/.+^^
 * 9876543210^0  alternative condition
 $MATCH

It can be expanded to more than two choices, of course, with the right
reparsing of $ALIST.  Again, not really recommended; just an exercise
in the implausible.  :-)

-- 
dman

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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