Bug #116159 --> don't create the prefs service on the imap thread in order to read out the language accept

pref. Read it ahead of time while we are on the UI thread and remember it for later.
r=bienvenu
rs=sspitzer
This commit is contained in:
mscott%netscape.com 2001-12-20 04:03:42 +00:00
Родитель 4e37323693
Коммит cf1f250fc9
2 изменённых файлов: 5 добавлений и 6 удалений

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

@ -214,6 +214,7 @@ nsresult nsImapProtocol::GlobalInitialization()
prefs->GetIntPref("mail.imap.noop_check_count", &gPromoteNoopToCheckCount);
prefs->GetBoolPref("mail.imap.use_envelope_cmd",
&gUseEnvelopeCmd);
prefs->GetLocalizedUnicharPref("intl.accept_languages", getter_Copies(mAcceptLanguages));
}
gInitialized = PR_TRUE;
return rv;
@ -4369,17 +4370,13 @@ void nsImapProtocol::Language()
// extract the desired language attribute from prefs
nsresult rv = NS_OK;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
nsXPIDLString acceptLanguages;
if (NS_SUCCEEDED(rv) && prefs)
prefs->GetLocalizedUnicharPref("intl.accept_languages", getter_Copies(acceptLanguages));
// we need to parse out the first language out of this comma separated list....
// i.e if we have en,ja we only want to send en to the server.
if (acceptLanguages)
if (mAcceptLanguages.get())
{
nsCAutoString extractedLanguage;
extractedLanguage.AssignWithConversion(acceptLanguages);
extractedLanguage.AssignWithConversion(mAcceptLanguages.get());
PRInt32 pos = extractedLanguage.FindChar(',', PR_TRUE);
if (pos > 0) // we have a comma separated list of languages...
extractedLanguage.Truncate(pos); // truncate everything after the first comma (including the comma)

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

@ -554,6 +554,8 @@ private:
nsCString m_logonCookie;
PRInt16 m_logonPort;
nsXPIDLString mAcceptLanguages;
// progress stuff
void SetProgressString(PRInt32 stringId);