dovecot-2.1: imap: Fixed sending LIST-STATUS for selectable name...

dovecot at dovecot.org dovecot at dovecot.org
Sat Oct 26 18:00:29 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.1/rev/d16e212531ec
changeset: 15005:d16e212531ec
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Oct 26 18:00:07 2013 +0300
description:
imap: Fixed sending LIST-STATUS for selectable namespace prefixes.
Most importantly sending it for INBOX when namespace prefix was also INBOX.

diffstat:

 src/imap/cmd-list.c |  65 +++++++++++++++++++++++++++-------------------------
 1 files changed, 34 insertions(+), 31 deletions(-)

diffs (83 lines):

diff -r 9313b0733008 -r d16e212531ec src/imap/cmd-list.c
--- 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)


More information about the dovecot-cvs mailing list