mailbox-list-index-iter.c revision d186a2391d98a3efa3fe1078879ef2798e169c29
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce/* Copyright (c) 2006-2017 Dovecot authors, see the included COPYING file */
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorcestatic bool iter_use_index(struct mailbox_list *list,
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT(list);
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce if ((flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) {
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce /* for now we don't use indexes when listing subscriptions,
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce because it needs to list also the nonexistent subscribed
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce mailboxes, which don't exist in the index. */
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce /* no indexing wanted with raw lists */
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce /* refresh failed */
22a21e910fd216ec1468fe769dcc29f1621a52a4Ondrej Kosmailbox_list_index_iter_init(struct mailbox_list *list,
ab967283b710dfa05d11ee5b30c7ac916486ceecSimo Sorce const char *const *patterns,
c6872e79e8496fd075e20aec0343ade99cca725cSimo Sorce struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT(list);
233a3c6c48972b177e60d6ef4cecfacd3cf31659Simo Sorce pool = pool_alloconly_create("mailbox list index iter", 2048);
7c69221077c780e62f6c536e78675f2dc1c131bcMichal Zidek ctx = p_new(pool, struct mailbox_list_index_iterate_context, 1);
f9961e5f82e0ef474d6492371bfdf9e74e208a99Pavel Březina ctx->ctx.glob = imap_match_init_multiple(pool, patterns, TRUE, ns_sep);
f9961e5f82e0ef474d6492371bfdf9e74e208a99Pavel Březina array_create(&ctx->ctx.module_contexts, pool, sizeof(void *), 5);
e5f455afbc2d149527bfd08f4e89903a3a8da17aPavel Březina ctx->info_pool = pool_alloconly_create("mailbox list index iter info", 128);
9cb46bc62f22e0104f1b41a423b014c281ef5fc2Jakub Hrozek /* no indexing */
bc30ce9b7d588a17e58012e699986f0d6898b791Pavel Březina mailbox_list_iter_init_autocreate(ctx->backend_ctx);
2a96981a0ac781d01e5bba473409ed2bdf4cd4e0Jakub Hrozek /* listing mailboxes from index */
8394eddba54b5d3e3fda868145e3751247bdbdb2Michal Zidekmailbox_list_index_update_info(struct mailbox_list_index_iterate_context *ctx)
804df4040eb142f82a44c019c7a55b5ce524583cMichal Zidek struct mailbox_list_index_node *node = ctx->next_node;
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce /* the root directory may have an empty name. in that case we'll still
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce want to insert the separator, so check for non-NULL parent rather
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce than non-empty path. */
MAILBOX_LIST_ITER_RETURN_SUBSCRIBED)) != 0) {
bool follow_children)
return TRUE;
return TRUE;
return TRUE;
return FALSE;
const struct mailbox_info *
bool follow_children;
IMAP_MATCH_CHILDREN)) != 0;
return ret;