6.0.0-alpha12
6/8/25

[#5746] patch to resolve sieve forward/keep ambiguity
Summary patch to resolve sieve forward/keep ambiguity
Queue Ingo
Queue Version FRAMEWORK_3
Type Enhancement
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester tdrewry (at) bu (dot) edu
Created 09/26/2007 (6465 days ago)
Due
Updated 10/09/2007 (6452 days ago)
Assigned 09/26/2007 (6465 days ago)
Resolved 10/07/2007 (6454 days ago)
Milestone
Patch Yes

History
10/09/2007 02:20:20 PM tdrewry (at) bu (dot) edu Comment #5 Reply to this comment
Thanks for your detailed explanation. It helped to understand what
your patch was supposed to, because it didn't work at all. :) You
were referring to variables that didn't exist, the "stop" rule was
not added after the redirect call, etc.
Please see if what I committed to CVS now is what you wanted to achieve.
That works great :), I'm not sure why the patch didn't work for you 
though.  However, I'm not complaining, your code is much cleaner then 
what I generated.



Thanks again,

Tobias
10/07/2007 11:08:14 AM Jan Schneider Comment #4
State ⇒ Resolved
Reply to this comment
Thanks for your detailed explanation. It helped to understand what 
your patch was supposed to, because it didn't work at all. :) You were 
referring to variables that didn't exist, the "stop" rule was not 
added after the redirect call, etc.

Please see if what I committed to CVS now is what you wanted to achieve.
10/05/2007 03:43:33 PM tdrewry (at) bu (dot) edu Comment #3 Reply to this comment
Just to make sure I understand what you are trying to achieve with
this change:
With keep, your patch enables all other filter rules to be applied
while this didn't happen without your patch?
Yes and no.  With the current implementation the behavior with keep 
was to immediately copy the message to the users INBOX and then pass 
the message to any remaining filters.  This would result in duplicates 
of the messages being saved to folders as well as to the INBOX.



By moving the keep action to a separate rule at the end of the sieve 
list, you are able to move the forward rule around so as to allow some 
or all of your filters to be used (and possible stop the filtering) 
before the keep action is executed.



The 'stop' action in the Forward Keep Action is just there for 
completeness.  It  makes the sieve script behave reliably no matter 
what version of the RFC is in use (i.e. it is slightly redundant).
Without keep, what does the extra "stop" change, if "redirect"
already doesn't keep the message?
A redirect without stop redirects the mail and passes the message on 
to any other filters until a stop action is found.



The redirect directive disable the implicit keep in Sieve.  With the 
implicit keep disabled, when a message reaches the end of the filter 
list it is not "kept".

However, if the message matched any filters after the redirect, then 
the message is also delivered according to the rules of that message.



The stop prevents further processing of the mail message after the 
forward, thus preventing messages from collecting in folders when a 
user is thinking that all of their mail is being redirected.



Let me know if you need examples or more explanation.  I can also site 
the RFC if needed.



- Tobias


10/05/2007 03:20:39 PM Jan Schneider Comment #2
Taken from Horde DevelopersHorde Developers
State ⇒ Feedback
Reply to this comment
Just to make sure I understand what you are trying to achieve with 
this change:

With keep, your patch enables all other filter rules to be applied 
while this didn't happen without your patch?

Without keep, what does the extra "stop" change, if "redirect" already 
doesn't keep the message?
09/26/2007 02:43:01 PM Chuck Hagenbuch Assigned to Jan Schneider
Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
 
09/26/2007 02:26:17 PM tdrewry (at) bu (dot) edu Comment #1
Priority ⇒ 2. Medium
State ⇒ New
New Attachment: sieve.php.patch Download
Queue ⇒ Ingo
Summary ⇒ patch to resolve sieve forward/keep ambiguity
Type ⇒ Enhancement
Reply to this comment
The attached patch fixes a problem in the keep behavior for the 
Forward script by

creating two Sieve rules to handle 'redirect' and 'keep' as separate actions.



Currently using Forward with Keep looks like this:

# Forwards

if true {

     redirect "username@server";

     keep;

}



and without Keep:

# Forwards

if true {

     redirect "username@server";

}



The behavior of the first script is to redirect mail as expected and 
then immediately

drop a copy into the Inbox followed by parsing of any additional filters.



The second script will redirect the mail and then continue to parse 
via additional rules

until a stop is encountered.  Mail is not delivered into the Inbox at 
the end of the

script.



The reason why mail does not go to the inbox during a Forward request 
is that the

redirect action disables the implicit keep within Sieve.



The keep action declares an _explicit_ keep action which is the same 
as declaring:

fileinto "Inbox".



This patch results one of the following:



Without Keep:



# Forwards

if true {

     redirect "username@server";

     stop;

}



With Keep:



# Forwards

if true {

     redirect "username@server";

}



... any other rules that exist with the last rule being ...



# Forward Keep Action

if true {

     keep;

     stop;

}



A user can still move the position of the Forwards script within Ingo.

The Forward Keep Action script is always placed at the end.  This 
script replicated the

implicit keep function.



- Tobias Drewry

Saved Queries