Skip to content
Snippets Groups Projects
Commit 42693b97 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

doveadm-sieve: Fixed problem with synchronizing the active script.

parent 591a6272
No related branches found
No related tags found
No related merge requests found
...@@ -520,15 +520,19 @@ int sieve_script_is_active(struct sieve_script *script) ...@@ -520,15 +520,19 @@ int sieve_script_is_active(struct sieve_script *script)
int sieve_script_activate(struct sieve_script *script, time_t mtime) int sieve_script_activate(struct sieve_script *script, time_t mtime)
{ {
struct sieve_storage *storage = script->storage;
int ret; int ret;
i_assert( (script->storage->flags & SIEVE_STORAGE_FLAG_READWRITE) != 0 ); i_assert( (storage->flags & SIEVE_STORAGE_FLAG_READWRITE) != 0 );
i_assert( script->open ); // FIXME: auto-open? i_assert( script->open ); // FIXME: auto-open?
i_assert( script->v.activate != NULL ); i_assert( script->v.activate != NULL );
ret = script->v.activate(script); ret = script->v.activate(script);
sieve_storage_set_modified(script->storage, mtime); if (ret >= 0) {
sieve_storage_set_modified(storage, mtime);
sieve_storage_sync_script_activate(storage);
}
return ret; return ret;
} }
......
...@@ -243,4 +243,10 @@ void sieve_storage_sync_script_rename ...@@ -243,4 +243,10 @@ void sieve_storage_sync_script_rename
void sieve_storage_sync_script_delete void sieve_storage_sync_script_delete
(struct sieve_storage *storage, const char *name); (struct sieve_storage *storage, const char *name);
void sieve_storage_sync_script_activate
(struct sieve_storage *storage);
void sieve_storage_sync_deactivate
(struct sieve_storage *storage);
#endif #endif
...@@ -134,3 +134,33 @@ void sieve_storage_sync_script_delete ...@@ -134,3 +134,33 @@ void sieve_storage_sync_script_delete
mail_index_attribute_unset(t->itrans, TRUE, key, ioloop_time); mail_index_attribute_unset(t->itrans, TRUE, key, ioloop_time);
sieve_storage_sync_transaction_finish(storage, &t); sieve_storage_sync_transaction_finish(storage, &t);
} }
void sieve_storage_sync_script_activate
(struct sieve_storage *storage)
{
struct mailbox_transaction_context *t;
if (storage->sync_inbox == NULL)
return;
t = mailbox_transaction_begin(storage->sync_inbox, 0);
mail_index_attribute_set
(t->itrans, TRUE, MAILBOX_ATTRIBUTE_SIEVE_DEFAULT, ioloop_time, 0);
sieve_storage_sync_transaction_finish(storage, &t);
}
void sieve_storage_sync_deactivate
(struct sieve_storage *storage)
{
struct mailbox_transaction_context *t;
if (storage->sync_inbox == NULL)
return;
t = mailbox_transaction_begin(storage->sync_inbox, 0);
mail_index_attribute_unset
(t->itrans, TRUE, MAILBOX_ATTRIBUTE_SIEVE_DEFAULT, ioloop_time);
sieve_storage_sync_transaction_finish(storage, &t);
}
...@@ -670,8 +670,11 @@ int sieve_storage_deactivate ...@@ -670,8 +670,11 @@ int sieve_storage_deactivate
i_assert(storage->v.deactivate != NULL); i_assert(storage->v.deactivate != NULL);
ret = storage->v.deactivate(storage); ret = storage->v.deactivate(storage);
sieve_storage_set_modified(storage, mtime); if (ret >= 0) {
sieve_storage_set_modified(storage, mtime);
sieve_storage_sync_deactivate(storage);
}
return ret; return ret;
} }
......
...@@ -188,7 +188,7 @@ sieve_attribute_unset_active_script(struct mail_storage *storage, ...@@ -188,7 +188,7 @@ sieve_attribute_unset_active_script(struct mail_storage *storage,
{ {
int ret; int ret;
if ((ret=sieve_storage_is_singular(svstorage)) <= 0) { if ((ret=sieve_storage_is_singular(svstorage)) != 0) {
if (ret < 0) if (ret < 0)
mail_storage_set_internal_error(storage); mail_storage_set_internal_error(storage);
return ret; return ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.