changeset 3702:50e6aeff6b6d HEAD

We were handling wrapped X-IMAPbase and X-Keywords headers very badly.
author Timo Sirainen <tss@iki.fi>
date Fri, 28 Oct 2005 17:32:35 +0300
parents e9742e1f3741
children 736583a848a9
files src/lib-storage/index/mbox/mbox-sync-update.c
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-update.c	Fri Oct 28 17:32:02 2005 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-update.c	Fri Oct 28 17:32:35 2005 +0300
@@ -274,12 +274,18 @@
 	if (ctx->header_first_change > pos)
 		ctx->header_first_change = pos;
 
-	hdr = str_c(ctx->header) + pos;
-	p = strchr(hdr, '\n');
-
-	if (p == NULL) {
-		/* shouldn't really happen, but allow anyway.. */
-		p = hdr + strlen(hdr);
+	/* set p = end of header, handle also wrapped headers */
+	hdr = p = str_c(ctx->header) + pos;
+	for (;;) {
+		p = strchr(p, '\n');
+		if (p == NULL) {
+			/* shouldn't really happen, but allow anyway.. */
+			p = hdr + strlen(hdr);
+			break;
+		}
+		if (p[1] != '\t' && p[1] != ' ')
+			break;
+		p += 2;
 	}
 
 	file_pos = pos + ctx->hdr_offset;