changeset 5104:ffd9df333232 HEAD

If namespace has a prefix and inbox=no, don't list prefix.inbox if it happens to exist when listing for %.
author Timo Sirainen <tss@iki.fi>
date Mon, 05 Feb 2007 16:15:56 +0200
parents 050549cfaa25
children 342429974bf5
files src/imap/cmd-list.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-list.c	Mon Feb 05 15:07:26 2007 +0200
+++ b/src/imap/cmd-list.c	Mon Feb 05 16:15:56 2007 +0200
@@ -220,6 +220,7 @@
 	const char *cur_ns_prefix, *cur_ref, *cur_mask;
 	enum imap_match_result match;
 	enum imap_match_result inbox_match;
+	enum mailbox_list_flags list_flags;
 	struct mailbox_list *list;
 	struct imap_match_glob *inbox_glob;
 	unsigned int count;
@@ -269,7 +270,8 @@
 	inbox_glob = imap_match_init(cmd->pool,
 				     t_strconcat(ctx->ref, ctx->mask, NULL),
 				     TRUE, ns->sep);
-	inbox_match = imap_match(inbox_glob, "INBOX");
+	inbox_match = *ns->prefix == '\0' || ns->inbox ?
+		imap_match(inbox_glob, "INBOX") : FALSE;
 	ctx->match_inbox = inbox_match == IMAP_MATCH_YES;
 
 	ctx->glob = imap_match_init(cmd->pool, ctx->mask,
@@ -377,10 +379,13 @@
 	cur_ref = namespace_fix_sep(ns, cur_ref);
 	cur_mask = namespace_fix_sep(ns, cur_mask);
 
+	list_flags = ctx->list_flags;
+	if (ctx->match_inbox)
+		list_flags |= MAILBOX_LIST_FLAG_INBOX;
+
 	list = mail_storage_get_list(ns->storage);
 	cur_mask = mailbox_list_join_refmask(list, cur_ref, cur_mask);
-	ctx->list_iter = mailbox_list_iter_init(list, cur_mask,
-						ctx->list_flags);
+	ctx->list_iter = mailbox_list_iter_init(list, cur_mask, list_flags);
 }
 
 static bool cmd_list_continue(struct client_command_context *cmd)