From 3889d05019a072a602f7a8c1eeb8a6f1c1362720 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 31 Aug 2008 13:03:24 +0300 Subject: [PATCH] If imap.envelope is cached, use it instead of rebuilding it. --HG-- branch : HEAD --- src/lib-storage/index/index-mail-headers.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; -- 2.47.3