changeset 2991:ca4341dbde8a HEAD

MIME part header fetches weren't working correctly.
author Timo Sirainen <tss@iki.fi>
date Sun, 19 Dec 2004 02:46:10 +0200
parents 57f91991f4ca
children 3c192eebd919
files src/imap/imap-fetch-body.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/imap-fetch-body.c	Sun Dec 19 02:45:33 2004 +0200
+++ b/src/imap/imap-fetch-body.c	Sun Dec 19 02:46:10 2004 +0200
@@ -366,6 +366,7 @@
 {
 	struct message_size msg_size;
 	struct istream *input;
+	uoff_t old_offset;
 
 	/* MIME, HEADER.FIELDS (list), HEADER.FIELDS.NOT (list) */
 
@@ -398,8 +399,9 @@
 	ctx->cur_input = input;
 	ctx->update_partial = FALSE;
 
+	old_offset = ctx->cur_input->v_offset;
 	message_get_header_size(ctx->cur_input, &msg_size, NULL);
-	i_stream_seek(ctx->cur_input, 0);
+	i_stream_seek(ctx->cur_input, old_offset);
 
 	if (!ctx->cur_have_eoh &&
 	    (client_workarounds & WORKAROUND_NETSCAPE_EOH) != 0) {
@@ -432,6 +434,7 @@
 {
 	const struct imap_fetch_body_data *body = context;
 	struct message_size size;
+	uoff_t old_offset;
 
 	ctx->cur_input = mail->get_headers(mail, body->header_ctx);
 	if (ctx->cur_input == NULL)
@@ -440,8 +443,9 @@
 	i_stream_ref(ctx->cur_input);
 	ctx->update_partial = FALSE;
 
+	old_offset = ctx->cur_input->v_offset;
 	message_get_body_size(ctx->cur_input, &size, NULL);
-	i_stream_seek(ctx->cur_input, 0);
+	i_stream_seek(ctx->cur_input, old_offset);
 
 	/* FIXME: We'll just always add the end of headers line now.
 	   ideally mail-storage would have a way to tell us if it exists. */
@@ -537,6 +541,7 @@
 
 	if (strcmp(section, "HEADER") == 0) {
 		/* all headers */
+		i_stream_seek(ctx->cur_input, part->physical_pos);
 		return fetch_data(ctx, body, &part->header_size);
 	}