dovecot-1.1: mail_set_seq(): Don't open input stream immediately...

dovecot at dovecot.org dovecot at dovecot.org
Tue Dec 16 06:07:54 EET 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/e7bb92a42ca9
changeset: 8051:e7bb92a42ca9
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Dec 16 06:07:48 2008 +0200
description:
mail_set_seq(): Don't open input stream immediately if message hasn't been saved yet.

diffstat:

1 file changed, 6 insertions(+), 1 deletion(-)
src/lib-storage/index/index-mail.c |    7 ++++++-

diffs (24 lines):

diff -r d178293dde50 -r e7bb92a42ca9 src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c	Tue Dec 16 05:30:13 2008 +0200
+++ b/src/lib-storage/index/index-mail.c	Tue Dec 16 06:07:48 2008 +0200
@@ -1152,6 +1152,7 @@ void index_mail_set_seq(struct mail *_ma
 	struct index_mail_data *data = &mail->data;
 	struct mail_cache_field *cache_fields = mail->ibox->cache_fields;
         struct mail_cache_view *cache_view = mail->trans->cache_view;
+	const struct mail_index_header *hdr;
 	const struct mail_index_record *rec;
 	struct istream *input;
 
@@ -1260,7 +1261,11 @@ void index_mail_set_seq(struct mail *_ma
 		if ((mail->wanted_fields & MAIL_FETCH_STREAM_BODY) != 0)
 			data->access_part |= READ_BODY;
 
-		(void)mail_get_stream(_mail, NULL, NULL, &input);
+		/* open the stream only if we didn't get here from
+		   mailbox_save_init() */
+		hdr = mail_index_get_header(mail->ibox->view);
+		if (_mail->uid != 0 && _mail->uid < hdr->next_uid)
+			(void)mail_get_stream(_mail, NULL, NULL, &input);
 	}
 }
 


More information about the dovecot-cvs mailing list