changeset 4317:59785a02e715 HEAD

Don't cause whitespace offsets to break if some headers before it were removed (eg. extra X-IMAPbase headers)
author Timo Sirainen <tss@iki.fi>
date Thu, 08 Jun 2006 19:59:44 +0300
parents 2a3e17f3a5dc
children 0cb50c985ac6
files src/lib-storage/index/mbox/mbox-sync-parse.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-parse.c	Thu Jun 08 19:58:25 2006 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-parse.c	Thu Jun 08 19:59:44 2006 +0300
@@ -62,7 +62,7 @@
 
 	if ((ssize_t)space > ctx->mail.space) {
 		i_assert(space != 0);
-		ctx->mail.offset = hdr->full_value_offset + i;
+		ctx->mail.offset = ctx->hdr_offset + str_len(ctx->header) + i;
 		ctx->mail.space = space;
 	}
 }
@@ -206,9 +206,11 @@
 		uid_last = uid_last * 10 + (hdr->full_value[i] - '0');
 	}
 
-	if (j != 10) {
+	if (j != 10 ||
+	    hdr->full_value_offset != ctx->hdr_offset + str_len(ctx->header)) {
 		/* uid-last field must be exactly 10 characters to make
-		   rewriting it easier. */
+		   rewriting it easier. also don't try to do this if some
+		   headers have been removed */
 		ctx->imapbase_rewrite = TRUE;
 		ctx->need_rewrite = TRUE;
 	} else {