From 9000c702a7a812bec29171e6a13f9bcabfbbd2d2 Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 11 Jul 2005 10:24:19 +0000 Subject: use Content-Type's charset as a fallback encoding of broken header strings when replying. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@419 ee746299-78ed-0310-b773-934348b2243d --- src/compose.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/compose.c b/src/compose.c index 767b17dd..7dd49543 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1217,6 +1217,7 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) {"Newsgroups:", NULL, TRUE}, {"Followup-To:", NULL, TRUE}, {"List-Post:", NULL, FALSE}, + {"Content-Type:",NULL, FALSE}, {NULL, NULL, FALSE}}; enum @@ -1227,10 +1228,12 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) H_BCC = 3, H_NEWSGROUPS = 4, H_FOLLOWUP_TO = 5, - H_LIST_POST = 6 + H_LIST_POST = 6, + H_CONTENT_TYPE = 7 }; FILE *fp; + gchar *charset = NULL; g_return_val_if_fail(msginfo != NULL, -1); @@ -1238,17 +1241,23 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) procheader_get_header_fields(fp, hentry); fclose(fp); + if (hentry[H_CONTENT_TYPE].body != NULL) { + procmime_scan_content_type_str(hentry[H_CONTENT_TYPE].body, + NULL, &charset, NULL, NULL); + g_free(hentry[H_CONTENT_TYPE].body); + hentry[H_CONTENT_TYPE].body = NULL; + } if (hentry[H_REPLY_TO].body != NULL) { if (hentry[H_REPLY_TO].body[0] != '\0') { compose->replyto = conv_unmime_header(hentry[H_REPLY_TO].body, - NULL); + charset); } g_free(hentry[H_REPLY_TO].body); hentry[H_REPLY_TO].body = NULL; } if (hentry[H_CC].body != NULL) { - compose->cc = conv_unmime_header(hentry[H_CC].body, NULL); + compose->cc = conv_unmime_header(hentry[H_CC].body, charset); g_free(hentry[H_CC].body); hentry[H_CC].body = NULL; } @@ -1265,7 +1274,7 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) if (hentry[H_BCC].body != NULL) { if (compose->mode == COMPOSE_REEDIT) compose->bcc = - conv_unmime_header(hentry[H_BCC].body, NULL); + conv_unmime_header(hentry[H_BCC].body, charset); g_free(hentry[H_BCC].body); hentry[H_BCC].body = NULL; } @@ -1277,7 +1286,7 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) if (hentry[H_FOLLOWUP_TO].body[0] != '\0') { compose->followup_to = conv_unmime_header(hentry[H_FOLLOWUP_TO].body, - NULL); + charset); } g_free(hentry[H_FOLLOWUP_TO].body); hentry[H_FOLLOWUP_TO].body = NULL; @@ -1298,6 +1307,8 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) hentry[H_LIST_POST].body = NULL; } + g_free(charset); + if (compose->mode == COMPOSE_REEDIT) { if (msginfo->inreplyto && *msginfo->inreplyto) compose->inreplyto = g_strdup(msginfo->inreplyto); -- cgit v1.2.3