182982 - Mailnews utility library needs to use nsIPrefBranch, nsIPrefService, et alia

r=timeless/nhotta sr=bienvenu
This commit is contained in:
caillon%returnzero.com 2002-12-10 23:52:28 +00:00
Родитель 78416637f9
Коммит fa74673f01
9 изменённых файлов: 202 добавлений и 174 удалений

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

@ -40,7 +40,8 @@
#include "nsReadableUtils.h" #include "nsReadableUtils.h"
#include "nsMsgDBFolder.h" #include "nsMsgDBFolder.h"
#include "nsMsgFolderFlags.h" #include "nsMsgFolderFlags.h"
#include "nsIPref.h" #include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIFileChannel.h" #include "nsIFileChannel.h"
#include "nsIMsgFolderCache.h" #include "nsIMsgFolderCache.h"
#include "nsIMsgFolderCacheElement.h" #include "nsIMsgFolderCacheElement.h"
@ -71,7 +72,6 @@
#define oneHour 3600000000 #define oneHour 3600000000
#include "nsMsgUtils.h" #include "nsMsgUtils.h"
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static PRTime gtimeOfLastPurgeCheck; //variable to know when to check for purge_threshhold static PRTime gtimeOfLastPurgeCheck; //variable to know when to check for purge_threshhold
@ -1507,10 +1507,10 @@ nsMsgDBFolder::GetPromptPurgeThreshold(PRBool *aPrompt)
{ {
NS_ENSURE_ARG(aPrompt); NS_ENSURE_ARG(aPrompt);
nsresult rv; nsresult rv;
nsCOMPtr<nsIPref> prefService = do_GetService(NS_PREF_CONTRACTID, &rv); nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && prefService) if (NS_SUCCEEDED(rv) && prefBranch)
{ {
rv = prefService->GetBoolPref(PREF_MAIL_PROMPT_PURGE_THRESHOLD, aPrompt); rv = prefBranch->GetBoolPref(PREF_MAIL_PROMPT_PURGE_THRESHOLD, aPrompt);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
{ {
*aPrompt = PR_FALSE; *aPrompt = PR_FALSE;
@ -1525,10 +1525,10 @@ nsMsgDBFolder::GetPurgeThreshold(PRInt32 *aThreshold)
{ {
NS_ENSURE_ARG(aThreshold); NS_ENSURE_ARG(aThreshold);
nsresult rv; nsresult rv;
nsCOMPtr<nsIPref> prefService = do_GetService(NS_PREF_CONTRACTID, &rv); nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && prefService) if (NS_SUCCEEDED(rv) && prefBranch)
{ {
rv = prefService->GetIntPref(PREF_MAIL_PURGE_THRESHOLD, aThreshold); rv = prefBranch->GetIntPref(PREF_MAIL_PURGE_THRESHOLD, aThreshold);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
{ {
*aThreshold = 0; *aThreshold = 0;

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

@ -61,7 +61,8 @@
#include "nsMsgUtils.h" // for NS_MsgHashIfNecessary() #include "nsMsgUtils.h" // for NS_MsgHashIfNecessary()
#include "nsMsgI18N.h" #include "nsMsgI18N.h"
#include "nsIPref.h" #include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIRDFService.h" #include "nsIRDFService.h"
#include "nsRDFCID.h" #include "nsRDFCID.h"
@ -2776,10 +2777,10 @@ nsMsgFolder::GetWarnFilterChanged(PRBool *aVal)
{ {
NS_ENSURE_ARG(aVal); NS_ENSURE_ARG(aVal);
nsresult rv; nsresult rv;
nsCOMPtr<nsIPref> prefService = do_GetService(NS_PREF_CONTRACTID, &rv); nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && prefService) if (NS_SUCCEEDED(rv) && prefBranch)
{ {
rv = prefService->GetBoolPref(PREF_MAIL_WARN_FILTER_CHANGED, aVal); rv = prefBranch->GetBoolPref(PREF_MAIL_WARN_FILTER_CHANGED, aVal);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
{ {
*aVal = PR_FALSE; *aVal = PR_FALSE;
@ -2793,9 +2794,9 @@ nsresult
nsMsgFolder::SetWarnFilterChanged(PRBool aVal) nsMsgFolder::SetWarnFilterChanged(PRBool aVal)
{ {
nsresult rv=NS_OK; nsresult rv=NS_OK;
nsCOMPtr<nsIPref> prefService = do_GetService(NS_PREF_CONTRACTID, &rv); nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && prefService) if (NS_SUCCEEDED(rv) && prefBranch)
rv = prefService->SetBoolPref(PREF_MAIL_WARN_FILTER_CHANGED, aVal); rv = prefBranch->SetBoolPref(PREF_MAIL_WARN_FILTER_CHANGED, aVal);
return rv; return rv;
} }

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

@ -44,7 +44,9 @@
#include "nsICharsetConverterManager2.h" #include "nsICharsetConverterManager2.h"
#include "nsISupports.h" #include "nsISupports.h"
#include "nsIPref.h" #include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIPrefLocalizedString.h"
#include "nsIMimeConverter.h" #include "nsIMimeConverter.h"
#include "msgCore.h" #include "msgCore.h"
#include "nsMsgI18N.h" #include "nsMsgI18N.h"
@ -62,7 +64,6 @@
#include "nsFileSpec.h" #include "nsFileSpec.h"
#include "nsUnicharUtils.h" #include "nsUnicharUtils.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
static NS_DEFINE_CID(kEntityConverterCID, NS_ENTITYCONVERTER_CID); static NS_DEFINE_CID(kEntityConverterCID, NS_ENTITYCONVERTER_CID);
@ -638,11 +639,11 @@ nsresult nsMsgI18NSaveAsCharset(const char* contentType, const char *charset,
if (!nsCRT::strcmp(charsetName, NS_LITERAL_STRING("ISO-2022-JP").get())) { if (!nsCRT::strcmp(charsetName, NS_LITERAL_STRING("ISO-2022-JP").get())) {
static PRInt32 sSendHankakuKana = -1; static PRInt32 sSendHankakuKana = -1;
if (sSendHankakuKana < 0) { if (sSendHankakuKana < 0) {
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res)); nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &res));
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
PRBool sendHankaku; PRBool sendHankaku;
// Get a hidden 4.x pref with no UI, get it only once. // Get a hidden 4.x pref with no UI, get it only once.
if (NS_FAILED(prefs->GetBoolPref("mailnews.send_hankaku_kana", &sendHankaku))) if (NS_FAILED(prefBranch->GetBoolPref("mailnews.send_hankaku_kana", &sendHankaku)))
sSendHankakuKana = 0; // no pref means need the mapping sSendHankakuKana = 0; // no pref means need the mapping
else else
sSendHankakuKana = sendHankaku ? 1 : 0; sSendHankakuKana = sendHankaku ? 1 : 0;
@ -665,13 +666,13 @@ nsresult nsMsgI18NSaveAsCharset(const char* contentType, const char *charset,
// If the converer cannot encode to the charset, // If the converer cannot encode to the charset,
// then fallback to pref sepcified charsets. // then fallback to pref sepcified charsets.
if (NS_ERROR_UENC_NOMAPPING == res && !bTEXT_HTML && fallbackCharset) { if (NS_ERROR_UENC_NOMAPPING == res && !bTEXT_HTML && fallbackCharset) {
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID, &res)); nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &res));
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
nsCAutoString prefString("intl.fallbackCharsetList."); nsCAutoString prefString("intl.fallbackCharsetList.");
prefString.Append(charset); prefString.Append(charset);
nsXPIDLCString fallbackList; nsXPIDLCString fallbackList;
res = pref->GetCharPref(prefString.get(), getter_Copies(fallbackList)); res = prefBranch->GetCharPref(prefString.get(), getter_Copies(fallbackList));
// do the fallback only if there is a pref for the charset // do the fallback only if there is a pref for the charset
if (NS_FAILED(res) || fallbackList.IsEmpty()) if (NS_FAILED(res) || fallbackList.IsEmpty())
return NS_ERROR_UENC_NOMAPPING; return NS_ERROR_UENC_NOMAPPING;
@ -710,31 +711,32 @@ nsresult nsMsgI18NFormatNNTPXPATInNonRFC1522Format(const nsCString& aCharset,
return NS_OK; return NS_OK;
} }
char * const char *
nsMsgI18NGetAcceptLanguage(void) nsMsgI18NGetAcceptLanguage(void)
{ {
static char lang[32]; nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
nsresult res; if (prefBranch)
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
if (nsnull != prefs && NS_SUCCEEDED(res))
{ {
nsXPIDLString prefValue; nsCOMPtr<nsIPrefLocalizedString> prefString;
memset(lang, 0, sizeof(lang)); prefBranch->GetComplexValue("intl.accept_languages",
res = prefs->GetLocalizedUnicharPref("intl.accept_languages", getter_Copies(prefValue)); NS_GET_IID(nsIPrefLocalizedString),
if (NS_SUCCEEDED(res) && prefValue) getter_AddRefs(prefString));
if (prefString)
{ {
PL_strncpy(lang, NS_ConvertUCS2toUTF8(prefValue).get(), sizeof(lang)); nsXPIDLString ucsval;
lang[sizeof(lang)-1] = '\0'; prefString->ToString(getter_Copies(ucsval));
if (!ucsval.IsEmpty())
{
static nsCAutoString acceptLang;
acceptLang.Assign(NS_LossyConvertUCS2toASCII(ucsval));
return acceptLang.get();
}
} }
else
PL_strcpy(lang, "en");
} }
else
PL_strcpy(lang, "en");
return (char *)lang; // Default Accept-Language
return "en";
} }

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

@ -92,10 +92,11 @@ NS_MSG_BASE PRBool nsMsgI18Ncheck_data_in_charset_range(const char *charset,
/** /**
* Return accept language. * Return accept language.
* Note, the return value is not valid after this method gets called again.
* *
* @return Accept language. * @return Accept language.
*/ */
NS_MSG_BASE char *nsMsgI18NGetAcceptLanguage(void); NS_MSG_BASE const char *nsMsgI18NGetAcceptLanguage(void);
/** /**
* Return charset name internally used in messsage compose. * Return charset name internally used in messsage compose.

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

@ -42,7 +42,7 @@
#include "msgCore.h" // for pre-compiled headers #include "msgCore.h" // for pre-compiled headers
#include "nsMsgIdentity.h" #include "nsMsgIdentity.h"
#include "nsIPref.h" #include "nsIPrefService.h"
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsReadableUtils.h" #include "nsReadableUtils.h"
@ -54,8 +54,8 @@
#include "nsIMsgFolder.h" #include "nsIMsgFolder.h"
#include "prprf.h" #include "prprf.h"
#include "nsISupportsObsolete.h" #include "nsISupportsObsolete.h"
#include "nsISupportsPrimitives.h"
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgIdentity, NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgIdentity,
@ -65,7 +65,7 @@ nsMsgIdentity::nsMsgIdentity():
m_signature(0), m_signature(0),
m_vCard(0), m_vCard(0),
m_identityKey(0), m_identityKey(0),
m_prefs(0) m_prefBranch(0)
{ {
NS_INIT_ISUPPORTS(); NS_INIT_ISUPPORTS();
} }
@ -73,16 +73,16 @@ nsMsgIdentity::nsMsgIdentity():
nsMsgIdentity::~nsMsgIdentity() nsMsgIdentity::~nsMsgIdentity()
{ {
PR_FREEIF(m_identityKey); PR_FREEIF(m_identityKey);
if (m_prefs) nsServiceManager::ReleaseService(kPrefServiceCID, m_prefs); NS_IF_RELEASE(m_prefBranch);
} }
nsresult nsresult
nsMsgIdentity::getPrefService() nsMsgIdentity::getPrefService()
{ {
if (m_prefs) return NS_OK; if (m_prefBranch)
return nsServiceManager::GetService(kPrefServiceCID, return NS_OK;
NS_GET_IID(nsIPref),
(nsISupports**)&m_prefs); return CallGetService(NS_PREFSERVICE_CONTRACTID, &m_prefBranch);
} }
@ -120,7 +120,7 @@ nsMsgIdentity::getBoolPref(const char *prefname,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *fullPrefName = getPrefName(m_identityKey, prefname); char *fullPrefName = getPrefName(m_identityKey, prefname);
rv = m_prefs->GetBoolPref(fullPrefName, val); rv = m_prefBranch->GetBoolPref(fullPrefName, val);
PR_Free(fullPrefName); PR_Free(fullPrefName);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
@ -137,7 +137,7 @@ nsMsgIdentity::getDefaultBoolPref(const char *prefname,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *fullPrefName = getDefaultPrefName(prefname); char *fullPrefName = getDefaultPrefName(prefname);
rv = m_prefs->GetBoolPref(fullPrefName, val); rv = m_prefBranch->GetBoolPref(fullPrefName, val);
PR_Free(fullPrefName); PR_Free(fullPrefName);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
@ -155,7 +155,7 @@ nsMsgIdentity::setBoolPref(const char *prefname,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *prefName = getPrefName(m_identityKey, prefname); char *prefName = getPrefName(m_identityKey, prefname);
rv = m_prefs->SetBoolPref(prefName, val); rv = m_prefBranch->SetBoolPref(prefName, val);
PR_Free(prefName); PR_Free(prefName);
return rv; return rv;
} }
@ -169,12 +169,18 @@ nsMsgIdentity::getUnicharPref(const char *prefname,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *fullPrefName = getPrefName(m_identityKey, prefname); char *fullPrefName = getPrefName(m_identityKey, prefname);
rv = m_prefs->CopyUnicharPref(fullPrefName, val); nsCOMPtr<nsISupportsString> supportsString;
rv = m_prefBranch->GetComplexValue(fullPrefName,
NS_GET_IID(nsISupportsString),
getter_AddRefs(supportsString));
PR_Free(fullPrefName); PR_Free(fullPrefName);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
rv = getDefaultUnicharPref(prefname, val); rv = getDefaultUnicharPref(prefname, val);
if (supportsString)
rv = supportsString->ToString(val);
return rv; return rv;
} }
@ -186,7 +192,7 @@ nsMsgIdentity::getCharPref(const char *prefname,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *fullPrefName = getPrefName(m_identityKey, prefname); char *fullPrefName = getPrefName(m_identityKey, prefname);
rv = m_prefs->CopyCharPref(fullPrefName, val); rv = m_prefBranch->GetCharPref(fullPrefName, val);
PR_Free(fullPrefName); PR_Free(fullPrefName);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
@ -203,14 +209,18 @@ nsMsgIdentity::getDefaultUnicharPref(const char *prefname,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *fullPrefName = getDefaultPrefName(prefname); char *fullPrefName = getDefaultPrefName(prefname);
rv = m_prefs->CopyUnicharPref(fullPrefName, val); nsCOMPtr<nsISupportsString> supportsString;
rv = m_prefBranch->GetComplexValue(fullPrefName,
NS_GET_IID(nsISupportsString),
getter_AddRefs(supportsString));
PR_Free(fullPrefName); PR_Free(fullPrefName);
if (NS_FAILED(rv)) { if (NS_FAILED(rv) || !supportsString) {
*val = nsnull; // null is ok to return here *val = nsnull; // null is ok to return here
rv = NS_OK; return NS_OK;
} }
return rv;
return supportsString->ToString(val);
} }
nsresult nsresult
@ -221,7 +231,7 @@ nsMsgIdentity::getDefaultCharPref(const char *prefname,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *fullPrefName = getDefaultPrefName(prefname); char *fullPrefName = getDefaultPrefName(prefname);
rv = m_prefs->CopyCharPref(fullPrefName, val); rv = m_prefBranch->GetCharPref(fullPrefName, val);
PR_Free(fullPrefName); PR_Free(fullPrefName);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
@ -240,10 +250,19 @@ nsMsgIdentity::setUnicharPref(const char *prefname,
rv = NS_OK; rv = NS_OK;
char *prefName = getPrefName(m_identityKey, prefname); char *prefName = getPrefName(m_identityKey, prefname);
if (val) if (val) {
rv = m_prefs->SetUnicharPref(prefName, val); nsCOMPtr<nsISupportsString> supportsString =
else do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
m_prefs->ClearUserPref(prefName); if (supportsString) {
supportsString->SetData(nsDependentString(val));
rv = m_prefBranch->SetComplexValue(prefName,
NS_GET_IID(nsISupportsString),
supportsString);
}
}
else {
m_prefBranch->ClearUserPref(prefName);
}
PR_Free(prefName); PR_Free(prefName);
return rv; return rv;
} }
@ -258,9 +277,9 @@ nsMsgIdentity::setCharPref(const char *prefname,
rv = NS_OK; rv = NS_OK;
char *prefName = getPrefName(m_identityKey, prefname); char *prefName = getPrefName(m_identityKey, prefname);
if (val) if (val)
rv = m_prefs->SetCharPref(prefName, val); rv = m_prefBranch->SetCharPref(prefName, val);
else else
m_prefs->ClearUserPref(prefName); m_prefBranch->ClearUserPref(prefName);
PR_Free(prefName); PR_Free(prefName);
return rv; return rv;
} }
@ -273,7 +292,7 @@ nsMsgIdentity::getIntPref(const char *prefname,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *fullPrefName = getPrefName(m_identityKey, prefname); char *fullPrefName = getPrefName(m_identityKey, prefname);
rv = m_prefs->GetIntPref(fullPrefName, val); rv = m_prefBranch->GetIntPref(fullPrefName, val);
PR_Free(fullPrefName); PR_Free(fullPrefName);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
@ -290,7 +309,7 @@ nsMsgIdentity::getDefaultIntPref(const char *prefname,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *fullPrefName = getDefaultPrefName(prefname); char *fullPrefName = getDefaultPrefName(prefname);
rv = m_prefs->GetIntPref(fullPrefName, val); rv = m_prefBranch->GetIntPref(fullPrefName, val);
PR_Free(fullPrefName); PR_Free(fullPrefName);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
@ -309,7 +328,7 @@ nsMsgIdentity::setIntPref(const char *prefname,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *prefName = getPrefName(m_identityKey, prefname); char *prefName = getPrefName(m_identityKey, prefname);
rv = m_prefs->SetIntPref(prefName, val); rv = m_prefBranch->SetIntPref(prefName, val);
PR_Free(prefName); PR_Free(prefName);
return rv; return rv;
} }
@ -376,7 +395,7 @@ nsMsgIdentity::GetSignature(nsILocalFile **sig) {
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
char *prefName = getPrefName(m_identityKey, "sig_file"); char *prefName = getPrefName(m_identityKey, "sig_file");
rv = m_prefs->GetFileXPref(prefName, sig); rv = m_prefBranch->GetComplexValue(prefName, NS_GET_IID(nsILocalFile), (void **)sig);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
*sig = nsnull; *sig = nsnull;
return NS_OK; return NS_OK;
@ -392,10 +411,10 @@ nsMsgIdentity::SetSignature(nsILocalFile *sig)
rv = NS_OK; rv = NS_OK;
char *prefName = getPrefName(m_identityKey, "sig_file"); char *prefName = getPrefName(m_identityKey, "sig_file");
if (sig) if (sig)
rv = m_prefs->SetFileXPref(prefName, sig); rv = m_prefBranch->SetComplexValue(prefName, NS_GET_IID(nsILocalFile), sig);
/* /*
else else
m_prefs->ClearFilePref(prefName); m_prefBranch->ClearFilePref(prefName);
*/ */
PR_Free(prefName); PR_Free(prefName);
return rv; return rv;
@ -407,21 +426,23 @@ NS_IMETHODIMP
nsMsgIdentity::ClearAllValues() nsMsgIdentity::ClearAllValues()
{ {
nsresult rv = getPrefService(); nsresult rv = getPrefService();
if (NS_SUCCEEDED(rv)) { NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString rootPref(NS_LITERAL_CSTRING("mail.identity."));
nsCAutoString rootPref("mail.identity.");
rootPref += m_identityKey; rootPref += m_identityKey;
rv = m_prefs->EnumerateChildren(rootPref.get(), clearPrefEnum, (void *)m_prefs); PRUint32 childCount;
char** childArray;
rv = m_prefBranch->GetChildList(rootPref.get(), &childCount, &childArray);
NS_ENSURE_SUCCESS(rv, rv);
for (PRUint32 i = 0; i < childCount; ++i) {
m_prefBranch->ClearUserPref(childArray[i]);
} }
return rv; NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(childCount, childArray);
}
void return NS_OK;
nsMsgIdentity::clearPrefEnum(const char *aPref, void *aClosure)
{
nsIPref *prefs = (nsIPref *)aClosure;
prefs->ClearUserPref(aPref);
} }
@ -652,12 +673,10 @@ nsMsgIdentity::GetRequestReturnReceipt(PRBool *aVal)
{ {
return GetBoolAttribute("request_return_receipt_on", aVal); return GetBoolAttribute("request_return_receipt_on", aVal);
} }
else
{ rv = getPrefService();
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return prefs->GetBoolPref("mail.receipt.request_return_receipt_on", aVal); return m_prefBranch->GetBoolPref("mail.receipt.request_return_receipt_on", aVal);
}
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -672,10 +691,8 @@ nsMsgIdentity::GetReceiptHeaderType(PRInt32 *aType)
{ {
return GetBoolAttribute("request_receipt_header_type", aType); return GetBoolAttribute("request_receipt_header_type", aType);
} }
else
{ rv = getPrefService();
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return prefs->GetBoolPref("mail.receipt.request_header_type", aType); return m_prefBranch->GetBoolPref("mail.receipt.request_header_type", aType);
}
} }

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

@ -39,7 +39,7 @@
#define nsMsgIdentity_h___ #define nsMsgIdentity_h___
#include "nsIMsgIdentity.h" #include "nsIMsgIdentity.h"
#include "nsIPref.h" #include "nsIPrefBranch.h"
#include "msgCore.h" #include "msgCore.h"
#include "nsISmtpServer.h" #include "nsISmtpServer.h"
#include "nsWeakPtr.h" #include "nsWeakPtr.h"
@ -58,7 +58,7 @@ private:
nsIMsgSignature* m_signature; nsIMsgSignature* m_signature;
nsIMsgVCard* m_vCard; nsIMsgVCard* m_vCard;
char *m_identityKey; char *m_identityKey;
nsIPref *m_prefs; nsIPrefBranch *m_prefBranch;
nsWeakPtr m_smtpServer; nsWeakPtr m_smtpServer;
protected: protected:
@ -86,8 +86,6 @@ protected:
nsresult setFolderPref(const char *pref, const char *); nsresult setFolderPref(const char *pref, const char *);
private: private:
static void clearPrefEnum(const char *aPref, void *aClosure);
nsresult loadSmtpServer(nsISmtpServer**); nsresult loadSmtpServer(nsISmtpServer**);
}; };

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

@ -49,6 +49,7 @@
#include "nsReadableUtils.h" #include "nsReadableUtils.h"
#include "nsEscape.h" #include "nsEscape.h"
#include "nsISupportsObsolete.h" #include "nsISupportsObsolete.h"
#include "nsISupportsPrimitives.h"
#include "nsMsgBaseCID.h" #include "nsMsgBaseCID.h"
#include "nsMsgDBCID.h" #include "nsMsgDBCID.h"
@ -59,7 +60,7 @@
#include "nsIMsgFilterService.h" #include "nsIMsgFilterService.h"
#include "nsIMsgProtocolInfo.h" #include "nsIMsgProtocolInfo.h"
#include "nsIPref.h" #include "nsIPrefService.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIWebShell.h" #include "nsIWebShell.h"
#include "nsIWebShellWindow.h" #include "nsIWebShellWindow.h"
@ -80,7 +81,6 @@
#include "nsMsgFolderFlags.h" #include "nsMsgFolderFlags.h"
#include "nsMsgUtils.h" #include "nsMsgUtils.h"
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
#define PORT_NOT_SET -1 #define PORT_NOT_SET -1
@ -89,7 +89,7 @@ MOZ_DECL_CTOR_COUNTER(nsMsgIncomingServer)
nsMsgIncomingServer::nsMsgIncomingServer(): nsMsgIncomingServer::nsMsgIncomingServer():
m_rootFolder(0), m_rootFolder(0),
m_prefs(0), m_prefBranch(0),
m_biffState(nsIMsgFolder::nsMsgBiffState_NoMail), m_biffState(nsIMsgFolder::nsMsgBiffState_NoMail),
m_serverBusy(PR_FALSE), m_serverBusy(PR_FALSE),
m_canHaveFilters(PR_FALSE), m_canHaveFilters(PR_FALSE),
@ -101,9 +101,7 @@ nsMsgIncomingServer::nsMsgIncomingServer():
nsMsgIncomingServer::~nsMsgIncomingServer() nsMsgIncomingServer::~nsMsgIncomingServer()
{ {
if (m_prefs) nsServiceManager::ReleaseService(kPrefServiceCID, NS_IF_RELEASE(m_prefBranch);
m_prefs,
nsnull);
} }
@ -121,15 +119,13 @@ NS_IMPL_GETTER_STR(nsMsgIncomingServer::GetKey, m_serverKey.get())
NS_IMETHODIMP NS_IMETHODIMP
nsMsgIncomingServer::SetKey(const char * serverKey) nsMsgIncomingServer::SetKey(const char * serverKey)
{ {
nsresult rv = NS_OK;
// in order to actually make use of the key, we need the prefs
if (!m_prefs)
rv = nsServiceManager::GetService(kPrefServiceCID,
NS_GET_IID(nsIPref),
(nsISupports**)&m_prefs);
m_serverKey.Assign(serverKey); m_serverKey.Assign(serverKey);
return rv;
// in order to actually make use of the key, we need the prefs
if (m_prefBranch)
return NS_OK;
return CallGetService(NS_PREFSERVICE_CONTRACTID, &m_prefBranch);
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -411,7 +407,7 @@ nsMsgIncomingServer::GetBoolValue(const char *prefname,
{ {
nsCAutoString fullPrefName; nsCAutoString fullPrefName;
getPrefName(m_serverKey.get(), prefname, fullPrefName); getPrefName(m_serverKey.get(), prefname, fullPrefName);
nsresult rv = m_prefs->GetBoolPref(fullPrefName.get(), val); nsresult rv = m_prefBranch->GetBoolPref(fullPrefName.get(), val);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
rv = getDefaultBoolPref(prefname, val); rv = getDefaultBoolPref(prefname, val);
@ -425,7 +421,7 @@ nsMsgIncomingServer::getDefaultBoolPref(const char *prefname,
nsCAutoString fullPrefName; nsCAutoString fullPrefName;
getDefaultPrefName(prefname, fullPrefName); getDefaultPrefName(prefname, fullPrefName);
nsresult rv = m_prefs->GetBoolPref(fullPrefName.get(), val); nsresult rv = m_prefBranch->GetBoolPref(fullPrefName.get(), val);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
*val = PR_FALSE; *val = PR_FALSE;
@ -445,11 +441,10 @@ nsMsgIncomingServer::SetBoolValue(const char *prefname,
PRBool defaultValue; PRBool defaultValue;
rv = getDefaultBoolPref(prefname, &defaultValue); rv = getDefaultBoolPref(prefname, &defaultValue);
if (NS_SUCCEEDED(rv) && if (NS_SUCCEEDED(rv) && val == defaultValue)
val == defaultValue) m_prefBranch->ClearUserPref(fullPrefName.get());
m_prefs->ClearUserPref(fullPrefName.get());
else else
rv = m_prefs->SetBoolPref(fullPrefName.get(), val); rv = m_prefBranch->SetBoolPref(fullPrefName.get(), val);
return rv; return rv;
} }
@ -460,7 +455,7 @@ nsMsgIncomingServer::GetIntValue(const char *prefname,
{ {
nsCAutoString fullPrefName; nsCAutoString fullPrefName;
getPrefName(m_serverKey.get(), prefname, fullPrefName); getPrefName(m_serverKey.get(), prefname, fullPrefName);
nsresult rv = m_prefs->GetIntPref(fullPrefName.get(), val); nsresult rv = m_prefBranch->GetIntPref(fullPrefName.get(), val);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
rv = getDefaultIntPref(prefname, val); rv = getDefaultIntPref(prefname, val);
@ -476,11 +471,13 @@ nsMsgIncomingServer::GetFileValue(const char* prefname,
getPrefName(m_serverKey.get(), prefname, fullPrefName); getPrefName(m_serverKey.get(), prefname, fullPrefName);
nsCOMPtr<nsILocalFile> prefLocal; nsCOMPtr<nsILocalFile> prefLocal;
nsCOMPtr<nsIFileSpec> outSpec;
nsresult rv = m_prefs->GetFileXPref(fullPrefName.get(), getter_AddRefs(prefLocal)); nsresult rv = m_prefBranch->GetComplexValue(fullPrefName.get(),
NS_GET_IID(nsILocalFile),
getter_AddRefs(prefLocal));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIFileSpec> outSpec;
rv = NS_NewFileSpecFromIFile(prefLocal, getter_AddRefs(outSpec)); rv = NS_NewFileSpecFromIFile(prefLocal, getter_AddRefs(outSpec));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
@ -499,13 +496,15 @@ nsMsgIncomingServer::SetFileValue(const char* prefname,
nsresult rv; nsresult rv;
nsFileSpec tempSpec; nsFileSpec tempSpec;
nsCOMPtr<nsILocalFile> prefLocal;
rv = spec->GetFileSpec(&tempSpec); rv = spec->GetFileSpec(&tempSpec);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsILocalFile> prefLocal;
rv = NS_FileSpecToIFile(&tempSpec, getter_AddRefs(prefLocal)); rv = NS_FileSpecToIFile(&tempSpec, getter_AddRefs(prefLocal));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = m_prefs->SetFileXPref(fullPrefName.get(), prefLocal);
rv = m_prefBranch->SetComplexValue(fullPrefName.get(), NS_GET_IID(nsIFileSpec),
prefLocal);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
return NS_OK; return NS_OK;
@ -517,7 +516,7 @@ nsMsgIncomingServer::getDefaultIntPref(const char *prefname,
nsCAutoString fullPrefName; nsCAutoString fullPrefName;
getDefaultPrefName(prefname, fullPrefName); getDefaultPrefName(prefname, fullPrefName);
nsresult rv = m_prefs->GetIntPref(fullPrefName.get(), val); nsresult rv = m_prefBranch->GetIntPref(fullPrefName.get(), val);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
*val = 0; *val = 0;
@ -539,9 +538,9 @@ nsMsgIncomingServer::SetIntValue(const char *prefname,
rv = getDefaultIntPref(prefname, &defaultVal); rv = getDefaultIntPref(prefname, &defaultVal);
if (NS_SUCCEEDED(rv) && defaultVal == val) if (NS_SUCCEEDED(rv) && defaultVal == val)
m_prefs->ClearUserPref(fullPrefName.get()); m_prefBranch->ClearUserPref(fullPrefName.get());
else else
rv = m_prefs->SetIntPref(fullPrefName.get(), val); rv = m_prefBranch->SetIntPref(fullPrefName.get(), val);
return rv; return rv;
} }
@ -552,7 +551,7 @@ nsMsgIncomingServer::GetCharValue(const char *prefname,
{ {
nsCAutoString fullPrefName; nsCAutoString fullPrefName;
getPrefName(m_serverKey.get(), prefname, fullPrefName); getPrefName(m_serverKey.get(), prefname, fullPrefName);
nsresult rv = m_prefs->CopyCharPref(fullPrefName.get(), val); nsresult rv = m_prefBranch->GetCharPref(fullPrefName.get(), val);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
rv = getDefaultCharPref(prefname, val); rv = getDefaultCharPref(prefname, val);
@ -566,21 +565,27 @@ nsMsgIncomingServer::GetUnicharValue(const char *prefname,
{ {
nsCAutoString fullPrefName; nsCAutoString fullPrefName;
getPrefName(m_serverKey.get(), prefname, fullPrefName); getPrefName(m_serverKey.get(), prefname, fullPrefName);
nsresult rv = m_prefs->CopyUnicharPref(fullPrefName.get(), val); nsCOMPtr<nsISupportsString> supportsString;
nsresult rv = m_prefBranch->GetComplexValue(fullPrefName.get(),
NS_GET_IID(nsISupportsString),
getter_AddRefs(supportsString));
if (NS_FAILED(rv)) if (NS_FAILED(rv))
rv = getDefaultUnicharPref(prefname, val); return getDefaultUnicharPref(prefname, val);
if (supportsString)
rv = supportsString->ToString(val);
return rv; return rv;
} }
nsresult nsresult
nsMsgIncomingServer::getDefaultCharPref(const char *prefname, nsMsgIncomingServer::getDefaultCharPref(const char *prefname,
char **val) { char **val)
{
nsCAutoString fullPrefName; nsCAutoString fullPrefName;
getDefaultPrefName(prefname, fullPrefName); getDefaultPrefName(prefname, fullPrefName);
nsresult rv = m_prefs->CopyCharPref(fullPrefName.get(), val); nsresult rv = m_prefBranch->GetCharPref(fullPrefName.get(), val);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
*val = nsnull; // null is ok to return here *val = nsnull; // null is ok to return here
@ -595,13 +600,16 @@ nsMsgIncomingServer::getDefaultUnicharPref(const char *prefname,
nsCAutoString fullPrefName; nsCAutoString fullPrefName;
getDefaultPrefName(prefname, fullPrefName); getDefaultPrefName(prefname, fullPrefName);
nsresult rv = m_prefs->CopyUnicharPref(fullPrefName.get(), val); nsCOMPtr<nsISupportsString> supportsString;
nsresult rv = m_prefBranch->GetComplexValue(fullPrefName.get(),
if (NS_FAILED(rv)) { NS_GET_IID(nsISupportsString),
getter_AddRefs(supportsString));
if (NS_FAILED(rv) || !supportsString) {
*val = nsnull; // null is ok to return here *val = nsnull; // null is ok to return here
rv = NS_OK; return NS_OK;
} }
return rv;
return supportsString->ToString(val);
} }
nsresult nsresult
@ -613,18 +621,17 @@ nsMsgIncomingServer::SetCharValue(const char *prefname,
getPrefName(m_serverKey.get(), prefname, fullPrefName); getPrefName(m_serverKey.get(), prefname, fullPrefName);
if (!val) { if (!val) {
m_prefs->ClearUserPref(fullPrefName.get()); m_prefBranch->ClearUserPref(fullPrefName.get());
return NS_OK; return NS_OK;
} }
char *defaultVal=nsnull; char *defaultVal=nsnull;
rv = getDefaultCharPref(prefname, &defaultVal); rv = getDefaultCharPref(prefname, &defaultVal);
if (NS_SUCCEEDED(rv) && if (NS_SUCCEEDED(rv) && strcmp(defaultVal, val) == 0)
PL_strcmp(defaultVal, val) == 0) m_prefBranch->ClearUserPref(fullPrefName.get());
m_prefs->ClearUserPref(fullPrefName.get());
else else
rv = m_prefs->SetCharPref(fullPrefName.get(), val); rv = m_prefBranch->SetCharPref(fullPrefName.get(), val);
PR_FREEIF(defaultVal); PR_FREEIF(defaultVal);
@ -640,7 +647,7 @@ nsMsgIncomingServer::SetUnicharValue(const char *prefname,
getPrefName(m_serverKey.get(), prefname, fullPrefName); getPrefName(m_serverKey.get(), prefname, fullPrefName);
if (!val) { if (!val) {
m_prefs->ClearUserPref(fullPrefName.get()); m_prefBranch->ClearUserPref(fullPrefName.get());
return NS_OK; return NS_OK;
} }
@ -648,9 +655,17 @@ nsMsgIncomingServer::SetUnicharValue(const char *prefname,
rv = getDefaultUnicharPref(prefname, &defaultVal); rv = getDefaultUnicharPref(prefname, &defaultVal);
if (defaultVal && NS_SUCCEEDED(rv) && if (defaultVal && NS_SUCCEEDED(rv) &&
nsCRT::strcmp(defaultVal, val) == 0) nsCRT::strcmp(defaultVal, val) == 0)
m_prefs->ClearUserPref(fullPrefName.get()); m_prefBranch->ClearUserPref(fullPrefName.get());
else else {
rv = m_prefs->SetUnicharPref(fullPrefName.get(), val); nsCOMPtr<nsISupportsString> supportsString =
do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
if (supportsString) {
supportsString->SetData(nsDependentString(val));
rv = m_prefBranch->SetComplexValue(fullPrefName.get(),
NS_GET_IID(nsISupportsString),
supportsString);
}
}
PR_FREEIF(defaultVal); PR_FREEIF(defaultVal);
@ -1012,13 +1027,21 @@ nsMsgIncomingServer::Equals(nsIMsgIncomingServer *server, PRBool *_retval)
NS_IMETHODIMP NS_IMETHODIMP
nsMsgIncomingServer::ClearAllValues() nsMsgIncomingServer::ClearAllValues()
{ {
nsresult rv;
nsCAutoString rootPref("mail.server."); nsCAutoString rootPref("mail.server.");
rootPref += m_serverKey; rootPref += m_serverKey;
rv = m_prefs->EnumerateChildren(rootPref.get(), clearPrefEnum, (void *)m_prefs); PRUint32 childCount;
char** childArray;
nsresult rv = m_prefBranch->GetChildList(rootPref.get(), &childCount, &childArray);
NS_ENSURE_SUCCESS(rv, rv);
return rv; for (PRUint32 i = 0; i < childCount; ++i) {
m_prefBranch->ClearUserPref(childArray[i]);
}
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(childCount, childArray);
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -1058,14 +1081,6 @@ nsMsgIncomingServer::RemoveFiles()
return NS_OK; return NS_OK;
} }
void
nsMsgIncomingServer::clearPrefEnum(const char *aPref, void *aClosure)
{
nsIPref *prefs = (nsIPref *)aClosure;
prefs->ClearUserPref(aPref);
}
NS_IMETHODIMP NS_IMETHODIMP
nsMsgIncomingServer::SetFilterList(nsIMsgFilterList *aFilterList) nsMsgIncomingServer::SetFilterList(nsIMsgFilterList *aFilterList)
{ {
@ -1290,7 +1305,7 @@ nsMsgIncomingServer::GetDoBiff(PRBool *aDoBiff)
nsCAutoString fullPrefName; nsCAutoString fullPrefName;
getPrefName(m_serverKey.get(), BIFF_PREF_NAME, fullPrefName); getPrefName(m_serverKey.get(), BIFF_PREF_NAME, fullPrefName);
rv = m_prefs->GetBoolPref(fullPrefName.get(), aDoBiff); rv = m_prefBranch->GetBoolPref(fullPrefName.get(), aDoBiff);
if (NS_SUCCEEDED(rv)) return rv; if (NS_SUCCEEDED(rv)) return rv;
// if the pref isn't set, use the default // if the pref isn't set, use the default
@ -1317,7 +1332,7 @@ nsMsgIncomingServer::SetDoBiff(PRBool aDoBiff)
nsCAutoString fullPrefName; nsCAutoString fullPrefName;
getPrefName(m_serverKey.get(), BIFF_PREF_NAME, fullPrefName); getPrefName(m_serverKey.get(), BIFF_PREF_NAME, fullPrefName);
rv = m_prefs->SetBoolPref(fullPrefName.get(), aDoBiff); rv = m_prefBranch->SetBoolPref(fullPrefName.get(), aDoBiff);
NS_ENSURE_SUCCESS(rv,rv); NS_ENSURE_SUCCESS(rv,rv);
return NS_OK; return NS_OK;
} }
@ -1738,12 +1753,7 @@ nsMsgIncomingServer::ConfigureTemporaryReturnReceiptsFilter(nsIMsgFilterList *fi
rv = GetIntValue("incorporate_return_receipt", &incorp); rv = GetIntValue("incorporate_return_receipt", &incorp);
else else
{ {
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv); rv = m_prefBranch->GetIntPref("mail.incorporate.return_receipt", &incorp);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrefBranch> prefBranch;
rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
NS_ENSURE_SUCCESS(rv, rv);
rv = prefBranch->GetIntPref("mail.incorporate.return_receipt", &incorp);
} }
PRBool enable = (incorp == nsIMsgMdnGenerator::eIncorporateSent); PRBool enable = (incorp == nsIMsgMdnGenerator::eIncorporateSent);
@ -1930,9 +1940,10 @@ nsMsgIncomingServer::SetSpamSettings(nsISpamSettings *aSpamSettings)
NS_ENSURE_SUCCESS(rv,rv); NS_ENSURE_SUCCESS(rv,rv);
// flush these pref changes to disk // flush these pref changes to disk
rv = m_prefs->SavePrefFile(nsnull); nsCOMPtr<nsIPrefService> prefService = do_QueryInterface(m_prefBranch);
NS_ENSURE_SUCCESS(rv,rv); NS_ENSURE_TRUE(prefService, NS_ERROR_FAILURE);
return NS_OK;
return prefService->SavePrefFile(nsnull);
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -40,7 +40,7 @@
#define nsMsgIncomingServer_h__ #define nsMsgIncomingServer_h__
#include "nsIMsgIncomingServer.h" #include "nsIMsgIncomingServer.h"
#include "nsIPref.h" #include "nsIPrefBranch.h"
#include "nsIMsgFilterList.h" #include "nsIMsgFilterList.h"
#include "msgCore.h" #include "msgCore.h"
#include "nsIFolder.h" #include "nsIFolder.h"
@ -97,11 +97,9 @@ protected:
nsresult getProtocolInfo(nsIMsgProtocolInfo **aResult); nsresult getProtocolInfo(nsIMsgProtocolInfo **aResult);
nsCOMPtr <nsIFileSpec> mFilterFile; nsCOMPtr <nsIFileSpec> mFilterFile;
nsCOMPtr <nsIMsgFilterList> mFilterList; nsCOMPtr <nsIMsgFilterList> mFilterList;
// pref callback to clear the user prefs
static void clearPrefEnum(const char *aPref, void *aClosure);
private: private:
nsIPref *m_prefs; nsIPrefBranch *m_prefBranch;
nsCString m_password; nsCString m_password;
PRUint32 m_biffState; PRUint32 m_biffState;
PRPackedBool m_serverBusy; PRPackedBool m_serverBusy;

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

@ -485,7 +485,7 @@ RRT_HEADER:
} }
/* for Netscape Server, Accept-Language data sent in Mail header */ /* for Netscape Server, Accept-Language data sent in Mail header */
char *acceptlang = nsMsgI18NGetAcceptLanguage(); const char *acceptlang = nsMsgI18NGetAcceptLanguage();
if( (acceptlang != NULL) && ( *acceptlang != '\0') ){ if( (acceptlang != NULL) && ( *acceptlang != '\0') ){
PUSH_STRING( "X-Accept-Language: " ); PUSH_STRING( "X-Accept-Language: " );
PUSH_STRING( acceptlang ); PUSH_STRING( acceptlang );