dovecot-2.0: LIST-STATUS: When listing subscriptions, don't retu...

dovecot at dovecot.org dovecot at dovecot.org
Sat Mar 6 12:17:19 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/211df1a0646e
changeset: 10840:211df1a0646e
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Mar 06 12:17:13 2010 +0200
description:
LIST-STATUS: When listing subscriptions, don't return STATUS for unsubscribed parents.

diffstat:

 src/imap/cmd-list.c |  22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diffs (43 lines):

diff -r a342e91e8815 -r 211df1a0646e src/imap/cmd-list.c
--- 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;


More information about the dovecot-cvs mailing list