How to stop sieve processing to skip sieve_after scripts ?

Stephan Bosch
2018-03-22T18:29:06Z

Op 3/22/2018 om 3:30 PM schreef Mr Nicolas Belan:
> Hello the list,
>
> I am trying to achieve filter processing using sieve, but i am not
> sure I can do what I want.
>
> I want to let the user decide to use my filtering script (sieve_after)
> or not.
> According to the documentation, i am trying to stop processing in user
> sieve script, but processing continue.
>
> I am using dovecot 2.2 (CentOS).
>
> My sieve configuration is:
> plugin {
> ? sieve = /var/vmail/%d/%n/%n.sieve
> ? sieve_before = /etc/dovecot/sieve/global-before
> ? sieve_after = /etc/dovecot/sieve/global
> [...]
> }
>
> 'sieve' is the filter script created by users.
> When trying to stop processing, it is generated by roundcube like:
> # rule:[deliver to mailbox]
> if anyof (true)
> {
> ?? ?stop;
> }
>
> 'sieve_after' is the filter which handles the spam processing
> (fileinto Junk).
>
> But the processing continue until all sieve filters are processed:
>
> Mar 22 14:50:23 lda(user at example.com): Debug: none: root=, index=,
> indexpvt=, control=, inbox=, alt> Mar 22 14:50:23 lda(user at
example.com): Debug: Destination address:
> user at example.com (source: -a parameter)
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: Pigeonhole
> version 0.4.2 initializing
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: include:
> sieve_global_dir is not set; it is currently not possible to include
> `:global' scripts.
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: executed before
> user's personal Sieve script(1): /etc/dovecot/sieve/global-before
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: using the
> following location for user's Sieve script:
> /var/vmail/example.com/user/user.sieve;name=main script
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: executed after
> user's Sieve script(3): /etc/dovecot/sieve/global
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: opening script 1
> of 3 from /etc/dovecot/sieve/global-before
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: loading script
> /etc/dovecot/sieve/global-before
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: script binary
> /etc/dovecot/sieve/global-before.svbin successfully loaded
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: binary save: not
> saving binary /etc/dovecot/sieve/global-before.svbin, because it is
> already stored
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: executing script
> from /etc/dovecot/sieve/global-before.svbin
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: opening script 2
> of 3 from /var/vmail/example.com/user/user.sieve;name=main script
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: loading script
> /var/vmail/example.com/user/user.sieve;name=main script
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: script binary
> /var/vmail/example.com/user/user.svbin successfully loaded
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: binary save: not
> saving binary /var/vmail/example.com/user/user.svbin, because it is
> already stored
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: executing script
> from /var/vmail/example.com/user/user.svbin
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: opening script 3
> of 3 from /etc/dovecot/sieve/global
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: loading script
> /etc/dovecot/sieve/global
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: script binary
> /etc/dovecot/sieve/global.svbin successfully loaded
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: binary save: not
> saving binary /etc/dovecot/sieve/global.svbin, because it is already
> stored
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: executing script
> from /etc/dovecot/sieve/global.svbin
> Mar 22 14:50:23 lda(user at example.com): Debug: Namespace : Using
> permissions from /var/vmail/example.com/user/Maildir: mode=0700
> gid=default
> Mar 22 14:50:23 lda(user at example.com): Info: sieve:
> msgid=<cm.0045046409888.jyshukd.kidudykyhi.r at cmail19.com>: stored
mail
> into mailbox 'Courrier ind?sirable'
>
> I would like to stop processing after
> Mar 22 14:50:23 lda(user at example.com): Debug: sieve: using the
> following location for user's Sieve script:
> /var/vmail/example.com/user/user.sieve;name=main script
> At the end, I do not want mail to be delivered into Junk, but into INBOX..
>
> Is it possible ?
> Perhaps a sieve, sieve2 setting exists ? (like sieve_before,
> sieve_before2 ...)

Sieve processing continues into the next script in the sequence as long
as an (implicit) keep is active. So, when you want to halt the sequence,
but have the message filed into INBOX, you need to get the implicit keep
canceled and end the script: e.g. do { fileinto "INBOX"; stop; }

Regards,

Stephan