Mercurial > dovecot > core-2.2
changeset 22710:3214091454e6
lib-storage: mailbox_list_index - List prefix/INBOX if it necessary
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 14 Dec 2017 01:39:32 +0200 |
parents | 86939499f531 |
children | 25d4771ad0fd |
files | src/lib-storage/list/mailbox-list-index-iter.c src/lib-storage/list/mailbox-list-index.h |
diffstat | 2 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/list/mailbox-list-index-iter.c Thu Dec 14 01:36:50 2017 +0200 +++ b/src/lib-storage/list/mailbox-list-index-iter.c Thu Dec 14 01:39:32 2017 +0200 @@ -90,13 +90,18 @@ if (strcmp(ctx->info.vname, "INBOX") != 0) { /* non-INBOX */ ctx->info.vname = p_strdup(ctx->info_pool, ctx->info.vname); - } else { + } else if (!ctx->prefix_inbox_list) { /* listing INBOX itself */ ctx->info.vname = "INBOX"; if (mail_namespace_is_inbox_noinferiors(ctx->info.ns)) { ctx->info.flags &= ~(MAILBOX_CHILDREN|MAILBOX_NOCHILDREN); ctx->info.flags |= MAILBOX_NOINFERIORS; } + } else { + /* listing INBOX/INBOX */ + ctx->info.vname = p_strconcat(ctx->info_pool, + ctx->ctx.list->ns->prefix, "INBOX", NULL); + ctx->info.flags |= MAILBOX_NONEXISTENT; } if ((node->flags & MAILBOX_LIST_INDEX_FLAG_NONEXISTENT) != 0) ctx->info.flags |= MAILBOX_NONEXISTENT; @@ -126,6 +131,14 @@ { struct mailbox_list_index_node *node = ctx->next_node; + if (!ctx->prefix_inbox_list && ctx->ctx.list->ns->prefix_len > 0 && + strcmp(node->name, "INBOX") == 0 && node->parent == NULL && + node->children != NULL) { + /* prefix/INBOX has children */ + ctx->prefix_inbox_list = TRUE; + return; + } + if (node->children != NULL && follow_children) { ctx->parent_len = str_len(ctx->path); ctx->next_node = node->children;
--- a/src/lib-storage/list/mailbox-list-index.h Thu Dec 14 01:36:50 2017 +0200 +++ b/src/lib-storage/list/mailbox-list-index.h Thu Dec 14 01:39:32 2017 +0200 @@ -138,6 +138,7 @@ struct mailbox_list_index_node *next_node; unsigned int failed:1; + unsigned int prefix_inbox_list:1; }; extern MODULE_CONTEXT_DEFINE(mailbox_list_index_module,