From: Timo Sirainen Date: Sun, 11 Jul 2010 18:32:28 +0000 (+0100) Subject: lib-storage: Removed code related to listing mailboxes with non-virtual names. X-Git-Tag: 2.0.rc3~86 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c07e35cfc9587fc7589cbc1db0daeeb828456b2b;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Removed code related to listing mailboxes with non-virtual names. The non-virtual listing code would have already crashed with assert. --- diff --git a/src/doveadm/doveadm-mail-altmove.c b/src/doveadm/doveadm-mail-altmove.c index 9b31abd4ff..eafe5d6a66 100644 --- a/src/doveadm/doveadm-mail-altmove.c +++ b/src/doveadm/doveadm-mail-altmove.c @@ -46,7 +46,6 @@ cmd_altmove_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user) { const enum mailbox_list_iter_flags iter_flags = MAILBOX_LIST_ITER_RAW_LIST | - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_NO_AUTO_INBOX | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mail_list_iter *iter; diff --git a/src/doveadm/doveadm-mail-expunge.c b/src/doveadm/doveadm-mail-expunge.c index 2e74e448a4..e0aa1a43b0 100644 --- a/src/doveadm/doveadm-mail-expunge.c +++ b/src/doveadm/doveadm-mail-expunge.c @@ -166,7 +166,6 @@ cmd_expunge_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user) { const enum mailbox_list_iter_flags iter_flags = MAILBOX_LIST_ITER_RAW_LIST | - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_NO_AUTO_INBOX | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mail_list_iter *iter; diff --git a/src/doveadm/doveadm-mail-fetch.c b/src/doveadm/doveadm-mail-fetch.c index 3ac21c240e..86ce1943af 100644 --- a/src/doveadm/doveadm-mail-fetch.c +++ b/src/doveadm/doveadm-mail-fetch.c @@ -422,7 +422,6 @@ cmd_fetch_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user) { struct fetch_cmd_context *ctx = (struct fetch_cmd_context *)_ctx; const enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_NO_AUTO_INBOX | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mail_list_iter *iter; diff --git a/src/doveadm/doveadm-mail-list-iter.c b/src/doveadm/doveadm-mail-list-iter.c index c3d07a9561..c899eac95a 100644 --- a/src/doveadm/doveadm-mail-list-iter.c +++ b/src/doveadm/doveadm-mail-list-iter.c @@ -58,8 +58,6 @@ doveadm_mail_list_iter_init(struct mail_user *user, struct doveadm_mail_list_iter *iter; ARRAY_TYPE(const_string) patterns; - i_assert((iter_flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0); - iter = i_new(struct doveadm_mail_list_iter, 1); iter->search_args = search_args; diff --git a/src/doveadm/doveadm-mail-mailbox-status.c b/src/doveadm/doveadm-mail-mailbox-status.c index cbdd022c93..e8cfb9889a 100644 --- a/src/doveadm/doveadm-mail-mailbox-status.c +++ b/src/doveadm/doveadm-mail-mailbox-status.c @@ -134,7 +134,6 @@ cmd_mailbox_status_run(struct doveadm_mail_cmd_context *_ctx, { struct status_cmd_context *ctx = (struct status_cmd_context *)_ctx; enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_NO_AUTO_INBOX | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; diff --git a/src/doveadm/doveadm-mail-mailbox.c b/src/doveadm/doveadm-mail-mailbox.c index cf3a6af3b7..6a7c4f9623 100644 --- a/src/doveadm/doveadm-mail-mailbox.c +++ b/src/doveadm/doveadm-mail-mailbox.c @@ -110,7 +110,6 @@ cmd_mailbox_list_run(struct doveadm_mail_cmd_context *_ctx, struct list_cmd_context *ctx = (struct list_cmd_context *)_ctx; enum mailbox_list_iter_flags iter_flags = MAILBOX_LIST_ITER_RAW_LIST | - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_NO_AUTO_INBOX | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mail_list_iter *iter; diff --git a/src/doveadm/doveadm-mail-search.c b/src/doveadm/doveadm-mail-search.c index b65ff9f039..c9709c089c 100644 --- a/src/doveadm/doveadm-mail-search.c +++ b/src/doveadm/doveadm-mail-search.c @@ -46,7 +46,6 @@ cmd_search_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user) { const enum mailbox_list_iter_flags iter_flags = MAILBOX_LIST_ITER_RAW_LIST | - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_NO_AUTO_INBOX | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mail_list_iter *iter; diff --git a/src/dsync/dsync-worker-local.c b/src/dsync/dsync-worker-local.c index 79e655171a..7778cbcea4 100644 --- a/src/dsync/dsync-worker-local.c +++ b/src/dsync/dsync-worker-local.c @@ -388,7 +388,6 @@ local_worker_mailbox_iter_init(struct dsync_worker *_worker) (struct local_dsync_worker *)_worker; struct local_dsync_worker_mailbox_iter *iter; enum mailbox_list_iter_flags list_flags = - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_SKIP_ALIASES | MAILBOX_LIST_ITER_NO_AUTO_INBOX; static const char *patterns[] = { "*", NULL }; @@ -592,7 +591,6 @@ local_worker_subs_iter_init(struct dsync_worker *_worker) (struct local_dsync_worker *)_worker; struct local_dsync_worker_subs_iter *iter; enum mailbox_list_iter_flags list_flags = - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_SKIP_ALIASES | MAILBOX_LIST_ITER_SELECT_SUBSCRIBED; static const char *patterns[] = { "*", NULL }; diff --git a/src/imap/cmd-list.c b/src/imap/cmd-list.c index 3c5f64a8b5..06739ad281 100644 --- a/src/imap/cmd-list.c +++ b/src/imap/cmd-list.c @@ -184,8 +184,7 @@ list_get_inbox_flags(struct cmd_list_context *ctx) /* find the INBOX flags */ ns = mail_namespace_find_inbox(ctx->cmd->client->user->namespaces); - list_iter = mailbox_list_iter_init(ns->list, "INBOX", - MAILBOX_LIST_ITER_VIRTUAL_NAMES); + list_iter = mailbox_list_iter_init(ns->list, "INBOX", 0); info = mailbox_list_iter_next(list_iter); if (info != NULL) { i_assert(strcasecmp(info->name, "INBOX") == 0); @@ -198,8 +197,7 @@ list_get_inbox_flags(struct cmd_list_context *ctx) static bool list_namespace_has_children(struct cmd_list_context *ctx) { enum mailbox_list_iter_flags list_flags = - MAILBOX_LIST_ITER_RETURN_NO_FLAGS | - MAILBOX_LIST_ITER_VIRTUAL_NAMES; + MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct mailbox_list_iterate_context *list_iter; const struct mailbox_info *info; bool ret = FALSE; @@ -925,7 +923,6 @@ bool cmd_list_full(struct client_command_context *cmd, bool lsub) args += 2; } - ctx->list_flags |= MAILBOX_LIST_ITER_VIRTUAL_NAMES; if (lsub) { /* LSUB - we don't care about flags */ ctx->list_flags |= MAILBOX_LIST_ITER_SELECT_SUBSCRIBED | diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c index e086f81515..a4d5054230 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c @@ -549,7 +549,6 @@ rebuild_namespace_mailboxes(struct mdbox_storage_rebuild_context *ctx, ctx->default_list = ns->list; iter = mailbox_list_iter_init(ns->list, "*", - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_RETURN_NO_FLAGS); while ((info = mailbox_list_iter_next(iter)) != NULL) { diff --git a/src/lib-storage/index/shared/shared-list.c b/src/lib-storage/index/shared/shared-list.c index bb5a4ebf49..16ba96ff9e 100644 --- a/src/lib-storage/index/shared/shared-list.c +++ b/src/lib-storage/index/shared/shared-list.c @@ -196,8 +196,6 @@ shared_list_iter_next(struct mailbox_list_iterate_context *_ctx) prefix matches without the trailing separator */ i_assert(ns->prefix_len > 0); ctx->info.name = t_strndup(ns->prefix, ns->prefix_len - 1); - if ((_ctx->flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) == 0) - ctx->info.name += ctx->info.ns->prefix_len; if (imap_match(ctx->glob, ctx->info.name) == IMAP_MATCH_YES) { ctx->cur_ns = ns->next; return &ctx->info; diff --git a/src/lib-storage/list/mailbox-list-fs-iter.c b/src/lib-storage/list/mailbox-list-fs-iter.c index adaa9f8123..1ca56b7664 100644 --- a/src/lib-storage/list/mailbox-list-fs-iter.c +++ b/src/lib-storage/list/mailbox-list-fs-iter.c @@ -223,8 +223,7 @@ fs_list_iter_init(struct mailbox_list *_list, const char *const *patterns, ctx->ctx.flags = flags; ctx->info_pool = pool_alloconly_create("fs list", 1024); ctx->next = fs_list_next; - ctx->sep = (flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0 ? - _list->ns->sep : _list->ns->real_sep; + ctx->sep = _list->ns->sep; ctx->info.ns = _list->ns; prefix_len = strlen(_list->ns->prefix); @@ -232,14 +231,11 @@ fs_list_iter_init(struct mailbox_list *_list, const char *const *patterns, for (; *patterns != NULL; patterns++) { /* check that we're not trying to do any "../../" lists */ test_pattern = *patterns; - if ((flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0) { - /* skip namespace prefix if possible. this allows using - e.g. ~/mail/ prefix and have it pass the pattern - validation. */ - if (strncmp(test_pattern, _list->ns->prefix, - prefix_len) == 0) - test_pattern += prefix_len; - } + /* skip namespace prefix if possible. this allows using + e.g. ~/mail/ prefix and have it pass the pattern + validation. */ + if (strncmp(test_pattern, _list->ns->prefix, prefix_len) == 0) + test_pattern += prefix_len; if (mailbox_list_is_valid_pattern(_list, test_pattern)) { if (strcasecmp(*patterns, "INBOX") == 0) { ctx->inbox_match = TRUE; @@ -278,8 +274,7 @@ fs_list_iter_init(struct mailbox_list *_list, const char *const *patterns, return &ctx->ctx; } - vpath = (flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0 ? - _list->ns->prefix : ""; + vpath = _list->ns->prefix; rootdir = list_get_rootdir(ctx, &vpath); if (rootdir == NULL) { path = mailbox_list_get_path(_list, NULL, @@ -663,10 +658,7 @@ fs_list_subs(struct fs_list_iterate_context *ctx) &storage_name); if (ns == NULL) { ns = ctx->info.ns; - if ((ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0) - storage_name = mail_namespace_get_storage_name(ns, storage_name); - else - storage_name = ctx->info.name; + storage_name = mail_namespace_get_storage_name(ns, storage_name); } /* if name ends with hierarchy separator, drop the separator */ diff --git a/src/lib-storage/list/mailbox-list-maildir-iter.c b/src/lib-storage/list/mailbox-list-maildir-iter.c index 2bbe87da1d..b60499f0ec 100644 --- a/src/lib-storage/list/mailbox-list-maildir-iter.c +++ b/src/lib-storage/list/mailbox-list-maildir-iter.c @@ -47,28 +47,18 @@ maildir_fill_parents(struct maildir_list_iterate_context *ctx, struct mail_namespace *ns = ctx->ctx.list->ns; struct mailbox_node *node; const char *p, *mailbox_c; - char hierarchy_sep; bool created; - unsigned int prefix_len; - - if ((ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0) { - hierarchy_sep = ns->sep; - prefix_len = ns->prefix_len; - } else { - hierarchy_sep = ns->real_sep; - prefix_len = 0; - } mailbox_c = str_c(mailbox); - while ((p = strrchr(mailbox_c, hierarchy_sep)) != NULL) { + while ((p = strrchr(mailbox_c, ns->sep)) != NULL) { str_truncate(mailbox, (size_t) (p-mailbox_c)); mailbox_c = str_c(mailbox); if (imap_match(glob, mailbox_c) != IMAP_MATCH_YES) continue; - if (prefix_len > 0 && str_len(mailbox) == prefix_len-1 && - strncmp(mailbox_c, ns->prefix, prefix_len - 1) == 0 && - mailbox_c[prefix_len-1] == hierarchy_sep) { + if (ns->prefix_len > 0 && str_len(mailbox) == ns->prefix_len-1 && + strncmp(mailbox_c, ns->prefix, ns->prefix_len - 1) == 0 && + mailbox_c[ns->prefix_len-1] == ns->sep) { /* don't return matches to namespace prefix itself */ continue; } @@ -99,10 +89,7 @@ static void maildir_set_children(struct maildir_list_iterate_context *ctx, const char *p, *mailbox_c; char hierarchy_sep; - if ((ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0) - hierarchy_sep = ctx->ctx.list->ns->sep; - else - hierarchy_sep = ctx->ctx.list->ns->real_sep; + hierarchy_sep = ctx->ctx.list->ns->sep; /* mark the first existing parent as containing children */ mailbox_c = str_c(mailbox); @@ -287,7 +274,7 @@ maildir_fill_readdir(struct maildir_list_iterate_context *ctx, enum mailbox_info_flags flags; enum imap_match_result match; struct mailbox_node *node; - bool created, virtual_names; + bool created; struct stat st; int ret; @@ -304,8 +291,6 @@ maildir_fill_readdir(struct maildir_list_iterate_context *ctx, return 0; } - virtual_names = (ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0; - mailbox = t_str_new(MAILBOX_LIST_NAME_MAX_LENGTH); while ((d = readdir(dirp)) != NULL) { const char *fname = d->d_name; @@ -323,14 +308,8 @@ maildir_fill_readdir(struct maildir_list_iterate_context *ctx, (fname[1] == '\0' || (fname[1] == '.' && fname[2] == '\0'))) continue; - if (!virtual_names) { - str_truncate(mailbox, 0); - str_append(mailbox, mailbox_name); - mailbox_name = str_c(mailbox); - } else { - mailbox_name = mail_namespace_get_vname(ns, mailbox, - mailbox_name); - } + mailbox_name = mail_namespace_get_vname(ns, mailbox, + mailbox_name); /* make sure the pattern matches */ match = imap_match(glob, mailbox_name); @@ -412,7 +391,6 @@ maildir_fill_other_ns_subscriptions(struct maildir_list_iterate_context *ctx, struct mailbox_node *node; iter = mailbox_list_iter_init(ns->list, "*", - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_RETURN_CHILDREN); while ((info = mailbox_list_iter_next(iter)) != NULL) { node = mailbox_tree_lookup(ctx->tree_ctx, info->name); @@ -459,24 +437,20 @@ maildir_list_iter_init(struct mailbox_list *_list, const char *const *patterns, { struct maildir_list_iterate_context *ctx; struct imap_match_glob *glob; - char sep; pool_t pool; int ret; - sep = (flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0 ? - _list->ns->sep : _list->ns->real_sep; - pool = pool_alloconly_create("maildir_list", 1024); ctx = p_new(pool, struct maildir_list_iterate_context, 1); ctx->ctx.list = _list; ctx->ctx.flags = flags; ctx->pool = pool; - ctx->tree_ctx = mailbox_tree_init(sep); + ctx->tree_ctx = mailbox_tree_init(_list->ns->sep); ctx->info.ns = _list->ns; ctx->prefix_char = strcmp(_list->name, MAILBOX_LIST_NAME_IMAPDIR) == 0 ? '\0' : _list->hierarchy_sep; - glob = imap_match_init_multiple(pool, patterns, TRUE, sep); + glob = imap_match_init_multiple(pool, patterns, TRUE, _list->ns->sep); ctx->dir = _list->set.root_dir; diff --git a/src/lib-storage/list/mailbox-list-maildir.c b/src/lib-storage/list/mailbox-list-maildir.c index dc23e61b0e..141ec634c9 100644 --- a/src/lib-storage/list/mailbox-list-maildir.c +++ b/src/lib-storage/list/mailbox-list-maildir.c @@ -493,7 +493,6 @@ maildir_rename_children(struct mailbox_list *oldlist, const char *oldname, pattern = t_strdup_printf("%s%c*", old_vname, oldlist->ns->sep); iter = mailbox_list_iter_init(oldlist, pattern, - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS | MAILBOX_LIST_ITER_RAW_LIST); while ((info = mailbox_list_iter_next(iter)) != NULL) { diff --git a/src/lib-storage/mailbox-list.c b/src/lib-storage/mailbox-list.c index 3a3d4e2adc..bccce605a2 100644 --- a/src/lib-storage/mailbox-list.c +++ b/src/lib-storage/mailbox-list.c @@ -787,11 +787,6 @@ mailbox_list_iter_init_multiple(struct mailbox_list *list, { i_assert(*patterns != NULL); - /* we'll want to remove MAILBOX_LIST_ITER_VIRTUAL_NAMES flag completely. - this assert will be here until it's sure that there are no more - non-virtual users and it can be safely removed. (and if there are, - this assert can still be easily removed) */ - i_assert((flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0); return list->v.iter_init(list, patterns, flags); } @@ -901,25 +896,19 @@ ns_match(struct ns_list_iterate_context *ctx, struct mail_namespace *ns) if (!ns_match_simple(ctx, ns)) return FALSE; - if ((ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0) { - /* filter out namespaces whose prefix doesn't match. - this same code handles both with and without - STAR_WITHIN_NS, so the "without" case is slower than - necessary, but this shouldn't matter much */ - T_BEGIN { - for (i = 0; ctx->patterns_ns_match[i] != NULL; i++) { - if (ns_match_inbox(ns, ctx->patterns_ns_match[i])) - break; - if (ns_match_next(ctx, ns, - ctx->patterns_ns_match[i])) - break; - } - } T_END; + /* filter out namespaces whose prefix doesn't match. this same code + handles both with and without STAR_WITHIN_NS, so the "without" case + is slower than necessary, but this shouldn't matter much */ + T_BEGIN { + for (i = 0; ctx->patterns_ns_match[i] != NULL; i++) { + if (ns_match_inbox(ns, ctx->patterns_ns_match[i])) + break; + if (ns_match_next(ctx, ns, ctx->patterns_ns_match[i])) + break; + } + } T_END; - if (ctx->patterns_ns_match[i] == NULL) - return FALSE; - } - return ns; + return ctx->patterns_ns_match[i] != NULL; } static struct mail_namespace * @@ -1004,9 +993,6 @@ mailbox_list_iter_init_namespaces(struct mail_namespace *namespaces, i_assert(namespaces != NULL); - i_assert((flags & MAILBOX_LIST_ITER_STAR_WITHIN_NS) == 0 || - (flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0); - pool = pool_alloconly_create("mailbox list namespaces", 1024); ctx = p_new(pool, struct ns_list_iterate_context, 1); ctx->pool = pool; diff --git a/src/lib-storage/mailbox-list.h b/src/lib-storage/mailbox-list.h index 71dd873265..d7ebd7cdce 100644 --- a/src/lib-storage/mailbox-list.h +++ b/src/lib-storage/mailbox-list.h @@ -61,9 +61,6 @@ enum mailbox_name_status { enum mailbox_list_iter_flags { /* Ignore index file and ACLs (used by ACL plugin internally) */ MAILBOX_LIST_ITER_RAW_LIST = 0x000001, - /* Use virtual mailbox names (virtual separators and namespace - prefixes) for patterns and for returned mailbox names. */ - MAILBOX_LIST_ITER_VIRTUAL_NAMES = 0x000002, /* Don't list INBOX unless it actually exists */ MAILBOX_LIST_ITER_NO_AUTO_INBOX = 0x000004, @@ -74,7 +71,7 @@ enum mailbox_list_iter_flags { match beyond namespace boundary (e.g. "foo*" or "*o" doesn't match "foo." namespace's mailboxes, but "*.*" does). also '%' can't match namespace prefixes, if there exists a parent namespace whose children - it matches. VIRTUAL_NAMES must be set when using this flag. */ + it matches. */ MAILBOX_LIST_ITER_STAR_WITHIN_NS = 0x000010, /* List only subscribed mailboxes */ diff --git a/src/plugins/acl/acl-backend-vfile-acllist.c b/src/plugins/acl/acl-backend-vfile-acllist.c index 9dafd22d0b..f7e3547cd6 100644 --- a/src/plugins/acl/acl-backend-vfile-acllist.c +++ b/src/plugins/acl/acl-backend-vfile-acllist.c @@ -252,7 +252,6 @@ acl_backend_vfile_acllist_try_rebuild(struct acl_backend_vfile *backend) backend->rebuilding_acllist = TRUE; iter = mailbox_list_iter_init(list, "*", - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_RETURN_NO_FLAGS); while ((info = mailbox_list_iter_next(iter)) != NULL) { diff --git a/src/plugins/acl/acl-mailbox-list.c b/src/plugins/acl/acl-mailbox-list.c index 085bd77879..b5f429e0c5 100644 --- a/src/plugins/acl/acl-mailbox-list.c +++ b/src/plugins/acl/acl-mailbox-list.c @@ -111,9 +111,7 @@ acl_mailbox_try_list_fast(struct acl_mailbox_list_iterate_context *ctx) return; /* no LOOKUP right by default, we can optimize this */ - if ((ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0) - vname = t_str_new(256); - + vname = t_str_new(256); memset(&update_ctx, 0, sizeof(update_ctx)); update_ctx.iter_ctx = &ctx->ctx; update_ctx.glob = @@ -173,8 +171,7 @@ acl_mailbox_list_iter_init(struct mailbox_list *list, ctx->ctx.flags = flags; inboxcase = (list->ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0; - ctx->sep = (ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0 ? - list->ns->sep : list->ns->real_sep; + ctx->sep = list->ns->sep; ctx->glob = imap_match_init_multiple(default_pool, patterns, inboxcase, ctx->sep); /* see if all patterns have only a single '*' and it's at the end. @@ -225,9 +222,7 @@ acl_mailbox_list_iter_get_name(struct mailbox_list_iterate_context *ctx, struct mail_namespace *ns = ctx->list->ns; unsigned int len; - if ((ctx->flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0) - name = mail_namespace_get_storage_name(ns, name); - + name = mail_namespace_get_storage_name(ns, name); len = strlen(name); if (name[len-1] == ns->real_sep) { /* name ends with separator. this can happen if doing e.g. @@ -256,7 +251,6 @@ iter_mailbox_has_visible_children(struct acl_mailbox_list_iterate_context *ctx, { struct mailbox_list_iterate_context *iter; const struct mailbox_info *info; - enum mailbox_list_iter_flags flags; string_t *pattern; const char *prefix; unsigned int i, prefix_len; @@ -294,9 +288,8 @@ iter_mailbox_has_visible_children(struct acl_mailbox_list_iterate_context *ctx, prefix = str_c(pattern); prefix_len = str_len(pattern) - 1; - flags = (ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) | - MAILBOX_LIST_ITER_RETURN_NO_FLAGS; - iter = mailbox_list_iter_init(ctx->ctx.list, str_c(pattern), flags); + iter = mailbox_list_iter_init(ctx->ctx.list, str_c(pattern), + MAILBOX_LIST_ITER_RETURN_NO_FLAGS); while ((info = mailbox_list_iter_next(iter)) != NULL) { if (only_nonpatterns && imap_match(ctx->glob, info->name) == IMAP_MATCH_YES) { diff --git a/src/plugins/acl/acl-shared-storage.c b/src/plugins/acl/acl-shared-storage.c index b7ca769825..98cea60eb6 100644 --- a/src/plugins/acl/acl-shared-storage.c +++ b/src/plugins/acl/acl-shared-storage.c @@ -51,7 +51,6 @@ acl_shared_namespace_add(struct mail_namespace *ns, /* check if there are any mailboxes really visible to us */ iter = mailbox_list_iter_init(new_ns->list, "*", - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS); while ((info = mailbox_list_iter_next(iter)) != NULL) break; diff --git a/src/plugins/listescape/listescape-plugin.c b/src/plugins/listescape/listescape-plugin.c index 3edaf71a44..b89f6591d7 100644 --- a/src/plugins/listescape/listescape-plugin.c +++ b/src/plugins/listescape/listescape-plugin.c @@ -113,18 +113,16 @@ listescape_mailbox_list_iter_init(struct mailbox_list *list, struct mailbox_list_iterate_context *ctx; const char **escaped_patterns; unsigned int i; - bool vname; /* this is kind of kludgy. In ACL code we want to convert patterns, in maildir renaming code we don't. so for now just use the _RAW_LIST flag.. */ if ((flags & MAILBOX_LIST_ITER_RAW_LIST) == 0) { - vname = (flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0; escaped_patterns = t_new(const char *, str_array_length(patterns) + 1); for (i = 0; patterns[i] != NULL; i++) { escaped_patterns[i] = - list_escape(list->ns, patterns[i], vname); + list_escape(list->ns, patterns[i], TRUE); } patterns = escaped_patterns; } @@ -170,7 +168,7 @@ listescape_mailbox_list_iter_next(struct mailbox_list_iterate_context *ctx) ctx->list->ns->real_sep = ctx->list->hierarchy_sep; info = mlist->module_ctx.super.iter_next(ctx); ctx->list->ns->real_sep = ctx->list->ns->sep; - if (info == NULL || (ctx->flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) == 0) + if (info == NULL) return info; ns = (ctx->flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) == 0 ? diff --git a/src/plugins/quota/quota-count.c b/src/plugins/quota/quota-count.c index d8ba68a790..609421bedc 100644 --- a/src/plugins/quota/quota-count.c +++ b/src/plugins/quota/quota-count.c @@ -81,7 +81,6 @@ quota_count_namespace(struct quota_root *root, struct mail_namespace *ns, int ret = 0; ctx = mailbox_list_iter_init(ns->list, "*", - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS); while ((info = mailbox_list_iter_next(ctx)) != NULL) { if ((info->flags & (MAILBOX_NONEXISTENT | diff --git a/src/plugins/quota/quota-maildir.c b/src/plugins/quota/quota-maildir.c index a823b6bc84..9f66a1ba3c 100644 --- a/src/plugins/quota/quota-maildir.c +++ b/src/plugins/quota/quota-maildir.c @@ -130,7 +130,6 @@ maildir_list_init(struct maildir_quota_root *root, struct mailbox_list *list) ctx->path = str_new(default_pool, 512); ctx->list = list; ctx->iter = mailbox_list_iter_init(list, "*", - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS); return ctx; } diff --git a/src/plugins/virtual/virtual-config.c b/src/plugins/virtual/virtual-config.c index 974cac510e..dca52d9edd 100644 --- a/src/plugins/virtual/virtual-config.c +++ b/src/plugins/virtual/virtual-config.c @@ -264,7 +264,6 @@ static int virtual_config_expand_wildcards(struct virtual_parse_context *ctx) const enum namespace_type iter_ns_types = NAMESPACE_PRIVATE | NAMESPACE_SHARED | NAMESPACE_PUBLIC; const enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_VIRTUAL_NAMES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct mail_user *user = ctx->mbox->storage->storage.user; ARRAY_TYPE(virtual_backend_box) wildcard_boxes, neg_boxes;