changeset 4639:47531abcf691 HEAD

Handle INBOX-prefixed namespaces better. Avoid duplicate INBOX replies if namespace prefix is given.
author Timo Sirainen <tss@iki.fi>
date Mon, 09 Oct 2006 00:42:38 +0300
parents 689a02ca02d3
children f5772851ac91
files src/imap/cmd-list.c
diffstat 1 files changed, 7 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-list.c	Mon Oct 09 00:25:15 2006 +0300
+++ b/src/imap/cmd-list.c	Mon Oct 09 00:42:38 2006 +0300
@@ -144,7 +144,8 @@
 			if (ctx->glob != NULL &&
 			    imap_match(ctx->glob, name) != IMAP_MATCH_YES)
 				continue;
-		} else if (strcasecmp(name, "INBOX") == 0) {
+		}
+		if (strcasecmp(name, "INBOX") == 0) {
 			if (!ctx->ns->inbox)
 				continue;
 
@@ -303,22 +304,16 @@
 		if (match < 0)
 			return;
 
+		len = strlen(ns->prefix);
 		if (match == IMAP_MATCH_YES &&
-		    (ctx->list_flags & MAILBOX_LIST_SUBSCRIBED) == 0) {
+		    (ctx->list_flags & MAILBOX_LIST_SUBSCRIBED) == 0 &&
+		    (!ctx->ns->inbox ||
+		     strncmp(ns->prefix, "INBOX", len-1) != 0)) {
 			/* The prefix itself matches */
                         enum mailbox_flags flags;
 			string_t *str = t_str_new(128);
 
-			len = strlen(ns->prefix);
-			if (strncmp(ns->prefix, "INBOX", len-1) == 0) {
-				/* FIXME: INBOX prefix - we should get real
-				   mailbox flags.. */
-				flags = MAILBOX_CHILDREN;
-				ctx->inbox_found = TRUE;
-			} else {
-				flags = MAILBOX_PLACEHOLDER;
-			}
-
+			flags = MAILBOX_PLACEHOLDER;
 			str_printfa(str, "* LIST (%s) \"%s\" ",
 				    mailbox_flags2str(flags, ctx->list_flags),
 				    ns->sep_str);