dovecot-2.2: mbox: Fixed listing mailboxes under INBOX directory.

dovecot at dovecot.org dovecot at dovecot.org
Thu Aug 30 22:05:17 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/b8173f8a1447
changeset: 14992:b8173f8a1447
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Aug 23 22:21:42 2012 +0300
description:
mbox: Fixed listing mailboxes under INBOX directory.

diffstat:

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

diffs (48 lines):

diff -r 9d35aca14c81 -r b8173f8a1447 src/lib-storage/list/mailbox-list-fs-iter.c
--- a/src/lib-storage/list/mailbox-list-fs-iter.c	Thu Aug 23 21:29:40 2012 +0300
+++ b/src/lib-storage/list/mailbox-list-fs-iter.c	Thu Aug 23 22:21:42 2012 +0300
@@ -49,6 +49,7 @@
 	struct list_dir_context *dir;
 
 	unsigned int inbox_found:1;
+	unsigned int inbox_has_children:1;
 	unsigned int list_inbox_inbox:1;
 };
 
@@ -584,9 +585,13 @@
 		return FALSE;
 
 	inbox_flags_set(ctx, 0);
-	/* we got here because we didn't see INBOX among other mailboxes,
-	   which means it has no children. */
-	ctx->info.flags |= MAILBOX_NOCHILDREN;
+	if (ctx->inbox_has_children)
+		ctx->info.flags |= MAILBOX_CHILDREN;
+	else {
+		/* we got here because we didn't see INBOX among other mailboxes,
+		   which means it has no children. */
+		ctx->info.flags |= MAILBOX_NOCHILDREN;
+	}
 	return TRUE;
 }
 
@@ -651,10 +656,18 @@
 	    (ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0) {
 		/* either this is user's INBOX, or it's a naming conflict */
 		if (!list_file_is_any_inbox(ctx, storage_name)) {
-			if (subdir != NULL) {
+			if (subdir == NULL) {
+				/* no children */
+			} else if ((ctx->ctx.list->flags &
+				    MAILBOX_LIST_FLAG_MAILBOX_FILES) == 0) {
 				/* skip its children also */
 				ctx->dir = dir;
 				pool_unref(&subdir->pool);
+			} else if ((ctx->info.flags & MAILBOX_NOINFERIORS) == 0) {
+				/* INBOX itself is \NoInferiors, but this INBOX
+				   is a directory, and we can make INBOX have
+				   children using it. */
+				ctx->inbox_has_children = TRUE;
 			}
 			return 0;
 		}


More information about the dovecot-cvs mailing list