From: Stephan Bosch Date: Tue, 18 Sep 2018 19:19:44 +0000 (+0200) Subject: imap: cmd-list - Make the namespace a parameter for list_send_status() X-Git-Tag: 2.4.1~160 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df01e4ff14e831f11404305ef00fd0a14f2e8fab;p=thirdparty%2Fdovecot%2Fcore.git imap: cmd-list - Make the namespace a parameter for list_send_status() Before, it was determined internally. This is preparation for adding infrastructure for dynamically adding support for new RETURN flags. --- diff --git a/src/imap/cmd-list.c b/src/imap/cmd-list.c index 7e03bc3a95..eec6fa3d24 100644 --- a/src/imap/cmd-list.c +++ b/src/imap/cmd-list.c @@ -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, ¶ms); } T_END; diff --git a/src/imap/imap-list.h b/src/imap/imap-list.h index 66b378e935..f1ea12c0d3 100644 --- a/src/imap/imap-list.h +++ b/src/imap/imap-list.h @@ -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. */