From: Timo Sirainen Date: Mon, 25 May 2009 23:44:56 +0000 (-0400) Subject: Message-decoder: Fixes to handling binary body parts. X-Git-Tag: 2.0.alpha1~692 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=87506860556bf42f656b13f4b14cf81b75261e95;p=thirdparty%2Fdovecot%2Fcore.git Message-decoder: Fixes to handling binary body parts. --HG-- branch : HEAD --- diff --git a/src/lib-mail/message-decoder.c b/src/lib-mail/message-decoder.c index 47c3c64c15..2f21ea2eb5 100644 --- a/src/lib-mail/message-decoder.c +++ b/src/lib-mail/message-decoder.c @@ -219,10 +219,15 @@ message_decode_body_init_charset(struct message_decoder_context *ctx, { 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 @@ message_decode_body_init_charset(struct message_decoder_context *ctx, 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 ?