Toen ik Dallman Ross kietelde, kwam er dit uit:
Ruud H.G. van Tol:
SCMAX = 2147483647
SPACE = " "
TAB = " "
WS = "$SPACE$TAB"
H_To
:0
*$ ^To:[$WS]*\/[^$WS].*
{ H_To = "$MATCH" }
H_Cc
:0
*$ ^Cc:[$WS]*\/[^$WS].*
{ H_Cc = "$MATCH" }
[...]
I don't use the first [$WS] at all, because zero
or more of something is still nothing. But if
you want it as a stylistic marker, that's okay.
I actually did first have .* for those [$WS]*
but then I thought of the actual CPU-cycles
and decided that the more outspoken way (less
the variable-expansion) could well be cheaper.
I did not want any start-space included in the
H_Xxx because that makes those variables have
values that are easier to use.
I was tempted to collect the values in a H_To_Cc
because that would shave some lines off, but
expected use of these variables further on in
any serious rc.
TooMuch = 4 # set your own number
:0:
*$ -$TooMuch^0
*$ $SCMAX^0
* 1^1 H_To ?? @
* 1^1 H_Cc ?? @
red-spam
While trying to fall asleep last night (procmail
before bed is dangerous!), I thought of a sneaky way
to neutralize, for our purposes, the MATCH inside
a condition set. That way, it could, indeed, all be
done in one recipe. Of course, "sneaky" isn't necessarily
better. But I thought this was sort of fun, at least while
in my pre-sleep alpha-phase:
:0:
* $ -$SMALL^0 ^To:\/.*
* 1^1 MATCH ?? @
* $ -$SMALL^0 MATCH ?? ^^\/.
* $ -$SMALL^0 ^Cc:\/.*
* 1^1 MATCH ?? @
* $ -$LIMIT^0
red-spam
Why the minus-SMALL? Even a single one is lowering
the score by a full point. Isn't a SMALL-without-the-
minus what you really want? Depending on what you see
as the LIMIT of course (TooMuch or Maxeptable).
The third condition is where we're :neutralizing" MATCH
to something certainly not a @.
Some other trickery ideas: ()\/^^ and ()\/^ and ()\/[^(_at_)]
(all untested).
No, while the above seems to do it all in one recipe,
your way (close to my actual way practiced in my rc) is
stylistically better. Better at self-documenting, and not
overwrought with "cleverness" that hides its real purpose
from easy view.
I like to have those H_To and H_Cc and H_Subject and more
(see the ENVFROM, SENDER, CLEANFROM, FROM_USER and FROM_DOMAIN
in http://www.professional.org/procmail/sandbox.html for
examples) all 'initialised at the start', just after the
constants NL, WS, MAXSC etc.
[1] Hooray for the Infinity Shuffle! :-)
It is there to make you smile (again and again). I just hate
those messages with tons of addresses in the To:, creating
a single header of over 32 KB.
--
Affijn, Ruud
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail