Mercurial > dovecot > core-2.2
changeset 13126:0a0f962c1a6f
lib-storage: mailbox_list_mailbox() now returns INBOX as nonexistent if it physically doesn't exist.
This is important for MAILBOX_LIST_ITER_NO_AUTO_BOXES to work correctly with
Maildir++ layout INBOX.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 29 Jul 2011 14:30:32 +0300 |
parents | 4dca25ea4a1c |
children | 5b7cc753f7c8 |
files | src/lib-storage/mailbox-list.c |
diffstat | 1 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mailbox-list.c Fri Jul 29 14:29:01 2011 +0300 +++ b/src/lib-storage/mailbox-list.c Fri Jul 29 14:30:32 2011 +0300 @@ -1266,6 +1266,34 @@ *flags_r = 0; + if ((list->ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0 && + strcasecmp(name, "INBOX") == 0) { + /* special handling for INBOX, mainly because with Maildir++ + layout it needs to check if the cur/ directory exists, + which the Maildir++ layout backend itself can't do.. */ + struct mailbox *box; + enum mailbox_existence existence; + int ret; + + box = mailbox_alloc(list, "INBOX", MAILBOX_FLAG_KEEP_RECENT); + ret = mailbox_exists(box, FALSE, &existence); + mailbox_free(&box); + if (ret < 0) { + /* this can only be an internal error */ + mailbox_list_set_internal_error(list); + return -1; + } + switch (existence) { + case MAILBOX_EXISTENCE_NONE: + case MAILBOX_EXISTENCE_NOSELECT: + *flags_r |= MAILBOX_NONEXISTENT; + return 0; + case MAILBOX_EXISTENCE_SELECT: + break; + } + return 1; + } + rootdir = mailbox_list_get_path(list, NULL, MAILBOX_LIST_PATH_TYPE_MAILBOX); path = mailbox_list_get_path(list, name, MAILBOX_LIST_PATH_TYPE_DIR);