diff src/lib-imap-storage/imap-msgpart.c @ 18513:8c49fb6d789b

imap: FETCH BODY.PEEK[HEADER.FIELDS (..)] didn't set wanted_headers optimization. Primarily this fixes imapc's prefetching.
author Timo Sirainen <tss@iki.fi>
date Mon, 04 May 2015 18:44:29 +0300
parents 3009a1a6f6d5
children 4cd9e46e0c78
line wrap: on
line diff
--- a/src/lib-imap-storage/imap-msgpart.c	Mon May 04 18:31:27 2015 +0300
+++ b/src/lib-imap-storage/imap-msgpart.c	Mon May 04 18:44:29 2015 +0300
@@ -333,6 +333,18 @@
 	return msgpart->wanted_fields;
 }
 
+void imap_msgpart_get_wanted_headers(struct imap_msgpart *msgpart,
+				     ARRAY_TYPE(const_string) *headers)
+{
+	unsigned int i;
+
+	if (msgpart->fetch_type != FETCH_HEADER_FIELDS)
+		return;
+
+	for (i = 0; msgpart->headers[i] != NULL; i++)
+		array_append(headers, &msgpart->headers[i], 1);
+}
+
 static int
 imap_msgpart_get_partial_header(struct mail *mail, struct istream *mail_input,
 				const struct imap_msgpart *msgpart,