dovecot-2.1: lib-storage: Fixed mailbox_list_mailbox() for backe...

dovecot at dovecot.org dovecot at dovecot.org
Mon Sep 12 12:41:17 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/84e31a32293e
changeset: 13443:84e31a32293e
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Sep 12 12:40:34 2011 +0300
description:
lib-storage: Fixed mailbox_list_mailbox() for backends without get_mailbox_flags().

diffstat:

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

diffs (34 lines):

diff -r 7669862d95e7 -r 84e31a32293e src/lib-storage/mailbox-list.c
--- a/src/lib-storage/mailbox-list.c	Mon Sep 12 12:38:04 2011 +0300
+++ b/src/lib-storage/mailbox-list.c	Mon Sep 12 12:40:34 2011 +0300
@@ -1314,13 +1314,26 @@
 		return 1;
 	}
 
+	if (list->v.get_mailbox_flags == NULL) {
+		/* can't do this optimized. do it the slow way. */
+		struct mailbox_list_iterate_context *iter;
+		const struct mailbox_info *info;
+		const char *vname;
+
+		vname = mailbox_list_get_vname(list, name);
+		iter = mailbox_list_iter_init(list, vname, 0);
+		info = mailbox_list_iter_next(iter);
+		if (info == NULL)
+			*flags_r = MAILBOX_NONEXISTENT;
+		else
+			*flags_r = info->flags;
+		return mailbox_list_iter_deinit(&iter);
+	}
+
 	rootdir = mailbox_list_get_path(list, NULL,
 					MAILBOX_LIST_PATH_TYPE_MAILBOX);
+	i_assert(rootdir != NULL);
 	path = mailbox_list_get_path(list, name, MAILBOX_LIST_PATH_TYPE_DIR);
-	if (rootdir == NULL) {
-		/* shouldn't happen with anything except shared mailboxes */
-		return 0;
-	}
 
 	fname = strrchr(path, '/');
 	if (fname == NULL) {


More information about the dovecot-cvs mailing list