dovecot-1.2: If imap.envelope is cached, use it instead of rebui...

dovecot at dovecot.org dovecot at dovecot.org
Sun Aug 31 13:03:28 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/f942af88598b
changeset: 8139:f942af88598b
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Aug 31 13:03:24 2008 +0300
description:
If imap.envelope is cached, use it instead of rebuilding it.

diffstat:

1 file changed, 11 insertions(+)
src/lib-storage/index/index-mail-headers.c |   11 +++++++++++

diffs (24 lines):

diff -r e459274fc83f -r f942af88598b src/lib-storage/index/index-mail-headers.c
--- a/src/lib-storage/index/index-mail-headers.c	Sun Aug 31 13:02:58 2008 +0300
+++ b/src/lib-storage/index/index-mail-headers.c	Sun Aug 31 13:03:24 2008 +0300
@@ -447,9 +447,20 @@ imap_envelope_parse_callback(struct mess
 
 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;


More information about the dovecot-cvs mailing list