changeset 6337:83357f65cca4 HEAD

Fixes to saving messages.
author Timo Sirainen <tss@iki.fi>
date Sat, 01 Sep 2007 00:35:15 +0300
parents f2815306ccda
children bfb6aeddef9b
files src/lib-storage/index/mbox/mbox-save.c
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-save.c	Fri Aug 31 23:41:03 2007 +0300
+++ b/src/lib-storage/index/mbox/mbox-save.c	Sat Sep 01 00:35:15 2007 +0300
@@ -506,6 +506,11 @@
 	if (ctx->eoh_offset != (uoff_t)-1) {
 		/* writing body */
 		while ((ret = i_stream_read(ctx->input)) != -1) {
+			if (ctx->mail != NULL) {
+				/* i_stream_read() may have returned 0 at EOF
+				   because of this parser */
+				index_mail_cache_parse_continue(ctx->mail);
+			}
 			if (ret == 0)
 				return 0;
 
@@ -514,9 +519,6 @@
 				return write_error(ctx);
 			ctx->last_char = data[size-1];
 			i_stream_skip(ctx->input, size);
-
-			if (ctx->mail != NULL)
-				index_mail_cache_parse_continue(ctx->mail);
 		}
 
 		if (ctx->last_char != '\n') {
@@ -531,6 +533,8 @@
 	}
 
 	while ((ret = i_stream_read(ctx->input)) != -1) {
+		if (ctx->mail != NULL)
+			index_mail_cache_parse_continue(ctx->mail);
 		if (ret == 0)
 			return 0;
 
@@ -551,9 +555,6 @@
 			return write_error(ctx);
 		ctx->last_char = data[size-1];
 		i_stream_skip(ctx->input, size);
-
-		if (ctx->mail != NULL)
-			index_mail_cache_parse_continue(ctx->mail);
 	}
 
 	if (ctx->last_char != '\n') {