changeset 2364:974b0478a548 HEAD

fix
author Timo Sirainen <tss@iki.fi>
date Mon, 26 Jul 2004 18:27:37 +0300
parents 8b0d9d6444be
children 979af608d7c4
files src/imap/cmd-list.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-list.c	Mon Jul 26 17:49:01 2004 +0300
+++ b/src/imap/cmd-list.c	Mon Jul 26 18:27:37 2004 +0300
@@ -79,7 +79,7 @@
 static int
 list_namespace_mailboxes(struct client *client, struct imap_match_glob *glob,
 			 struct namespace *ns, struct mailbox_list_context *ctx,
-			 enum mailbox_list_flags list_flags)
+			 int match_inbox, enum mailbox_list_flags list_flags)
 {
 	struct mailbox_list *list;
 	const char *name;
@@ -126,8 +126,9 @@
 	}
 	t_pop();
 
-	if (!inbox_found && ns->inbox) {
+	if (!inbox_found && ns->inbox && match_inbox) {
 		/* INBOX always exists */
+		str_truncate(str, 0);
 		str_printfa(str, "* LIST () \"%s\" \"INBOX\"", ns->sep_str);
 		client_send_line(client, str_c(str));
 	}
@@ -161,7 +162,7 @@
 	enum imap_match_result match;
 	const char *cur_prefix, *cur_ref, *cur_mask;
 	size_t len;
-	int inbox;
+	int inbox, match_inbox;
 
 	inbox = strncasecmp(ref, "INBOX", 5) == 0 ||
 		(*ref == '\0' && strncasecmp(mask, "INBOX", 5) == 0);
@@ -189,6 +190,7 @@
 
 		glob = imap_match_init(pool_datastack_create(), mask,
 				       inbox && cur_ref == ref, ns->sep);
+		match_inbox = imap_match(glob, "INBOX") == IMAP_MATCH_YES;
 
 		if (*cur_ref != '\0' || *cur_prefix == '\0')
 			match = IMAP_MATCH_CHILDREN;
@@ -256,6 +258,7 @@
 							     cur_ref, cur_mask,
 							     list_flags);
 			if (list_namespace_mailboxes(client, glob, ns, ctx,
+						     match_inbox,
 						     list_flags) < 0) {
 				client_send_storage_error(client, ns->storage);
 				t_pop();