diff src/lib-mail/message-decoder.c @ 7950:3412c43d6707 HEAD

Merge RFC 2231 header continuations in BODY/BODYSTRUCTURE replies. Also use them internally while parsing messages.
author Timo Sirainen <tss@iki.fi>
date Tue, 24 Jun 2008 16:49:36 +0300
parents e6693a0ec8e1
children b9faf4db2a9f
line wrap: on
line diff
--- a/src/lib-mail/message-decoder.c	Tue Jun 24 13:37:55 2008 +0300
+++ b/src/lib-mail/message-decoder.c	Tue Jun 24 16:49:36 2008 +0300
@@ -8,6 +8,7 @@
 #include "charset-utf8.h"
 #include "quoted-printable.h"
 #include "rfc822-parser.h"
+#include "rfc2231-parser.h"
 #include "message-parser.h"
 #include "message-header-decode.h"
 #include "message-decoder.h"
@@ -112,7 +113,7 @@
 		   struct message_header_line *hdr)
 {
 	struct rfc822_parser_context parser;
-	const char *key, *value;
+	const char *const *results;
 	string_t *str;
 
 	if (ctx->content_charset != NULL)
@@ -124,10 +125,11 @@
 	if (rfc822_parse_content_type(&parser, str) <= 0)
 		return;
 
-	while (rfc822_parse_content_param(&parser, &key, &value) > 0) {
-		if (strcasecmp(key, "charset") == 0) {
-			ctx->content_charset = i_strdup(value);
-			ctx->charset_utf8 = charset_is_utf8(value);
+	(void)rfc2231_parse(&parser, &results);
+	for (; *results != NULL; results += 2) {
+		if (strcasecmp(results[0], "charset") == 0) {
+			ctx->content_charset = i_strdup(results[1]);
+			ctx->charset_utf8 = charset_is_utf8(results[1]);
 			break;
 		}
 	}