[#12049] Filter-Rules-Enhancements
Summary Filter-Rules-Enhancements
Queue Ingo
Queue Version Git master
Type Enhancement
State Accepted
Priority 1. Low
Owners
Requester martin.tessun@die-tessuns.de
Created 2013-02-15 (2408 days ago)
Due
Updated 2013-02-21 (2402 days ago)
Assigned
Resolved
Milestone
Patch No

Comments
martin.tessun@die-tessuns.de 2013-02-15 20:42:37
I have thought of several filter-rules-enhancements (mainly 
sieve-filters; don't know whether this is applicable to other filters 
as well):

1. Add some more flags, mainly the widely used "Junk"-flag is missing

2. Do a "group-hierarchy". This is meant (example for a Mailing-List)
   |-> Recipient mailinglist@example.com
   |---> fileinto "My Mailinglist"
   |---> Sender "Me"
   |------> flag \\Seen

This is bringing rules in a more logic order (of course this is 
possible now as well, but you cannot really "see" what rules belong 
together.

Regards,
Martin

Jan Schneider <jan@horde.org> 2013-02-19 11:27:14
> 1. Add some more flags, mainly the widely used "Junk"-flag is missing

Makes sense.

> 2. Do a "group-hierarchy". This is meant (example for a Mailing-List)
>   |-> Recipient mailinglist@example.com
>   |---> fileinto "My Mailinglist"
>   |---> Sender "Me"
>   |------> flag \\Seen

Not sure what you mean. Are you talking about sub-rules, i.e. rules 
that only apply if an earlier rule applied too? This is pretty complex 
to implement, code-wise and ui-wise. Since you can already do this by 
creating duplicate criteria for different rules, and since this is a 
really advanced and properly rarely used feature, I'd rather not spent 
so much time on this.

martin.tessun@die-tessuns.de 2013-02-21 13:55:22
>> 1. Add some more flags, mainly the widely used "Junk"-flag is missing
>
> Makes sense.
>
>> 2. Do a "group-hierarchy". This is meant (example for a Mailing-List)
>>   |-> Recipient mailinglist@example.com
>>   |---> fileinto "My Mailinglist"
>>   |---> Sender "Me"
>>   |------> flag \\Seen
>
> Not sure what you mean. Are you talking about sub-rules, i.e. rules 
> that only apply if an earlier rule applied too? This is pretty 
> complex to implement, code-wise and ui-wise. Since you can already 
> do this by creating duplicate criteria for different rules, and 
> since this is a really advanced and properly rarely used feature, 
> I'd rather not spent so much time on this.

I think you mainly got it. Within sieve this could look like this (e.g.):

# First do the Spam-stuff
if not header :contains "X-Spam-score" "-" {
   if  header :value "ge" :comparator "i;ascii-numeric" 
["X-Spam-score"] ["5"]  {
     setflag "Junk";
     if  header :value "ge" :comparator "i;ascii-numeric" 
["X-Spam-score"] ["20"]  {
       # Do not keep
       discard;
     }
     elsif  header :value "ge" :comparator "i;ascii-numeric" 
["X-Spam-score"] ["10"]  {
       fileinto "Junk";
     }
     else {
       fileinto "Junk.maybeJunk";
     }
     stop;
   }
}