dovecot-2.1: layout=fs: Fixed listing mailboxes with prefix=INBOX/

dovecot at dovecot.org dovecot at dovecot.org
Fri Apr 20 15:26:56 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/8d0b71fb3e49
changeset: 14454:8d0b71fb3e49
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Apr 20 15:26:43 2012 +0300
description:
layout=fs: Fixed listing mailboxes with prefix=INBOX/

diffstat:

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

diffs (41 lines):

diff -r a41f64348d0d -r 8d0b71fb3e49 src/lib-storage/list/mailbox-list-fs-iter.c
--- a/src/lib-storage/list/mailbox-list-fs-iter.c	Fri Apr 20 15:18:14 2012 +0300
+++ b/src/lib-storage/list/mailbox-list-fs-iter.c	Fri Apr 20 15:26:43 2012 +0300
@@ -371,11 +371,12 @@
 
 static void fs_list_get_roots(struct fs_list_iterate_context *ctx)
 {
+	struct mail_namespace *ns = ctx->ctx.list->ns;
+	char ns_sep = mail_namespace_get_sep(ns);
 	bool full_fs_access =
 		ctx->ctx.list->mail_set->mail_full_filesystem_access;
-	char ns_sep = mail_namespace_get_sep(ctx->ctx.list->ns);
 	const char *const *patterns, *pattern, *const *parentp, *const *childp;
-	const char *p, *last, *root;
+	const char *p, *last, *root, *prefix_vname;
 	unsigned int i, parentlen;
 
 	i_assert(*ctx->valid_patterns != NULL);
@@ -391,11 +392,20 @@
 			if (*p == ns_sep)
 				last = p;
 		}
+		prefix_vname = t_strdup_until(pattern, last);
+
 		if (p == last+1 && *pattern == ns_sep)
 			root = "/";
-		else {
+		else if ((ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0 &&
+			 strcasecmp(prefix_vname, "INBOX") == 0 &&
+			 strncasecmp(ns->prefix, pattern, ns->prefix_len) == 0) {
+			/* special case: Namespace prefix is INBOX/ and
+			   we just want to see its contents (not the
+			   INBOX's children). */
+			root = "";
+		} else {
 			root = mailbox_list_get_storage_name(ctx->ctx.list,
-						t_strdup_until(pattern, last));
+							     prefix_vname);
 		}
 
 		if (*root == '/') {


More information about the dovecot-cvs mailing list