changeset 306:3f9c648d34db HEAD

mail_index_update_headers() seeked always to beginning of file, instead of beginning of message, which broke mbox.
author Timo Sirainen <tss@iki.fi>
date Tue, 24 Sep 2002 09:55:40 +0300
parents 21a9d15025c7
children 5954f9c2e620
files src/lib-index/mail-index-update.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-update.c	Mon Sep 23 20:23:03 2002 +0300
+++ b/src/lib-index/mail-index-update.c	Tue Sep 24 09:55:40 2002 +0300
@@ -388,6 +388,7 @@
 	Pool pool;
 	const char *value;
 	size_t size;
+	uoff_t start_offset;
 
 	ctx.update = update;
 	ctx.envelope_pool = NULL;
@@ -420,13 +421,15 @@
 			}
 		}
 
+		start_offset = inbuf->offset;
+
 		if (part == NULL) {
 			part = message_parse(pool, inbuf,
 					     update_header_func, &ctx);
 		} else {
 			/* cached, construct the bodystructure using it.
 			   also we need to parse the header.. */
-			io_buffer_seek(inbuf, 0);
+			io_buffer_seek(inbuf, start_offset);
 			message_parse_header(NULL, inbuf, NULL,
 					     update_header_func, &ctx);
 		}
@@ -437,7 +440,7 @@
 
 		if (cache_fields & FIELD_TYPE_BODY) {
 			t_push();
-			io_buffer_seek(inbuf, 0);
+			io_buffer_seek(inbuf, start_offset);
 			value = imap_part_get_bodystructure(pool, &part,
 							    inbuf, FALSE);
 			update->index->update_field(update, FIELD_TYPE_BODY,
@@ -447,7 +450,7 @@
 
 		if (cache_fields & FIELD_TYPE_BODYSTRUCTURE) {
 			t_push();
-			io_buffer_seek(inbuf, 0);
+			io_buffer_seek(inbuf, start_offset);
 			value = imap_part_get_bodystructure(pool, &part,
 							    inbuf, TRUE);
 			update->index->update_field(update,