changeset 12359:3e59dbe29f81

imap: Fixed LIST-STATUS when listing subscriptions with subscriptions=no namespaces.
author Timo Sirainen <tss@iki.fi>
date Tue, 02 Nov 2010 15:32:47 +0000
parents 4ee632794f0b
children 2b709ff27b3a
files src/imap/cmd-list.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-list.c	Tue Nov 02 14:59:13 2010 +0000
+++ b/src/imap/cmd-list.c	Tue Nov 02 15:32:47 2010 +0000
@@ -327,6 +327,7 @@
 			     enum mailbox_info_flags flags)
 {
 	struct imap_status_result result;
+	struct mail_namespace *ns;
 	const char *storage_name, *error;
 
 	if ((flags & (MAILBOX_NONEXISTENT | MAILBOX_NOSELECT)) != 0) {
@@ -339,8 +340,11 @@
 		return;
 	}
 
-	storage_name = mail_namespace_get_storage_name(ctx->ns, name);
-	if (imap_status_get(ctx->cmd, ctx->ns, storage_name,
+	/* if we're listing subscriptions and there are subscriptions=no
+	   namespaces, ctx->ns may not point to correct one */
+	storage_name = name;
+	ns = mail_namespace_find(ctx->ns->user->namespaces, &storage_name);
+	if (imap_status_get(ctx->cmd, ns, storage_name,
 			    &ctx->status_items, &result, &error) < 0) {
 		client_send_line(ctx->cmd->client,
 				 t_strconcat("* ", error, NULL));