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

Re: List variables in Sieve (Re: variables draft (draft-homme-sieve-variables-00.txt))

2003-04-19 04:56:50


Alexey Melnikov wrote:

Jutta Degener wrote:

On Sun, Apr 13, 2003 at 05:53:40PM +0200, Kjetil Torgrim Homme wrote:
[Alexey Melnikov]:

  In order to move imapflags extension forward I need support for
  set/list variables.

I think we might be able to do without this.  What if you allow
(and ignore) empty strings in a [...] list?

That way, you could set

        set "aflag" "aflag"

        ["${aflag}", "${bflag}", "${cflag}"]

and have that come out as

        ["aflag" "" ""]

if bflag and cflag are unset.

There are still things that you can do with a list algebra
that you can't do with this approach -- infinitely many
flags based on the header and body contents of a message --
but I don't think we want to do those things badly enough
to warrant adding three new commands and a variable data type.

Surely three new actions shouldn't scare you :-).
But I understand the complexity of multiple data types.

Ok, I can live with this.
It seems the only thing required to be said is that empty strings are
ignored in a list that specifies flags to be set.
I should also mention that each list member defines a separate flag and
spaces in flag names are not allowed (due to IMAP restriction).

After I rewrote my example in "imapflags" I've realised how ugly this will
look, because
1). The script author has to remember all flags that were set on the
message and specify them all.
2). setflags has to be replaced with multiple "set"s as we have to clear
all flags.

So, I am thinking now about using a single string parameter (instead of a
string list) that contains space delimited flags. Adding flags (old
"addflags") to the list would be simpler, e.g.

set "flags" "${flags} \\Seen"

I was wondering if we'd eventually get to this. I'm not delighted by it, but
I think it probably is the best solution to the problem.

"removeflags" would be trickier to implement, but "string" test with
:matches can be used to test if a flag was set, e.g.

if string :matches "${flags}" "*\\Draft*" {
    set "flags" "${1}${2}"
}

Very cute. How to folks who precompile all this stuff feel about allowing
this sort of variable pattern?

                                Ned