dovecot: Fixes to saving messages.

dovecot at dovecot.org dovecot at dovecot.org
Sat Sep 1 00:36:06 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/83357f65cca4
changeset: 6337:83357f65cca4
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Sep 01 00:35:15 2007 +0300
description:
Fixes to saving messages.

diffstat:

1 file changed, 7 insertions(+), 6 deletions(-)
src/lib-storage/index/mbox/mbox-save.c |   13 +++++++------

diffs (44 lines):

diff -r f2815306ccda -r 83357f65cca4 src/lib-storage/index/mbox/mbox-save.c
--- 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 @@ int mbox_save_continue(struct mail_save_
 	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 @@ int mbox_save_continue(struct mail_save_
 				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 @@ int mbox_save_continue(struct mail_save_
 	}
 
 	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 @@ int mbox_save_continue(struct mail_save_
 			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') {


More information about the dovecot-cvs mailing list