Mark E. Mallett writes:
On Tue, Oct 21, 2008 at 10:58:45PM +0200, Arnt Gulbrandsen wrote:
I wrote the example in the natural, readable way on purpose.
Sorry, I was just making a charitable guess. Natural, readable
examples are good, but not when they don't work. It certainly begged
the point that Kjetil Torgrim Homme raised, i.e., that it would
require some magical conversion of the address string in order to
make any sense.
Exactly.
The complexity isn't going away. You can accept difficult conversions in
the code, or you can push it into the user's sieve script and the
documentation of what address does. See below.
(Actually I don't think that particular conversion would be so difficult
— I've done much worse ones. Turn <a.b.c.d> into ["a(_at_)b(_dot_)c(_dot_)d", "a(_dot_)b(_at_)c(_dot_)d",
"a(_dot_)b(_dot_)c(_at_)d"] and Sieve's usual matching rules will do the rest. But other
ones could be arbitrarily difficult.)
So you're saying it should be okay to use the address test for
non-address-fields, except that :user and :domain might not work at
all, and :all might work differently from the way it usually works?
No, I'm saying that the address test should work the same way all the
time when it finds an address. I don't get what you are saying there.
Let me try it differently.
The address test is defined to test an address against another address,
or against a part of another address. The domain part, the user part,
or optionally the subaddress part.
The address test could also test
- addresses against a non-address
- non-addresses against an address (what my example did)
- non-addresses against a non-address (what yours did)
But I think that doing that leads to unacceptable complexity and/or
unreliability.
Complexity: If you want to guarantee a particular behaviour for e.g.
non-addresses against non-addresses, then the documentation's
explanation of what the address test does becomes too difficult for
mere mortals. Testing becomes a pain, too.
Or unreliability: You mentioned that in your code, :all worked on
list-id, right? Suppose one of your colleagues revises your address
parser so that it canonicalises "From: Cron Daemon <root>" into "From:
Cron Daemon <root(_at_)my(_dot_)doma(_dot_)in>". Then using address :all on list-id
stops working and address :localpart starts working.
Arnt