Mercurial > dovecot > core-2.2
changeset 12239:45812039b7ce
lib-storage: Don't write to dovecot.mailbox.log if setting subscription didn't actually change anything.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 04 Oct 2010 16:01:09 +0100 |
parents | 2b8b2875af26 |
children | 1f784904111b |
files | src/lib-storage/list/subscription-file.c src/lib-storage/list/subscription-file.h src/lib-storage/mailbox-list.c |
diffstat | 3 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/list/subscription-file.c Mon Oct 04 15:55:34 2010 +0100 +++ b/src/lib-storage/list/subscription-file.c Mon Oct 04 16:01:09 2010 +0100 @@ -195,7 +195,7 @@ failed = TRUE; } } - return failed ? -1 : 0; + return failed ? -1 : (changed ? 1 : 0); } struct subsfile_list_context *
--- a/src/lib-storage/list/subscription-file.h Mon Oct 04 15:55:34 2010 +0100 +++ b/src/lib-storage/list/subscription-file.h Mon Oct 04 16:01:09 2010 +0100 @@ -13,6 +13,7 @@ /* Returns the next subscribed mailbox, or NULL. */ const char *subsfile_list_next(struct subsfile_list_context *ctx); +/* Returns 1 if subscribed, 0 if no changes done, -1 if error. */ int subsfile_set_subscribed(struct mailbox_list *list, const char *path, const char *temp_prefix, const char *name, bool set);
--- a/src/lib-storage/mailbox-list.c Mon Oct 04 15:55:34 2010 +0100 +++ b/src/lib-storage/mailbox-list.c Mon Oct 04 16:01:09 2010 +0100 @@ -1146,9 +1146,10 @@ const char *name, bool set) { uint8_t guid[MAIL_GUID_128_SIZE]; + int ret; - if (list->v.set_subscribed(list, name, set) < 0) - return -1; + if ((ret = list->v.set_subscribed(list, name, set)) <= 0) + return ret; /* subscriptions are about names, not about mailboxes. it's possible to have a subscription to nonexistent mailbox. renames also don't