dovecot-1.2: Shared Maildirs: Fixes to listing INBOX.

dovecot at dovecot.org dovecot at dovecot.org
Fri Apr 3 01:14:57 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/aef90950d50b
changeset: 8898:aef90950d50b
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 02 18:14:51 2009 -0400
description:
Shared Maildirs: Fixes to listing INBOX.
Based on patch by Bernhard Herzog.

diffstat:

2 files changed, 13 insertions(+), 16 deletions(-)
src/lib-storage/list/mailbox-list-maildir-iter.c |   26 +++++++++-------------
src/lib-storage/mail-namespace.c                 |    3 +-

diffs (59 lines):

diff -r 23ee853569e6 -r aef90950d50b src/lib-storage/list/mailbox-list-maildir-iter.c
--- a/src/lib-storage/list/mailbox-list-maildir-iter.c	Thu Apr 02 18:13:50 2009 -0400
+++ b/src/lib-storage/list/mailbox-list-maildir-iter.c	Thu Apr 02 18:14:51 2009 -0400
@@ -235,31 +235,27 @@ maildir_fill_readdir(struct maildir_list
 	}
 
 	if ((ns->flags & NAMESPACE_FLAG_INBOX) != 0) {
-		/* make sure INBOX is there */
+		/* make sure INBOX is listed */
+		if (!virtual_names)
+			mailbox_name = "INBOX";
+		else {
+			mailbox_name = mail_namespace_get_vname(ns, mailbox,
+								"INBOX");
+		}
+
 		created = FALSE;
 		node = update_only ?
-			mailbox_tree_lookup(ctx->tree_ctx, "INBOX") :
-			mailbox_tree_get(ctx->tree_ctx, "INBOX", &created);
+			mailbox_tree_lookup(ctx->tree_ctx, mailbox_name) :
+			mailbox_tree_get(ctx->tree_ctx, mailbox_name, &created);
 		if (created)
 			node->flags = MAILBOX_NOCHILDREN;
 		else if (node != NULL)
 			node->flags &= ~MAILBOX_NONEXISTENT;
 
-		match = imap_match(glob, "INBOX");
+		match = imap_match(glob, mailbox_name);
 		if ((match & (IMAP_MATCH_YES | IMAP_MATCH_PARENT)) != 0) {
 			if (!update_only)
 				node->flags |= MAILBOX_MATCHED;
-		}
-	} else if (mailbox_tree_lookup(ctx->tree_ctx, "INBOX") == NULL &&
-		   imap_match(glob, "INBOX") == IMAP_MATCH_YES) {
-		/* see if INBOX exists. */
-		ret = ctx->ctx.list->v.
-			iter_is_mailbox(&ctx->ctx, ctx->dir, "", "INBOX",
-					MAILBOX_LIST_FILE_TYPE_UNKNOWN, &flags);
-		if (ret > 0) {
-			node = mailbox_tree_get(ctx->tree_ctx,
-				t_strconcat(ns->prefix, "INBOX", NULL), NULL);
-			node->flags = MAILBOX_NOCHILDREN | MAILBOX_MATCHED;
 		}
 	}
 	return 0;
diff -r 23ee853569e6 -r aef90950d50b src/lib-storage/mail-namespace.c
--- a/src/lib-storage/mail-namespace.c	Thu Apr 02 18:13:50 2009 -0400
+++ b/src/lib-storage/mail-namespace.c	Thu Apr 02 18:14:51 2009 -0400
@@ -348,7 +348,8 @@ const char *mail_namespace_get_vname(str
 {
 	str_truncate(dest, 0);
 	if ((ns->flags & NAMESPACE_FLAG_INBOX) == 0 ||
-	    strcasecmp(name, "INBOX") != 0)
+	    strcasecmp(name, "INBOX") != 0 ||
+	    ns->user != ns->owner)
 		str_append(dest, ns->prefix);
 
 	for (; *name != '\0'; name++) {


More information about the dovecot-cvs mailing list