]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Handle INBOX in the common mailbox_exists() code.
authorTimo Sirainen <tss@iki.fi>
Mon, 12 Sep 2011 10:13:35 +0000 (13:13 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 12 Sep 2011 10:13:35 +0000 (13:13 +0300)
src/lib-storage/index/index-storage.c
src/lib-storage/index/index-storage.h
src/lib-storage/index/maildir/maildir-storage.c
src/lib-storage/mail-storage.c

index a38d5f74b4b827a27946e424538b4829c8688ca8..da9cd1cf0ff959b6bd8623459006ee727055d1d7 100644 (file)
@@ -151,28 +151,19 @@ index_mailbox_alloc_index(struct mailbox *box)
                                          box->index_prefix);
 }
 
-int index_storage_mailbox_exists(struct mailbox *box, bool auto_boxes,
+int index_storage_mailbox_exists(struct mailbox *box,
+                                bool auto_boxes ATTR_UNUSED,
                                 enum mailbox_existence *existence_r)
 {
-       return index_storage_mailbox_exists_full(box, auto_boxes,
-                                                NULL, existence_r);
+       return index_storage_mailbox_exists_full(box, NULL, existence_r);
 }
 
-int index_storage_mailbox_exists_full(struct mailbox *box, bool auto_boxes,
-                                     const char *subdir,
+int index_storage_mailbox_exists_full(struct mailbox *box, const char *subdir,
                                      enum mailbox_existence *existence_r)
 {
        struct stat st;
        const char *path, *path2;
 
-       if (strcmp(box->name, "INBOX") == 0 &&
-           (box->list->ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0 &&
-           auto_boxes) {
-               /* INBOX always exists */
-               *existence_r = MAILBOX_EXISTENCE_SELECT;
-               return 0;
-       }
-
        /* see if it's selectable */
        path = mailbox_list_get_path(box->list, box->name,
                                     MAILBOX_LIST_PATH_TYPE_MAILBOX);
index 1a7503649ae9e296ccf7e850e6daa3dd25c4b723..800c058184c9a0ff4287c1dd27ef66cef002061d 100644 (file)
@@ -59,8 +59,7 @@ void index_storage_mailbox_alloc(struct mailbox *box, const char *vname,
                                 const char *index_prefix);
 int index_storage_mailbox_exists(struct mailbox *box, bool auto_boxes,
                                 enum mailbox_existence *existence_r);
-int index_storage_mailbox_exists_full(struct mailbox *box, bool auto_boxes,
-                                     const char *subdir,
+int index_storage_mailbox_exists_full(struct mailbox *box, const char *subdir,
                                      enum mailbox_existence *existence_r);
 int index_storage_mailbox_open(struct mailbox *box, bool move_to_memory);
 int index_storage_mailbox_enable(struct mailbox *box,
index 7eb9b6c499e04169ae1490498a5d4a8062f058ed..ae3fce339f7af6ee7ab3d49233eaed7b3464c495 100644 (file)
@@ -323,11 +323,11 @@ static bool maildir_storage_is_readonly(struct mailbox *box)
        return FALSE;
 }
 
-static int maildir_mailbox_exists(struct mailbox *box, bool auto_boxes,
-                                 enum mailbox_existence *existence_r)
+static int
+maildir_mailbox_exists(struct mailbox *box, bool auto_boxes ATTR_UNUSED,
+                      enum mailbox_existence *existence_r)
 {
-       return index_storage_mailbox_exists_full(box, auto_boxes,
-                                                "cur", existence_r);
+       return index_storage_mailbox_exists_full(box, "cur", existence_r);
 }
 
 static int maildir_mailbox_open(struct mailbox *box)
index bc69d804ecce28044891442063fda6e9b6548e9e..39abef181362e6340a13970b2d466459f7f8e563 100644 (file)
@@ -694,6 +694,12 @@ int mailbox_exists(struct mailbox *box, bool auto_boxes,
                return 0;
        }
 
+       if (strcmp(box->name, "INBOX") == 0 && box->inbox_user && auto_boxes) {
+               /* INBOX always exists */
+               *existence_r = MAILBOX_EXISTENCE_SELECT;
+               return 0;
+       }
+
        return box->v.exists(box, auto_boxes, existence_r);
 }