From: Timo Sirainen Date: Sat, 6 Mar 2010 10:17:13 +0000 (+0200) Subject: LIST-STATUS: When listing subscriptions, don't return STATUS for unsubscribed parents. X-Git-Tag: 2.0.beta4~128 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a959856efd1ed4c40fd5096910d43a2d9e7900a2;p=thirdparty%2Fdovecot%2Fcore.git LIST-STATUS: When listing subscriptions, don't return STATUS for unsubscribed parents. --HG-- branch : HEAD --- diff --git a/src/imap/cmd-list.c b/src/imap/cmd-list.c index 2c4bd55894..df4bcbf518 100644 --- a/src/imap/cmd-list.c +++ b/src/imap/cmd-list.c @@ -325,11 +325,22 @@ list_namespace_send_prefix(struct cmd_list_context *ctx, bool have_children) 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 @@ list_namespace_mailboxes(struct cmd_list_context *ctx) 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;