procmail
[Top] [All Lists]

Re: check filtered stream but deliver unfiltered

2001-12-06 09:13:24
On Wed, 5 Dec 2001, Professional Software Engineering wrote:

Yo! Bart, pleaes read the original request - the requestor isn't
asking to simply run a script and trigger on the return value of the
result - he wants to _TRANSFORM_ the message (in the cited example,
converting it from HTML to plaintext), then perform further
operations/tests on the TRANSFORMED copy

What the original poster wrote was:

... In one of those spam checks I run the body of the message though an
html->text filter but the message I want to deliver is the unfiltered
body. ...

Which nowhere says that he uses the result of the conversion, just that he 
does it.  The recipe example was:

    :0bf
    | w3m -dump -T text/html
     
    :0 E:
    INCLUDERC=spamscan_body     #sets $SPAMFOUND if message matches conditions

This is pretty messed up.  The 'E' flag there means that the action of
that second recipe will never be executed (because the action of the first
one is always executed), which is a good thing, as all it does is deliver
to a file named "INCLUDERC=spamscan_body".

My assumption was that he meant to use the 'e' flag, meaning to scan the
body only if the conversion *failed*.  I apologize for not bothering to
explain all of this yesterday, and for working only from memory of the
original posting when following-up to a follow-up.

Anyway, on the opposite assumption, I'd suggest:

----
:0c
/tmp

ORIGINAL=$LASTFOLDER

:0bf
| w3m -dump -T text/html

INCLUDERC=spamscan_body

:0hbfi
| cat $ORIGINAL && rm $ORIGINAL

# Could do some more error checking here

:0
* SPAMFOUND ?? .
{
 # etc
}
----

On Thu, 6 Dec 2001, David W. Tamkin wrote:

| >:0
| >* some condition
| >{
| >  :0 B
| >  * ? yourscript
| >  someaction
| >}

Even if that were the right procedure, it could be written

 :0
 * some condition
 * B ?? ? yourscript
 someaction

which is quicker for procmail to read and IMO more legible for human
eyes as well.

I tend to disagree that the resulting pile of question-marks is more
legible than pulling the 'B' up to a flag, but that's entirely a matter
of preference.

_______________________________________________
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>