diff src/imap/cmd-list.c @ 9021:e36a9edb5fb0 HEAD

Allow prefix="" namespace to have list=no and make it work in a somewhat useful way. Based on patch by Mark Washenberger.
author Timo Sirainen <tss@iki.fi>
date Sat, 09 May 2009 15:02:37 -0400
parents 163c3f85a3aa
children db2fdf3529ac
line wrap: on
line diff
--- a/src/imap/cmd-list.c	Sat May 09 12:28:33 2009 -0400
+++ b/src/imap/cmd-list.c	Sat May 09 15:02:37 2009 -0400
@@ -570,8 +570,17 @@
 
 	skip_namespace_prefix_pattern(ctx, &cur_ns_prefix,
 				      cur_ref, &cur_pattern);
-	if (*cur_ns_prefix == '\0')
-		return TRUE;
+	if (*cur_ns_prefix == '\0') {
+		/* no namespace prefix: if list=no we don't want to show
+		   anything, except when the client does e.g. LIST "" mailbox.
+		   prefix="", list=no namespace is mainly useful for working
+		   around client bugs. */
+		if ((ns->flags & NAMESPACE_FLAG_LIST_PREFIX) == 0 &&
+		    list_pattern_has_wildcards(cur_pattern))
+			return FALSE;
+		else
+			return TRUE;
+	}
 
 	/* namespace prefix still wasn't completely skipped over.
 	   for example cur_ns_prefix=INBOX/, pattern=%/% or pattern=IN%.