Mercurial > dovecot > core-2.2
changeset 13445:3844653d483a
lib-storage: Handle INBOX in the common mailbox_exists() code.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 12 Sep 2011 13:13:35 +0300 |
parents | 59c7b30973cf |
children | cc9332de9982 |
files | 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 |
diffstat | 4 files changed, 15 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-storage.c Mon Sep 12 12:41:09 2011 +0300 +++ b/src/lib-storage/index/index-storage.c Mon Sep 12 13:13:35 2011 +0300 @@ -151,28 +151,19 @@ 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);
--- a/src/lib-storage/index/index-storage.h Mon Sep 12 12:41:09 2011 +0300 +++ b/src/lib-storage/index/index-storage.h Mon Sep 12 13:13:35 2011 +0300 @@ -59,8 +59,7 @@ 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,
--- a/src/lib-storage/index/maildir/maildir-storage.c Mon Sep 12 12:41:09 2011 +0300 +++ b/src/lib-storage/index/maildir/maildir-storage.c Mon Sep 12 13:13:35 2011 +0300 @@ -323,11 +323,11 @@ 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)
--- a/src/lib-storage/mail-storage.c Mon Sep 12 12:41:09 2011 +0300 +++ b/src/lib-storage/mail-storage.c Mon Sep 12 13:13:35 2011 +0300 @@ -694,6 +694,12 @@ 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); }