libsieve and :copy extension

Rob Mueller robm at fastmail.fm
Mon Jul 11 21:22:12 EDT 2005


> Results in article being delivered to both - likewise with "discard". In
> which case what's "copy" for then ?  ?:/

I think the RFC describes it pretty well...

http://www.faqs.org/rfcs/rfc3894.html

   This document defines a new keyword parameter, ":copy", to be used
   with the Sieve "fileinto" and "redirect" actions.  Adding ":copy" to
   an action suppresses cancellation of the default "inbox" save.  It
   allows users to add commands to an existing script without changing
   the meaning of the rest of the script.

Personally we want it because our web frontend that generates a sieve script 
has 3 main "sections":

Discard rules
Fileinto folder rules
Forwarding fules

In general that works really well, and fits most peoples mental model of 
what they want to do. Most people don't want or need to be able to re-order 
arbitrary rules, and those that do, can just use sieve itself.

Anyway, the problem is that it generates code like this:

if ... discard-rule-1 ... {
  discard;
  stop;
}
... repeat for other discard rules ...

if ... fileinto-rule-1 ... {
  fileinto abc;
} elsif ... fileinto-rule-2 ... {
  fileinto xyz;
} ... repeat for other fileinto rules ...

if ... forwarding-rule-1 ... {
  redirect "...";
  keep;
}
... repeat for other forwarding rules ...

The problem there is the need for the "keep" on the forwarding rule. Most 
people want forwarding to make a copy, and since redirect cancels the 
implicit keep, you have to add it back manually. However, this then 
interacts with the fileinto rules. So if you have a fileinto rule that 
matches a message, and then a forwarding rule that matches a message, you 
end up with a copy in the fileinto folder, a copy redirected, and a copy 
kept into inbox. It's that last copy that people are surprised about.

Now one possible option is to add a clause like this at the end of the 
fileinto chain...

} elsif anof(.. all-forwarding-rules ...) {
  fileinto "Inbox";
}

and remove the "keep;" with each forwarding rule. That would basically do 
what users expect, but unfortunately it breaks + addressing because of the 
explicit fileinto "Inbox", rather than the implicit keep which files into 
Inbox, or the appropriate + addressed folder.

Anyway, the point about all this is that the :copy extension will solve this 
for us. Just add the :copy parameter to the redirect, and remove the keep, 
and you keep what most people expect and want.

Rob

---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list