From: Timo Sirainen Date: Sun, 31 Aug 2008 10:03:24 +0000 (+0300) Subject: If imap.envelope is cached, use it instead of rebuilding it. X-Git-Tag: 1.2.alpha1~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3889d05019a072a602f7a8c1eeb8a6f1c1362720;p=thirdparty%2Fdovecot%2Fcore.git If imap.envelope is cached, use it instead of rebuilding it. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/index-mail-headers.c b/src/lib-storage/index/index-mail-headers.c index f523edbd9d..23687a47f7 100644 --- a/src/lib-storage/index/index-mail-headers.c +++ b/src/lib-storage/index/index-mail-headers.c @@ -447,9 +447,20 @@ imap_envelope_parse_callback(struct message_header_line *hdr, int index_mail_headers_get_envelope(struct index_mail *mail) { + const unsigned int cache_field_envelope = + mail->ibox->cache_fields[MAIL_CACHE_IMAP_ENVELOPE].idx; struct mailbox_header_lookup_ctx *header_ctx; struct istream *stream; uoff_t old_offset; + string_t *str; + + str = str_new(mail->data_pool, 256); + if (mail_cache_lookup_field(mail->trans->cache_view, str, + mail->data.seq, cache_field_envelope) > 0) { + mail->data.envelope = str_c(str); + return 0; + } + str_free(&str); old_offset = mail->data.stream == NULL ? 0 : mail->data.stream->v_offset;