Blob Blame History Raw
diff -up evolution-data-server-3.8.5/camel/camel-imapx-server.c.imapx-body-header evolution-data-server-3.8.5/camel/camel-imapx-server.c
--- evolution-data-server-3.8.5/camel/camel-imapx-server.c.imapx-body-header	2014-01-16 15:04:31.962005652 +0100
+++ evolution-data-server-3.8.5/camel/camel-imapx-server.c	2014-01-16 15:06:59.258999410 +0100
@@ -1722,6 +1722,7 @@ imapx_untagged_fetch (CamelIMAPXServer *
                       GError **error)
 {
 	struct _fetch_info *finfo;
+	gboolean got_body_header;
 
 	g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE);
 	/* cancellable may be NULL */
@@ -1733,6 +1734,21 @@ imapx_untagged_fetch (CamelIMAPXServer *
 		return FALSE;
 	}
 
+	/* Some IMAP servers respond with BODY[HEADER] when
+	 * asked for RFC822.HEADER.  Treat them equivalently. */
+	got_body_header =
+		((finfo->got & FETCH_HEADER) == 0) &&
+		(finfo->header == NULL) &&
+		((finfo->got & FETCH_BODY) != 0) &&
+		(g_strcmp0 (finfo->section, "HEADER") == 0);
+
+	if (got_body_header) {
+		finfo->got |= FETCH_HEADER;
+		finfo->got &= ~FETCH_BODY;
+		finfo->header = finfo->body;
+		finfo->body = NULL;
+	}
+
 	if ((finfo->got & (FETCH_BODY | FETCH_UID)) == (FETCH_BODY | FETCH_UID)) {
 		CamelIMAPXJob *job;
 		GetMessageData *data;