dovecot-2.0: imap: LIST now handles better if INBOX is in a diff...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 28 20:30:58 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/4faaf5b037d5
changeset: 11427:4faaf5b037d5
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 28 18:30:55 2010 +0100
description:
imap: LIST now handles better if INBOX is in a different namespace than prefix=""

diffstat:

 src/imap/cmd-list.c |  21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diffs (47 lines):

diff -r f9d1059f81ce -r 4faaf5b037d5 src/imap/cmd-list.c
--- a/src/imap/cmd-list.c	Fri May 28 18:12:05 2010 +0100
+++ b/src/imap/cmd-list.c	Fri May 28 18:30:55 2010 +0100
@@ -16,6 +16,7 @@
 	const char *const *patterns;
 	enum mailbox_list_iter_flags list_flags;
 	struct imap_status_items status_items;
+	enum mailbox_info_flags inbox_flags;
 
 	struct mail_namespace *ns;
 	struct mailbox_list_iterate_context *list_iter;
@@ -348,6 +349,15 @@
 	imap_status_send(ctx->cmd->client, name, &ctx->status_items, &result);
 }
 
+static bool list_has_empty_prefix_ns(struct mail_user *user)
+{
+	struct mail_namespace *ns;
+
+	ns = mail_namespace_find_prefix(user->namespaces, "");
+	return ns != NULL && (ns->flags & (NAMESPACE_FLAG_LIST_PREFIX |
+					   NAMESPACE_FLAG_LIST_CHILDREN)) != 0;
+}
+
 static int
 list_namespace_mailboxes(struct cmd_list_context *ctx)
 {
@@ -374,8 +384,19 @@
 				   and we're now listing prefixless namespace
 				   that contains INBOX. There's no way we can
 				   show this mailbox. */
+				ctx->inbox_flags = flags &
+					(MAILBOX_CHILDREN|MAILBOX_NOCHILDREN);
 				continue;
 			}
+
+			if (*info->ns->prefix != '\0' &&
+			    list_has_empty_prefix_ns(info->ns->user)) {
+				/* INBOX is in its own namespace, while a
+				   namespace with prefix="" has its children. */
+				flags &= ~(MAILBOX_CHILDREN|MAILBOX_NOCHILDREN|
+					   MAILBOX_NOINFERIORS);
+				flags |= ctx->inbox_flags;
+			}
 			ctx->inbox_found = TRUE;
 		}
 		if (ctx->cur_ns_send_prefix)


More information about the dovecot-cvs mailing list