dovecot-2.2: imapc: Avoid unnecessarily selecting a mailbox when...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jan 22 12:49:22 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/1706b3490966
changeset: 15670:1706b3490966
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jan 22 12:49:04 2013 +0200
description:
imapc: Avoid unnecessarily selecting a mailbox when looking up its GUID.

diffstat:

 src/lib-storage/index/imapc/imapc-storage.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r be5ce6c06b08 -r 1706b3490966 src/lib-storage/index/imapc/imapc-storage.c
--- a/src/lib-storage/index/imapc/imapc-storage.c	Mon Jan 21 19:45:13 2013 +0200
+++ b/src/lib-storage/index/imapc/imapc-storage.c	Tue Jan 22 12:49:04 2013 +0200
@@ -755,12 +755,11 @@
 	struct imapc_mailbox *mbox = (struct imapc_mailbox *)box;
 	const struct imapc_namespace *ns;
 
-	if (index_mailbox_get_metadata(box, items, metadata_r) < 0)
-		return -1;
 	if ((items & MAILBOX_METADATA_GUID) != 0) {
 		/* a bit ugly way to do this, but better than nothing for now.
 		   FIXME: if indexes are enabled, keep this there. */
 		mail_generate_guid_128_hash(box->name, metadata_r->guid);
+		items &= ~MAILBOX_METADATA_GUID;
 	}
 	if ((items & MAILBOX_METADATA_BACKEND_NAMESPACE) != 0) {
 		if (imapc_mailbox_get_namespaces(mbox->storage) < 0)
@@ -771,6 +770,11 @@
 			metadata_r->backend_ns_prefix = ns->prefix;
 			metadata_r->backend_ns_type = ns->type;
 		}
+		items &= ~MAILBOX_METADATA_BACKEND_NAMESPACE;
+	}
+	if (items != 0) {
+		if (index_mailbox_get_metadata(box, items, metadata_r) < 0)
+			return -1;
 	}
 	return 0;
 }


More information about the dovecot-cvs mailing list