aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-07-11 10:24:19 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-07-11 10:24:19 +0000
commit9000c702a7a812bec29171e6a13f9bcabfbbd2d2 (patch)
tree24eb7de93700d3348e199f702cdf54caef343489 /src
parent42f57024627723df2a5221436022982d68662e20 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/compose.c21
1 files changed, 16 insertions, 5 deletions
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);