bug 234958 : add 'mailnews.reply_in_default_charset' to mailnews.js (default: false) and special-case 'x-windows-949' (block it from being used no matter what) r=bienvenu, sr=mscott

This commit is contained in:
jshin%mailaps.org 2004-02-21 20:54:18 +00:00
Родитель 89c62cd7fe
Коммит a561a976de
2 изменённых файлов: 28 добавлений и 1 удалений

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

@ -220,7 +220,6 @@ static void GetTopmostMsgWindowCharacterSet(nsXPIDLCString& charset, PRBool* cha
mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
if (msgWindow)
{
nsXPIDLString mailCharset;
msgWindow->GetMailCharacterSet(getter_Copies(charset));
msgWindow->GetCharsetOverride(charsetOverride);
}
@ -1524,6 +1523,10 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
charsetOverride = PR_TRUE;
}
#ifdef DEBUG_jungshik
printf ("charset=%s\n", charset.get());
#endif
PRBool isFirstPass = PR_TRUE;
char *uri = uriList;
char *nextUri;
@ -1559,6 +1562,29 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
if (NS_FAILED(rv)) return rv;
}
// use send_default_charset if reply_in_default_charset is on.
nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID));
if (prefs)
{
PRBool replyInDefault = PR_FALSE;
prefs->GetBoolPref("mailnews.reply_in_default_charset",
&replyInDefault);
if (replyInDefault) {
nsXPIDLString str;
rv = prefs->GetLocalizedUnicharPref("mailnews.send_default_charset",
getter_Copies(str));
if (NS_SUCCEEDED(rv) && !str.IsEmpty())
LossyCopyUTF16toASCII(str, charset);
}
}
// No matter what, we should block x-windows-949 (our internal name)
// from being used for outgoing emails (bug 234958)
if (charset.Equals("x-windows-949",
nsCaseInsensitiveCStringComparator()))
charset = "EUC-KR";
// get an original charset, used for a label, UTF-8 is used for the internal processing
if (isFirstPass && !charset.IsEmpty())
m_compFields->SetCharacterSet(charset);

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

@ -198,6 +198,7 @@ pref("mailnews.autolookup_unknown_mime_types", true);
pref("mailnews.send_default_charset", "chrome://messenger/locale/messenger.properties");
pref("mailnews.view_default_charset", "chrome://messenger/locale/messenger.properties");
pref("mailnews.force_charset_override", false);
pref("mailnews.reply_in_default_charset", false);
pref("mailnews.search_date_format", "chrome://messenger/locale/messenger.properties");
pref("mailnews.search_date_separator", "chrome://messenger/locale/messenger.properties");