diff --git a/src/lib-sieve/sieve-result.c b/src/lib-sieve/sieve-result.c index feb93478fd17c0a2ae4ced07a7a799a664763839..1efd9a63be0c91d186e412bf613bc5d0d353f95d 100644 --- a/src/lib-sieve/sieve-result.c +++ b/src/lib-sieve/sieve-result.c @@ -1106,8 +1106,10 @@ static int sieve_result_transaction_start (struct sieve_result *result, struct sieve_result_action *first, struct sieve_result_action **last_r) { + const struct sieve_script_env *senv = result->action_env.scriptenv; struct sieve_result_action *rac = first; int status = SIEVE_EXEC_OK; + bool dup_flushed = FALSE; while ( status == SIEVE_EXEC_OK && rac != NULL ) { struct sieve_action *act = &rac->action; @@ -1118,6 +1120,12 @@ static int sieve_result_transaction_start continue; } + if ((act->def->flags & SIEVE_ACTFLAG_MAIL_STORAGE) != 0 && + !dup_flushed) { + sieve_action_duplicate_flush(senv); + dup_flushed = TRUE; + } + if ( act->def->start != NULL ) { status = act->def->start (act, &result->action_env, &rac->tr_context); @@ -1283,10 +1291,8 @@ static int sieve_result_transaction_commit_or_rollback struct sieve_result_action *last, bool *implicit_keep, bool *keep) { - const struct sieve_script_env *senv = result->action_env.scriptenv; struct sieve_result_action *rac; int commit_status = status; - bool dup_flushed = FALSE; /* First commit/rollback all storage actions */ rac = first; @@ -1299,11 +1305,6 @@ static int sieve_result_transaction_commit_or_rollback continue; } - if (!dup_flushed) { - sieve_action_duplicate_flush(senv); - dup_flushed = TRUE; - } - status = sieve_result_action_commit_or_rollback (result, rac, status, implicit_keep, keep, &commit_status);