At 13:51 2004-03-18 -0600, David W. Tamkin wrote:
OK, so you want to do the stuff unless the subject matches the regexp and
the logfile's name includes the string "account1", right? The way you
have it, if neither of those is true, you do the stuff twice!
Ths isn't necessarily true - if the braces contain a DELIVERING recipe, or
a recipe which effects a bounce (unset HOST), processing will stop before
the second recipe is encountered. In all other cases though, yes, as
originally written, the stuff would be run twice.
:0
* 9876543210^0 LOGFILE ?? account1
* 1^0 ^Subject:.*(bunch of subject items)
{ Do stuff.. }
Having just posted a reply with a scoring approach, let me point out to
readers that this one is a bit more efficient: I merely used the original
condition order, but since the LOGFILE is being checked against a single
item instead of a list, if it matches, it'll do so with less processing
overhead.
I might also point out that David's scoring recipe (unintentionally, I'm
sure) omitted the NOT condition.
The final condition doesn't necessarily benefit from a "maximal" score, so
while my recipe had a maximal for both conditions, and David's has it only
for the first, they would work the same. If you added additional
conditions, you'd want to use the maximal scoring for them, but if the
subject condition changed position in the mix, you'd need to change the
scoring on it for efficiency's sake.
Of course, you _can_ simply use 1^0 on each condition - so long as the sum
is more than 0 at the end of the conditions, you're good to go - and
processing them all, while potentially CPU-costly (though in this case, not
by much), can be beneficial if you run verbose logging, since you'd be able
to see that more than one condition would have matched (say, if this was
for spam filtering - you'd see the other characteristics which would have
worked to match it).
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail