Mercurial > dovecot > core-2.2
changeset 10840:211df1a0646e HEAD
LIST-STATUS: When listing subscriptions, don't return STATUS for unsubscribed parents.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 06 Mar 2010 12:17:13 +0200 |
parents | a342e91e8815 |
children | 1a76670bb50e |
files | src/imap/cmd-list.c |
diffstat | 1 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/cmd-list.c Fri Mar 05 19:25:27 2010 +0200 +++ b/src/imap/cmd-list.c Sat Mar 06 12:17:13 2010 +0200 @@ -325,11 +325,22 @@ client_send_line(ctx->cmd->client, str_c(str)); } -static void list_send_status(struct cmd_list_context *ctx, const char *name) +static void list_send_status(struct cmd_list_context *ctx, const char *name, + enum mailbox_info_flags flags) { struct imap_status_result result; const char *storage_name, *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; + } + storage_name = mail_namespace_get_storage_name(ctx->ns, name); if (imap_status_get(ctx->cmd, ctx->ns, storage_name, &ctx->status_items, &result, &error) < 0) { @@ -400,12 +411,9 @@ mailbox_childinfo2str(ctx, str, flags); ret = client_send_line(ctx->cmd->client, str_c(str)); - if (ctx->used_status && - (flags & (MAILBOX_NONEXISTENT | MAILBOX_NOSELECT)) == 0) { - T_BEGIN { - list_send_status(ctx, name); - } T_END; - } + if (ctx->used_status) T_BEGIN { + list_send_status(ctx, name, flags); + } T_END; if (ret == 0) { /* buffer is full, continue later */ return 0;