[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dovecot-cvs
Subject:    dovecot-2.2: lib-storage: Fixed support for list=no prefix="" li...
From:       dovecot () dovecot ! org (dovecot at dovecot ! org)
Date:       2014-02-24 18:31:24
Message-ID: hg.fad7f879caa1.1393266684.6920021320469856403 () talvi
[Download RAW message or body]

details:   http://hg.dovecot.org/dovecot-2.2/rev/fad7f879caa1
changeset: 17151:fad7f879caa1
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Feb 24 12:30:51 2014 -0600
description:
lib-storage: Fixed support for list=no prefix="" listing.
This behavior works with e.g. Outlook where it's allowed to CREATE and LIST
the Sent/Trash/etc mailboxes to root level, even though the primary
namespace has a prefix.

diffstat:

 src/lib-storage/list/mailbox-list-iter.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 2397adb8c1bd -r fad7f879caa1 src/lib-storage/list/mailbox-list-iter.c
--- a/src/lib-storage/list/mailbox-list-iter.c	Mon Feb 24 11:29:52 2014 -0600
+++ b/src/lib-storage/list/mailbox-list-iter.c	Mon Feb 24 12:30:51 2014 -0600
@@ -239,6 +239,15 @@
 	return FALSE;
 }
 
+static bool list_pattern_has_wildcards(const char *pattern)
+{
+	for (; *pattern != '\0'; pattern++) {
+		if (*pattern == '%' || *pattern == '*')
+			return TRUE;
+	}
+	return FALSE;
+}
+
 static bool ns_match_next(struct ns_list_iterate_context *ctx, 
 			  struct mail_namespace *ns, const char *pattern)
 {
@@ -256,8 +265,13 @@
 		/* non-listable namespace matches only with exact prefix */
 		if (strncmp(ns->prefix, pattern, ns->prefix_len) != 0)
 			return FALSE;
-		/* prefix="" list=no is never listed */
-		if (ns->prefix_len == 0)
+		/* with prefix="", list=no we don't want to show anything,
+		   except when the client explicitly lists a mailbox without
+		   wildcards (e.g. LIST "" mailbox). this is mainly useful
+		   for working around client bugs (and supporting a specific
+		   IMAP client behavior that's not exactly buggy but not very
+		   good IMAP behavior either). */
+		if (ns->prefix_len == 0 && list_pattern_has_wildcards(pattern))
 			return FALSE;
 	}
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic