Separated the menu charset code from the charset initialization function,

to avoid the mail font code calling the init function and reset the menu charset,
bug 150530, r=ducarroz, sr=bienvenu.
This commit is contained in:
nhotta%netscape.com 2002-11-12 19:08:23 +00:00
Родитель 9e5297c92c
Коммит 05a5fa5e87
2 изменённых файлов: 21 добавлений и 15 удалений

Просмотреть файл

@ -485,11 +485,18 @@ MimeMessage_close_headers (MimeObject *obj)
( obj->options->part_to_load == NULL )
)
{
char *charset = NULL;
char *lct = MimeHeaders_get (msg->hdrs, HEADER_CONTENT_TYPE,
PR_FALSE, PR_FALSE);
if (lct)
charset = MimeHeaders_get_parameter (lct, "charset", NULL, NULL);
// call SetMailCharacterSetToMsgWindow() to set a menu charset
if (mime_typep(body, (MimeObjectClass *) &mimeInlineTextClass))
{
MimeInlineText *text = (MimeInlineText *) body;
if (text && text->charset && *text->charset)
{
if (!nsCRT::strcasecmp(text->charset, "us-ascii"))
SetMailCharacterSetToMsgWindow(body, NS_LITERAL_STRING("ISO-8859-1").get());
else
SetMailCharacterSetToMsgWindow(body, NS_ConvertASCIItoUCS2(text->charset).get());
}
}
char *msgID = MimeHeaders_get (msg->hdrs, HEADER_MESSAGE_ID,
PR_FALSE, PR_FALSE);
@ -500,8 +507,6 @@ MimeMessage_close_headers (MimeObject *obj)
mimeEmitterStartBody(obj->options, (obj->options->headers == MimeHeadersNone), msgID, outCharset);
PR_FREEIF(msgID);
PR_FREEIF(lct);
PR_FREEIF(charset);
// setting up truncated message html fotter function
char *xmoz = MimeHeaders_get(msg->hdrs, HEADER_X_MOZILLA_STATUS, PR_FALSE,

Просмотреть файл

@ -173,14 +173,6 @@ static int MimeInlineText_initializeCharset(MimeObject *obj)
}
}
//update MsgWindow charset if we are instructed to do so
if (text->needUpdateMsgWinCharset && *text->charset) {
if (!nsCRT::strcasecmp(text->charset, "us-ascii"))
SetMailCharacterSetToMsgWindow(obj, NS_LITERAL_STRING("ISO-8859-1").get());
else
SetMailCharacterSetToMsgWindow(obj, NS_ConvertASCIItoUCS2(text->charset).get());
}
text->initializeCharset = PR_TRUE;
return 0;
@ -521,7 +513,16 @@ MimeInlineText_rotate_convert_and_parse_line(char *line, PRInt32 length,
MimeInlineText *text = (MimeInlineText *) obj;
if (!text->initializeCharset)
{
MimeInlineText_initializeCharset(obj);
//update MsgWindow charset if we are instructed to do so
if (text->needUpdateMsgWinCharset && *text->charset) {
if (!nsCRT::strcasecmp(text->charset, "us-ascii"))
SetMailCharacterSetToMsgWindow(obj, NS_LITERAL_STRING("ISO-8859-1").get());
else
SetMailCharacterSetToMsgWindow(obj, NS_ConvertASCIItoUCS2(text->charset).get());
}
}
//if autodetect is on, push line to dam
if (text->inputAutodetect)