procmail
[Top] [All Lists]

Re: scored weighting, and sort by size

1997-01-14 11:57:30
Philip Guenther revised his suggestion for Ken Marsh,

| Okay, how about this instead:
| 
| # preset or unset some variables
| R TOCOUNT=0 CCCOUNT=0
| 
| # set $R to be Resent- iff there are any headers that indicate this message
| # as having been resent.
| :0
| * ^Resent-(From|Date|To|Cc|Message-Id):
| { R="Resent-" }

How about just this?

  :0
  * ^Resent-
  { R=Resent- }

| # Now pick out the proper To: header and play with it some.
| :0
| * $ ^${R}To:\/.*
| * 1^0
| * 1^1 MATCH ?? ,
| { TOCOUNT = $= }
| 
| # Ditto for Cc:
| :0
| * $ ^${R}Cc:\/.*
| * 1^0
| * 1^1 MATCH ?? ,
| { CCCOUNT = $= }
| 
| # Sum them up and substract the maximum number of addresses that is 'okay' 
| :0
| * $ $TOCOUNT^0
| * $ $CCCOUNT^0
| * -19^0
| { EXITCODE=77 HOST }
| 
| How's that?

You're right, Philip: if there are Resent- headers, then those without
"Resent-" don't matter and shouldn't be counted.  We should include
Apparently-(Resent-)To: as well, though.

[Curiously, I've never seen commas in Apparently-(Resent-)To: lines.
 Whenever there is more than one apparent recipient, they all get their own
 fields.]

Philip also wrote, after I said that ">" and "<" assume HB regardless of H
or B flags on the flag line,

| However, as of version 3.11pre (not sure which), ">" and "<" _do_ correctly
| work with "H ??" and "B ??", ala:

| :0
| * B ?? > 10240
| do_this

Oh!  Thank you for pointing that out.

| This inconsistency is definately a wart, though I'm mixed on whether to
| call it a bug.  Either it should be changed or a minor documentation
| tweak documenting the behavior should probably be made.  Hmm...

I think a doc tweak is enough.