changeset 9077:7cb4741f076e HEAD

Message-decoder: Fixes to handling binary body parts.
author Timo Sirainen <tss@iki.fi>
date Mon, 25 May 2009 19:44:56 -0400
parents 73b468723964
children 76d455a7f4da
files src/lib-mail/message-decoder.c
diffstat 1 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-mail/message-decoder.c	Mon May 25 19:30:27 2009 -0400
+++ b/src/lib-mail/message-decoder.c	Mon May 25 19:44:56 2009 -0400
@@ -219,10 +219,15 @@
 {
 	enum charset_flags flags;
 
-	if (ctx->charset_utf8)
+	ctx->binary_input = ctx->content_charset == NULL &&
+		(ctx->flags & MESSAGE_DECODER_FLAG_RETURN_BINARY) != 0 &&
+		(part->flags & (MESSAGE_PART_FLAG_TEXT |
+				MESSAGE_PART_FLAG_MESSAGE_RFC822)) == 0;
+
+	if (ctx->charset_utf8 || ctx->binary_input)
 		return;
 
-	if (ctx->charset_trans != NULL &&
+	if (ctx->charset_trans != NULL && ctx->content_charset != NULL &&
 	    strcasecmp(ctx->content_charset, ctx->charset_trans_charset) == 0) {
 		/* already have the correct translation selected */
 		return;
@@ -232,13 +237,6 @@
 		charset_to_utf8_end(&ctx->charset_trans);
 	i_free_and_null(ctx->charset_trans_charset);
 
-	ctx->binary_input = ctx->content_charset == NULL &&
-		(ctx->flags & MESSAGE_DECODER_FLAG_RETURN_BINARY) != 0 &&
-		(part->flags & (MESSAGE_PART_FLAG_TEXT |
-				MESSAGE_PART_FLAG_MESSAGE_RFC822)) == 0;
-	if (ctx->binary_input)
-		return;
-
 	flags = (ctx->flags & MESSAGE_DECODER_FLAG_DTCASE) != 0 ?
 		CHARSET_FLAG_DECOMP_TITLECASE : 0;
 	ctx->charset_trans_charset = i_strdup(ctx->content_charset != NULL ?