]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: cmd-list - Make the namespace a parameter for list_send_status()
authorStephan Bosch <stephan.bosch@dovecot.fi>
Tue, 18 Sep 2018 19:19:44 +0000 (21:19 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 25 Feb 2025 11:24:51 +0000 (11:24 +0000)
Before, it was determined internally. This is preparation for adding
infrastructure for dynamically adding support for new RETURN flags.

src/imap/cmd-list.c
src/imap/imap-list.h

index 7e03bc3a958d6af4d750e3d815dc7a23d126668d..eec6fa3d24e67293fdb9dfd62f2f5ae39d867b6c 100644 (file)
@@ -185,7 +185,6 @@ list_send_status(struct cmd_list_context *ctx,
 {
        enum mailbox_info_flags mbox_flags = params->mbox_flags;
        struct imap_status_result result;
-       struct mail_namespace *ns;
 
        if ((mbox_flags & (MAILBOX_NONEXISTENT | MAILBOX_NOSELECT)) != 0) {
                /* doesn't exist, don't even try to get STATUS */
@@ -198,10 +197,7 @@ list_send_status(struct cmd_list_context *ctx,
                return;
        }
 
-       /* if we're listing subscriptions and there are subscriptions=no
-          namespaces, ctx->ns may not point to correct one */
-       ns = mail_namespace_find(ctx->user->namespaces, params->name);
-       if (imap_status_get(ctx->cmd, ns, params->name,
+       if (imap_status_get(ctx->cmd, params->ns, params->name,
                            &ctx->status_items, &result) < 0) {
                client_send_line(ctx->cmd->client,
                                 t_strconcat("* ", result.errstr, NULL));
@@ -265,6 +261,12 @@ static bool cmd_list_continue(struct client_command_context *cmd)
                                .mbox_flags = flags,
                        };
 
+                       /* if we're listing subscriptions and there are
+                          subscriptions=no namespaces, ctx->ns may not point to
+                          correct one */
+                       params.ns = mail_namespace_find(ctx->user->namespaces,
+                                                       params.name);
+
                        T_BEGIN {
                                list_send_status(ctx, &params);
                        } T_END;
index 66b378e93587a45b8f1d73b25c9486da9409f5dc..f1ea12c0d368020a15cc37bf49d17e5f0380b73a 100644 (file)
@@ -6,6 +6,7 @@ struct imap_list_return_flag_params {
        const char *mutf7_name;
 
        enum mailbox_info_flags mbox_flags;
+       struct mail_namespace *ns;
 };
 
 /* Returns TRUE if anything was added to the string. */