On July 21, 1999 at 12:13, John Stumbles wrote:

> > I've thought about it.  I have been considering what the best approach
> > will be.  Maybe something like:
> > 
> > <MsgExcludeFilter>
> > /^Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA/m;
> > </MsgExcludeFilter>

NOTE: I have decided to call it MSGEXCFILTER.

>       I like this: you could do other useful things such as:
> 
> /^Subject: .*(money fast|XXX sex|business opportunity|your web site|test
> message|unsubscribe)/im
> 
>       (Couldn't excluding messages with the X-no-archive header set have
> been done this way too?)

Yes, and I give an example in the documentation (btw, I have already
implemented MSGEXCFILTER in my dev tree).  However, the CHECKNOARCHIVE
resource may be useful to users who do not know Perl.


>       What might be useful would be a way of ANDing and ORing 
> expressions to match on e.g.
> 
> <MsgExcludeFilter>
>   <!-- implicit OR: exclude if any of following rules matches -->
>   <FilterRule>
>       /^Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA/m;
>   </FilterRule>
[snip]
>       <!-- implicit AND: this rule matches if both of following
>                          regexps match -->
>       /^From: \w+\@(aol|hotmail)\.com/im
>       /^Subject: .*(money|opportunity|your web)/im
>   </FilterRule>
> </MsgExcludeFilter>

Oh, the horrors.  Just use Perl:

<MsgExcFilter>
/^Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA/m ||
/^Subject: unsubscribe/im ||
/^Subject: test message/im ||
(/^From: \w+\@(aol|hotmail)\.com/im && 
 /^Subject: .*(money|opportunity|your web)/im);
</MsgExcFilter>

Basically, you have all of Perl to do what you want.  You can declare
variables, use loops, require modules, etc.  Internally, MHonArc wraps
your code into a function and puts the body of the function (that the
user defines via MsgExcFilter) into a separate package to avoid
conflicts with MHonArc internals.  $_ is set to a copy of the message
header, so you can actually modify the $_ in your calculations w/o
affecting the original header.

        --ewh

Reply via email to