procmail
[Top] [All Lists]

Re: (il)logical algebra

2004-03-24 17:38:04
On Thu, Mar 25, 2004 at 12:56:28AM +0100, Stefan Heinrichsen wrote:

Am Do 25.03.04 um 00:41 CET schrieb Dallman Ross 
<dman(_at_)nomotek(_dot_)com>:

  :0
  * ^X-Blacklist: Yes
  do_something

Otherwise, if X-Blacklist is NOT set, then *only if X-Whitelist
is also unset, do something:

  :0 E  # use the "else" flag if above recipe was nondelivering
  * ! ^X-Whitelist: Yes
  do_something


Well that would work but the do_something is in my case a block of about
40 lines (some additional spamfilters) which are changed frequently. So
it's not could to have it twice in the procmailrc.

There are many approaches.  An easy way is to put the fortyish lines
in a separate file, called, e.g., do_something.rc.  Then, in place of
my "do_something" action, you use

  { INCLUDERC = do_something.rc }


Alternatively, have the do_something action be the setting of
a variable.

  MYVAR  # this unsets $MYVAR as an initialization assignment
  :0
  * ^X-Blacklist: Yes
  { MYVAR = yes }

  :0 E
  * ! ^X-Whitelist: Yes
  { MYVAR = yes }


Later . . .


  :0
  * MYVAR ?? ^^yes^^
  do_something



One more way is this, using reverse DeMorgan logic, which you
seem to want to try given your logic charts in the initial post.

"If NOT 'Blacklist: Yes' AND 'Whitelist: Yes', do nothing.  Else,
do something."  I hope I got that right.  It's near my bed time,
and I've been coding for a hours so am pretty knackered.

   :0
   * ! Blacklist: Yes
   *   Whitelist: Yes
   { }

   :0 E
   do_something

-- 
dman

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