Mercurial > dovecot > original-hg > dovecot-2.1
changeset 15005:d16e212531ec
imap: Fixed sending LIST-STATUS for selectable namespace prefixes.
Most importantly sending it for INBOX when namespace prefix was also INBOX.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 26 Oct 2013 18:00:07 +0300 |
parents | 9313b0733008 |
children | f572fbafb445 |
files | src/imap/cmd-list.c |
diffstat | 1 files changed, 34 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/cmd-list.c Wed Oct 02 08:02:30 2013 +0300 +++ b/src/imap/cmd-list.c Sat Oct 26 18:00:07 2013 +0300 @@ -344,6 +344,38 @@ } static void +list_send_status(struct cmd_list_context *ctx, const char *name, + const char *mutf7_name, enum mailbox_info_flags flags) +{ + struct imap_status_result result; + struct mail_namespace *ns; + const char *error; + + if ((flags & (MAILBOX_NONEXISTENT | MAILBOX_NOSELECT)) != 0) { + /* doesn't exist, don't even try to get STATUS */ + return; + } + if ((flags & MAILBOX_SUBSCRIBED) == 0 && + (flags & MAILBOX_CHILD_SUBSCRIBED) != 0) { + /* listing subscriptions, but only child is subscribed */ + 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->ns->user->namespaces, name); + if (imap_status_get(ctx->cmd, ns, name, + &ctx->status_items, &result, &error) < 0) { + client_send_line(ctx->cmd->client, + t_strconcat("* ", error, NULL)); + return; + } + + imap_status_send(ctx->cmd->client, mutf7_name, + &ctx->status_items, &result); +} + +static void list_namespace_send_prefix(struct cmd_list_context *ctx, bool have_children) { struct mail_namespace *const *listed; @@ -440,38 +472,9 @@ mailbox_childinfo2str(ctx, str, flags); client_send_line(ctx->cmd->client, str_c(str)); -} -static void -list_send_status(struct cmd_list_context *ctx, const char *name, - const char *mutf7_name, enum mailbox_info_flags flags) -{ - struct imap_status_result result; - struct mail_namespace *ns; - const char *error; - - if ((flags & (MAILBOX_NONEXISTENT | MAILBOX_NOSELECT)) != 0) { - /* doesn't exist, don't even try to get STATUS */ - return; - } - if ((flags & MAILBOX_SUBSCRIBED) == 0 && - (flags & MAILBOX_CHILD_SUBSCRIBED) != 0) { - /* listing subscriptions, but only child is subscribed */ - 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->ns->user->namespaces, name); - if (imap_status_get(ctx->cmd, ns, name, - &ctx->status_items, &result, &error) < 0) { - client_send_line(ctx->cmd->client, - t_strconcat("* ", error, NULL)); - return; - } - - imap_status_send(ctx->cmd->client, mutf7_name, - &ctx->status_items, &result); + if (ctx->used_status) + list_send_status(ctx, name, str_c(mutf7_name), flags); } static bool list_has_empty_prefix_ns(struct mail_user *user)