mhonarc-users

Re: Omitting dum[my|b] messages when converting archives

1999-07-22 12:17:23
On Wed, 21 Jul 1999, Earl Hood wrote:

On July 21, 1999 at 12:13, John Stumbles wrote:
---8<---
    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>

Much neater {blush!} :-)

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.

That _is_ neat!

BTW thanks, not only for MHonArc, but for responding so promptly and
helpfully to [dum[my|b]] users such as me!


--
John Stumbles                                      
j(_dot_)d(_dot_)stumbles(_at_)reading(_dot_)ac(_dot_)uk
I.T. Services Centre,   University of Reading  http://www.rdg.ac.uk/~visstmbl 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          Press any key to continue or any other key to quit.