dovecot-2.2: lib-storage: mailbox_get_metadata() now opens the m...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jul 3 12:28:21 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/af665736536c
changeset: 17576:af665736536c
user: Timo Sirainen <tss at iki.fi>
date: Thu Jul 03 15:26:32 2014 +0300
description:
lib-storage: mailbox_get_metadata() now opens the mailbox only if it's necessary.
diffstat:
src/lib-storage/index/index-status.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diffs (32 lines):
diff -r abf049058125 -r af665736536c src/lib-storage/index/index-status.c
--- a/src/lib-storage/index/index-status.c Thu Jul 03 14:54:43 2014 +0300
+++ b/src/lib-storage/index/index-status.c Thu Jul 03 15:26:32 2014 +0300
@@ -375,6 +375,17 @@
enum mailbox_metadata_items items,
struct mailbox_metadata *metadata_r)
{
+ /* handle items that don't require opening the mailbox */
+ if ((items & MAILBOX_METADATA_BACKEND_NAMESPACE) != 0) {
+ metadata_r->backend_ns_prefix = "";
+ metadata_r->backend_ns_type =
+ mailbox_list_get_namespace(box->list)->type;
+ items &= ~MAILBOX_METADATA_BACKEND_NAMESPACE;
+ }
+ if (items == 0)
+ return 0;
+
+ /* handle items that require opening the mailbox */
if (!box->opened) {
if (mailbox_open(box) < 0)
return -1;
@@ -392,10 +403,5 @@
get_metadata_cache_fields(box, metadata_r);
if ((items & MAILBOX_METADATA_PRECACHE_FIELDS) != 0)
get_metadata_precache_fields(box, metadata_r);
- if ((items & MAILBOX_METADATA_BACKEND_NAMESPACE) != 0) {
- metadata_r->backend_ns_prefix = "";
- metadata_r->backend_ns_type =
- mailbox_list_get_namespace(box->list)->type;
- }
return 0;
}
More information about the dovecot-cvs
mailing list