dovecot-2.0: lib-storage: Show "foo/" style replies only for IMA...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jul 12 23:15:37 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/9ccfbed9c570
changeset: 11806:9ccfbed9c570
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jul 12 21:15:34 2010 +0100
description:
lib-storage: Show "foo/" style replies only for IMAP LIST command.
Internally those replies just mess up things.

diffstat:

 src/imap/cmd-list.c                         |  1 +
 src/lib-storage/list/mailbox-list-fs-iter.c |  6 ++++++
 src/lib-storage/mailbox-list.h              |  4 ++++
 3 files changed, 11 insertions(+), 0 deletions(-)

diffs (41 lines):

diff -r 0a2dc81ed513 -r 9ccfbed9c570 src/imap/cmd-list.c
--- a/src/imap/cmd-list.c	Mon Jul 12 20:38:47 2010 +0100
+++ b/src/imap/cmd-list.c	Mon Jul 12 21:15:34 2010 +0100
@@ -932,6 +932,7 @@
 		/* non-extended LIST - return children flags always */
 		ctx->list_flags |= MAILBOX_LIST_ITER_RETURN_CHILDREN;
 	}
+	ctx->list_flags |= MAILBOX_LIST_ITER_SHOW_EXISTING_PARENT;
 
 	if (!IMAP_ARG_IS_EOL(args)) {
 		client_send_command_error(cmd, "Extra arguments.");
diff -r 0a2dc81ed513 -r 9ccfbed9c570 src/lib-storage/list/mailbox-list-fs-iter.c
--- a/src/lib-storage/list/mailbox-list-fs-iter.c	Mon Jul 12 20:38:47 2010 +0100
+++ b/src/lib-storage/list/mailbox-list-fs-iter.c	Mon Jul 12 21:15:34 2010 +0100
@@ -517,6 +517,12 @@
 		delayed_send = TRUE;
 	}
 
+	if ((ctx->ctx.flags & MAILBOX_LIST_ITER_SHOW_EXISTING_PARENT) == 0) {
+		/* LIST "" foo/% - we don't want to see foo/ returned */
+		delayed_send = FALSE;
+		match2 = IMAP_MATCH_CHILDREN;
+	}
+
 	if (scan_subdir) {
 		real_path = t_strconcat(ctx->dir->real_path, "/", fname, NULL);
 		ret = list_opendir(ctx, real_path, vpath, &dirp);
diff -r 0a2dc81ed513 -r 9ccfbed9c570 src/lib-storage/mailbox-list.h
--- a/src/lib-storage/mailbox-list.h	Mon Jul 12 20:38:47 2010 +0100
+++ b/src/lib-storage/mailbox-list.h	Mon Jul 12 21:15:34 2010 +0100
@@ -61,6 +61,10 @@
 enum mailbox_list_iter_flags {
 	/* Ignore index file and ACLs (used by ACL plugin internally) */
 	MAILBOX_LIST_ITER_RAW_LIST		= 0x000001,
+	/* When listing "foo/%" and "foo" is an existing mailbox
+	   (maybe \noselect), have LIST also return "foo/" in the replies.
+	   This is needed by IMAP, but messes up internal code. */
+	MAILBOX_LIST_ITER_SHOW_EXISTING_PARENT	= 0x000002,
 	/* Don't list INBOX unless it actually exists */
 	MAILBOX_LIST_ITER_NO_AUTO_INBOX		= 0x000004,
 


More information about the dovecot-cvs mailing list