]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: drivers - Remove *_list_iter_next() driver specific code
authorMarco Bettini <marco.bettini@open-xchange.com>
Mon, 21 Jul 2025 12:24:30 +0000 (12:24 +0000)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 28 Jul 2025 18:03:03 +0000 (18:03 +0000)
src/lib-storage/list/mailbox-list-fs-iter.c
src/lib-storage/list/mailbox-list-index-iter.c
src/lib-storage/list/mailbox-list-maildir-iter.c

index ea37f9cb19a25fa80379ecd46104f3da0f1337cb..f4a08d270f36da1889e641be8435fd0b3b3b27d6 100644 (file)
@@ -923,11 +923,6 @@ fs_list_iter_next(struct mailbox_list_iterate_context *_ctx)
                return fs_list_iter_next(_ctx);
        }
 
-       if ((ctx->ctx.flags & MAILBOX_LIST_ITER_RETURN_SUBSCRIBED) != 0) {
-               mailbox_list_set_subscription_flags(ctx->ctx.list,
-                                                   ctx->info.vname,
-                                                   &ctx->info.flags);
-       }
        i_assert(ctx->info.vname != NULL);
        return &ctx->info;
 }
index cb1e1f80e0933f5d8a09ef86e4170a33d3839bb9..c8b0efd0f5192b45d8f8516bad0f301cb7cc4fb3 100644 (file)
@@ -13,12 +13,6 @@ static bool iter_use_index(struct mailbox_list *list,
 {
        struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT_REQUIRE(list);
 
-       if ((flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) {
-               /* for now we don't use indexes when listing subscriptions,
-                  because it needs to list also the nonexistent subscribed
-                  mailboxes, which don't exist in the index. */
-               return FALSE;
-       }
        if ((flags & MAILBOX_LIST_ITER_RAW_LIST) != 0 &&
            ilist->has_backing_store) {
                /* no indexing wanted with raw lists */
@@ -125,13 +119,6 @@ mailbox_list_index_update_info(struct mailbox_list_index_iterate_context *ctx)
        if ((node->flags & MAILBOX_LIST_INDEX_FLAG_NOINFERIORS) != 0)
                ctx->info.flags |= MAILBOX_NOINFERIORS;
 
-       if ((ctx->ctx.flags & (MAILBOX_LIST_ITER_SELECT_SUBSCRIBED |
-                              MAILBOX_LIST_ITER_RETURN_SUBSCRIBED)) != 0) {
-               mailbox_list_set_subscription_flags(ctx->ctx.list,
-                                                   ctx->info.vname,
-                                                   &ctx->info.flags);
-       }
-
        if ((ctx->ctx.flags & MAILBOX_LIST_ITER_RETURN_NO_FLAGS) == 0) {
                box = mailbox_alloc(ctx->ctx.list, ctx->info.vname, 0);
                mailbox_list_index_status_set_info_flags(box, node->uid,
@@ -184,21 +171,6 @@ mailbox_list_index_update_next(struct mailbox_list_index_iterate_context *ctx,
        }
 }
 
-static bool
-iter_subscriptions_ok(struct mailbox_list_index_iterate_context *ctx)
-{
-       if ((ctx->ctx.flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) == 0)
-               return TRUE;
-
-       if ((ctx->info.flags & MAILBOX_SUBSCRIBED) != 0)
-               return TRUE;
-
-       if ((ctx->ctx.flags & MAILBOX_LIST_ITER_SELECT_RECURSIVEMATCH) != 0 &&
-           (ctx->info.flags & MAILBOX_CHILD_SUBSCRIBED) != 0)
-               return TRUE;
-       return FALSE;
-}
-
 const struct mailbox_info *
 mailbox_list_index_iter_next(struct mailbox_list_iterate_context *_ctx)
 {
@@ -222,7 +194,7 @@ mailbox_list_index_iter_next(struct mailbox_list_iterate_context *_ctx)
 
                follow_children = (match & (IMAP_MATCH_YES |
                                            IMAP_MATCH_CHILDREN)) != 0;
-               if (match == IMAP_MATCH_YES && iter_subscriptions_ok(ctx)) {
+               if (match == IMAP_MATCH_YES) {
                        /* If this is a) \NoSelect leaf,
                           b) not mailbox_list_layout=index
                           and c) NO-NOSELECT is set, try to rmdir the leaf
@@ -240,11 +212,6 @@ mailbox_list_index_iter_next(struct mailbox_list_iterate_context *_ctx)
                                mailbox_list_index_update_next(ctx, TRUE);
                                return &ctx->info;
                        }
-               } else if ((_ctx->flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0 &&
-                          (ctx->info.flags & MAILBOX_CHILD_SUBSCRIBED) == 0) {
-                       /* listing only subscriptions, but there are no
-                          subscribed children. */
-                       follow_children = FALSE;
                }
                mailbox_list_index_update_next(ctx, follow_children);
        }
index f47355be204aab4db17ee7da6cd1664d8e45a687..31977f8ed2cb6d222acdc6107e5e290a4610308d 100644 (file)
@@ -448,30 +448,14 @@ maildir_list_iter_init(struct mailbox_list *_list, const char *const *patterns,
        else
                ctx->dir = _list->mail_set->mail_path;
 
-       if ((flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) {
-               /* Listing only subscribed mailboxes.
-                  Flags are set later if needed. */
-               bool default_nonexistent =
-                       (flags & MAILBOX_LIST_ITER_RETURN_NO_FLAGS) == 0;
-
-               mailbox_list_subscriptions_fill(&ctx->ctx, ctx->tree_ctx,
-                                               default_nonexistent);
-       }
-
-       if ((flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) == 0 ||
-           (flags & MAILBOX_LIST_ITER_RETURN_NO_FLAGS) == 0) {
+       T_BEGIN {
                /* Add/update mailbox list with flags */
-               bool update_only =
-                       (flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0;
+               ret = maildir_fill_readdir(ctx, ctx->ctx.glob, FALSE);
+       } T_END;
 
-               T_BEGIN {
-                       ret = maildir_fill_readdir(ctx, ctx->ctx.glob,
-                                                  update_only);
-               } T_END;
-               if (ret < 0) {
-                       ctx->ctx.failed = TRUE;
-                       return &ctx->ctx;
-               }
+       if (ret < 0) {
+               ctx->ctx.failed = TRUE;
+               return &ctx->ctx;
        }
 
        ctx->tree_iter = mailbox_tree_iterate_init(ctx->tree_ctx, NULL,
@@ -513,12 +497,5 @@ maildir_list_iter_next(struct mailbox_list_iterate_context *_ctx)
                ctx->info.flags &= ENUM_NEGATE(MAILBOX_NOCHILDREN);
                ctx->info.flags |= MAILBOX_NOINFERIORS;
        }
-       if ((_ctx->flags & MAILBOX_LIST_ITER_RETURN_SUBSCRIBED) != 0 &&
-           (_ctx->flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) == 0) {
-               /* we're listing all mailboxes but we want to know
-                  \Subscribed flags */
-               mailbox_list_set_subscription_flags(_ctx->list, ctx->info.vname,
-                                                   &ctx->info.flags);
-       }
        return &ctx->info;
 }