dovecot-1.2: Allow prefix="" namespace to have list=no and make ...

dovecot at dovecot.org dovecot at dovecot.org
Sat May 9 22:02:43 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/e36a9edb5fb0
changeset: 9021:e36a9edb5fb0
user:      Timo Sirainen <tss at iki.fi>
date:      Sat May 09 15:02:37 2009 -0400
description:
Allow prefix="" namespace to have list=no and make it work in a somewhat useful way.
Based on patch by Mark Washenberger.

diffstat:

2 files changed, 11 insertions(+), 8 deletions(-)
src/imap/cmd-list.c              |   13 +++++++++++--
src/lib-storage/mail-namespace.c |    6 ------

diffs (39 lines):

diff -r a6779d086785 -r e36a9edb5fb0 src/imap/cmd-list.c
--- 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 @@ list_namespace_match_pattern(struct cmd_
 
 	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%.
diff -r a6779d086785 -r e36a9edb5fb0 src/lib-storage/mail-namespace.c
--- a/src/lib-storage/mail-namespace.c	Sat May 09 12:28:33 2009 -0400
+++ b/src/lib-storage/mail-namespace.c	Sat May 09 15:02:37 2009 -0400
@@ -165,12 +165,6 @@ static bool namespaces_check(struct mail
 				return FALSE;
 			}
 		}
-		if (*ns->prefix == '\0' &&
-		    (ns->flags & NAMESPACE_FLAG_LIST_PREFIX) == 0) {
-			i_error("namespace configuration error: "
-				"Empty prefix requires list=yes");
-			return FALSE;
-		}
 		if ((ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) != 0)
 			subscriptions_count++;
 	}


More information about the dovecot-cvs mailing list