Question about Sieve and "filters"

foobar foobar at intter.net
Thu Jul 10 05:43:45 EDT 2003


>
> "it" or "result" is a place to put those return codes. (Or
> a function to look them up for the "can't have variables purists")
>
> So instead of:
>
> filter :fileinto;
> if header :contains ...
> elsif header :contains ...
> elsif header :contains ...
> elsif header :contains ...
> ... ad nauseum ...
>
> You have:
>
> filter :fileinto;
> fileinto result;
>
> This simple example could probably be written as:
>
> fileinto filter :fileinto;
>
> But a slightly more complex script might be:
>
> filter :spamtest
> if result :value "le" "comparator-i;ascii-numeric" "-30"
> {
>     filter :sms
> }
> elsif result :value "ge" "comparator-i;ascii-numeric" "5"
> {
>     fileinto "spam";
> }
>
> fileinto filter :fileinto;
>
>

Maybe:

filter :myfilter {
 switch :result {
  case A:
         {
          do_something_A_specific;
         }
  case B:
         {
          do_something_B_specific;
          break;
         }
  default:
          {
           do_something_default_example_stop;
           break;
         }
 }
}

^ I must admit that I love switch/case :)
By that way we could have 'default' implemented nicely and we could have
result 'A' && 'B' nicely processed if 'A' just does one operation more
than B?

With if-else you would write things many times and makes script bigger to
process. sysexec and so on makes too much overhead atleast here if we
would have that kind system here so I prefer DSO still. There would be
server-side plugins (which example could count how many spams server has
processed and example module which calculates time between filters for
debugging purposes) and plugins for available to end-users which can be
used via "filter :extension".

Usually you say in the script which are 'required' extensions, those would
be constructed nicely into "variables" too :/ It would not be too complex
since usually scripts are written by client-software and not by end-user
... and usually programmers write those clients :-)

maybe ifmodule ?! but then client needs to know what that specific module
and we would need to "reserve" module-names / "names to refer", argh.

I am going to be nuts soon if I am not already ;)

Br,
++Titus | Veli Pirttila




More information about the Info-cyrus mailing list