ietf-mta-filters
[Top] [All Lists]

Re: Three new drafts and a question

2003-04-29 16:07:27

[Ned Freed]:

  [Nigel Swinson]:

  > One other thing to say is complexity for guis.  If the intention
  > is to "replace header" and you have to do this via removeheader
  > and addheader, then it becomes much more difficult to "extract"
  > from the script.

good point.  most GUI's will only need to understand their own Sieve
code, but it is important that the constructs we provide lend
themselves easily to common idioms.

  > The intention being to populate a control that has an array of
  > desired actions, one of which is "Prepend the following
  > substring to the Subject line".
  >
  > ie either:
  >
  > if spamtest :value "ge" :comparator "i;ascii-numeric" "3" {
  >     replaceheader :newvalue "[SPAM] ${1}" :matches "Subject" "*";
  > }
  >
  > or:
  >
  > if spamtest :value "ge" :comparator "i;ascii-numeric" "3" {
  >     deleteheader :matches "Subject" "*";
  >     addheader "Subject" "[SPAM] ${1}";
  > }
  
  I actually prefer the second. It makes it clear a new header is
  being generated with all that implies (changes to encoded words,
  etc.). The former implies that the operation may only be a simple
  prepend. The world isn't this simple.

Nigel's second example is quite clever.  the reverse, removing a
prefix, exposes unintuitive behaviour in my draft, though:

    deleteheader :matches "Subject" "[ietf] *";
    addheader "Subject" "${1}";
    fileinto "INBOX.lists.ietf";

consider this message:

    Subject: [ietf] meeting on Thursday
    Subject: buggy header

the result will actually be:

    Subject: buggy header
    Subject: 

since the failed match will empty the numeric variables.  two Subject
headers is a bit obscure, so a better example may be:

    deleteheader :matches "Subject" "[ietf] *";
    deleteheader :matches "Subject" "Re: [ietf] *";
    addheader "Subject" "${1}";

I know you wanted a failed match to not influence the numeric
variables, Ned, it seems like you were right.

-- 
Kjetil T.