]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Don't write to dovecot.mailbox.log if setting subscription didn't actual...
authorTimo Sirainen <tss@iki.fi>
Mon, 4 Oct 2010 15:01:09 +0000 (16:01 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 4 Oct 2010 15:01:09 +0000 (16:01 +0100)
src/lib-storage/list/subscription-file.c
src/lib-storage/list/subscription-file.h
src/lib-storage/mailbox-list.c

index 02439dc7c08131380f35ce6e4de4bbd91a02386a..62261b67758026f94d136b2254057e990aa1c801 100644 (file)
@@ -195,7 +195,7 @@ int subsfile_set_subscribed(struct mailbox_list *list, const char *path,
                        failed = TRUE;
                }
        }
-       return failed ? -1 : 0;
+       return failed ? -1 : (changed ? 1 : 0);
 }
 
 struct subsfile_list_context *
index 700b3eb080f5764bb7c9595d1009f39b7c694b1a..465733150e84f6a112957cb24adb26bf9ccdcf28 100644 (file)
@@ -13,6 +13,7 @@ int subsfile_list_deinit(struct subsfile_list_context *ctx);
 /* 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);
index bf72db49bbeb98b370335b80cc84e3228226e216..bbd19a0d9d7a56cc9a6a7df34a95b69487e9a5d0 100644 (file)
@@ -1146,9 +1146,10 @@ int mailbox_list_set_subscribed(struct mailbox_list *list,
                                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