зеркало из https://github.com/mozilla/pjs.git
bug 226005: MailNews should use the newer nsIPrefService APIs instead of nsIPref
patch by Mikael Parknert <mikael@parknert.se>, r=niel, sr=darin
This commit is contained in:
Родитель
bacc532f02
Коммит
57c9a2c3da
|
@ -44,7 +44,8 @@
|
||||||
#include "nsIAbCard.h"
|
#include "nsIAbCard.h"
|
||||||
#include "nsAbBaseCID.h"
|
#include "nsAbBaseCID.h"
|
||||||
#include "nsAbAddressCollecter.h"
|
#include "nsAbAddressCollecter.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranchInternal.h"
|
||||||
#include "nsIAddrBookSession.h"
|
#include "nsIAddrBookSession.h"
|
||||||
#include "nsIMsgHeaderParser.h"
|
#include "nsIMsgHeaderParser.h"
|
||||||
#include "nsIRDFService.h"
|
#include "nsIRDFService.h"
|
||||||
|
@ -54,7 +55,7 @@
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "nsIAddressBook.h"
|
#include "nsIAddressBook.h"
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(nsAbAddressCollecter, nsIAbAddressCollecter)
|
NS_IMPL_ISUPPORTS2(nsAbAddressCollecter, nsIAbAddressCollecter, nsIObserver)
|
||||||
|
|
||||||
#define PREF_MAIL_COLLECT_ADDRESSBOOK "mail.collect_addressbook"
|
#define PREF_MAIL_COLLECT_ADDRESSBOOK "mail.collect_addressbook"
|
||||||
|
|
||||||
|
@ -69,6 +70,11 @@ nsAbAddressCollecter::~nsAbAddressCollecter()
|
||||||
m_database->Close(PR_FALSE);
|
m_database->Close(PR_FALSE);
|
||||||
m_database = nsnull;
|
m_database = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIPrefBranchInternal> pPrefBranchInt(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
if(NS_SUCCEEDED(rv))
|
||||||
|
pPrefBranchInt->RemoveObserver(PREF_MAIL_COLLECT_ADDRESSBOOK, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsAbAddressCollecter::CollectUnicodeAddress(const PRUnichar *aAddress, PRBool aCreateCard, PRUint32 aSendFormat)
|
NS_IMETHODIMP nsAbAddressCollecter::CollectUnicodeAddress(const PRUnichar *aAddress, PRBool aCreateCard, PRUint32 aSendFormat)
|
||||||
|
@ -296,33 +302,30 @@ nsresult nsAbAddressCollecter::SplitFullName(const char *fullName, char **firstN
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PR_CALLBACK
|
NS_IMETHODIMP nsAbAddressCollecter::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
|
||||||
nsAbAddressCollecter::collectAddressBookPrefChanged(const char *aNewpref, void *aData)
|
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsCOMPtr<nsIPrefBranchInternal> pPrefBranchInt = do_QueryInterface(aSubject);
|
||||||
nsAbAddressCollecter *adCol = (nsAbAddressCollecter *) aData;
|
NS_ASSERTION(pPrefBranchInt, "failed to get prefs");
|
||||||
nsCOMPtr<nsIPref> pPref = do_GetService(NS_PREF_CONTRACTID, &rv);
|
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get prefs");
|
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
nsXPIDLCString prefVal;
|
nsXPIDLCString prefVal;
|
||||||
rv = pPref->GetCharPref(PREF_MAIL_COLLECT_ADDRESSBOOK, getter_Copies(prefVal));
|
pPrefBranchInt->GetCharPref(PREF_MAIL_COLLECT_ADDRESSBOOK, getter_Copies(prefVal));
|
||||||
rv = adCol->SetAbURI((NS_FAILED(rv) || prefVal.IsEmpty()) ? kPersonalAddressbookUri : prefVal.get());
|
rv = SetAbURI(prefVal.IsEmpty() ? kPersonalAddressbookUri : prefVal.get());
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to change collected ab");
|
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to change collected ab");
|
||||||
return 0;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsAbAddressCollecter::Init(void)
|
nsresult nsAbAddressCollecter::Init(void)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIPref> pPref = do_GetService(NS_PREF_CONTRACTID, &rv);
|
nsCOMPtr<nsIPrefBranchInternal> pPrefBranchInt(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
rv = pPref->RegisterCallback(PREF_MAIL_COLLECT_ADDRESSBOOK, collectAddressBookPrefChanged, this);
|
rv = pPrefBranchInt->AddObserver(PREF_MAIL_COLLECT_ADDRESSBOOK, this, PR_FALSE);
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
|
||||||
|
|
||||||
nsXPIDLCString prefVal;
|
nsXPIDLCString prefVal;
|
||||||
rv = pPref->GetCharPref(PREF_MAIL_COLLECT_ADDRESSBOOK, getter_Copies(prefVal));
|
pPrefBranchInt->GetCharPref(PREF_MAIL_COLLECT_ADDRESSBOOK, getter_Copies(prefVal));
|
||||||
rv = SetAbURI((NS_FAILED(rv) || prefVal.IsEmpty()) ? kPersonalAddressbookUri : prefVal.get());
|
rv = SetAbURI(prefVal.IsEmpty() ? kPersonalAddressbookUri : prefVal.get());
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,10 @@
|
||||||
#include "nsIAddrDatabase.h"
|
#include "nsIAddrDatabase.h"
|
||||||
#include "nsIAbDirectory.h"
|
#include "nsIAbDirectory.h"
|
||||||
#include "nsIAbCard.h"
|
#include "nsIAbCard.h"
|
||||||
|
#include "nsIObserver.h"
|
||||||
|
|
||||||
class nsAbAddressCollecter : public nsIAbAddressCollecter
|
class nsAbAddressCollecter : public nsIAbAddressCollecter,
|
||||||
|
public nsIObserver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsAbAddressCollecter();
|
nsAbAddressCollecter();
|
||||||
|
@ -53,11 +55,11 @@ public:
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIABADDRESSCOLLECTER
|
NS_DECL_NSIABADDRESSCOLLECTER
|
||||||
|
NS_DECL_NSIOBSERVER
|
||||||
|
|
||||||
nsresult Init();
|
nsresult Init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int PR_CALLBACK collectAddressBookPrefChanged(const char *newpref, void *data);
|
|
||||||
nsresult AddCardToAddressBook(nsIAbCard *card);
|
nsresult AddCardToAddressBook(nsIAbCard *card);
|
||||||
nsresult AutoCollectScreenName(nsIAbCard *aCard, const char *aEmail, PRBool *aModifiedCard);
|
nsresult AutoCollectScreenName(nsIAbCard *aCard, const char *aEmail, PRBool *aModifiedCard);
|
||||||
nsresult SetNamesForCard(nsIAbCard *senderCard, const char *fullName, PRBool *aModifiedCard);
|
nsresult SetNamesForCard(nsIAbCard *senderCard, const char *fullName, PRBool *aModifiedCard);
|
||||||
|
|
|
@ -52,7 +52,8 @@
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "nsNetCID.h"
|
#include "nsNetCID.h"
|
||||||
#include "nsIIOService.h"
|
#include "nsIIOService.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS2(nsAbAutoCompleteSession, nsIAbAutoCompleteSession, nsIAutoCompleteSession)
|
NS_IMPL_ISUPPORTS2(nsAbAutoCompleteSession, nsIAbAutoCompleteSession, nsIAutoCompleteSession)
|
||||||
|
|
||||||
|
@ -521,19 +522,8 @@ nsresult nsAbAutoCompleteSession::SearchCards(nsIAbDirectory* directory, nsAbAut
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
static nsresult
|
||||||
nsAbAutoCompleteSession::NeedToSearchLocalDirectories(nsIPref *aPrefs, PRBool *aNeedToSearch)
|
NeedToSearchReplicatedLDAPDirectories(nsIPrefBranch *aPrefs, PRBool *aNeedToSearch)
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aPrefs);
|
|
||||||
NS_ENSURE_ARG_POINTER(aNeedToSearch);
|
|
||||||
|
|
||||||
nsresult rv = aPrefs->GetBoolPref("mail.enable_autocomplete", aNeedToSearch);
|
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsAbAutoCompleteSession::NeedToSearchReplicatedLDAPDirectories(nsIPref *aPrefs, PRBool *aNeedToSearch)
|
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aPrefs);
|
NS_ENSURE_ARG_POINTER(aPrefs);
|
||||||
NS_ENSURE_ARG_POINTER(aNeedToSearch);
|
NS_ENSURE_ARG_POINTER(aNeedToSearch);
|
||||||
|
@ -556,12 +546,12 @@ nsAbAutoCompleteSession::NeedToSearchReplicatedLDAPDirectories(nsIPref *aPrefs,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsAbAutoCompleteSession::SearchReplicatedLDAPDirectories(nsIPref *aPref, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results)
|
nsAbAutoCompleteSession::SearchReplicatedLDAPDirectories(nsIPrefBranch *aPref, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aPref);
|
NS_ENSURE_ARG_POINTER(aPref);
|
||||||
|
|
||||||
nsXPIDLCString prefName;
|
nsXPIDLCString prefName;
|
||||||
nsresult rv = aPref->CopyCharPref("ldap_2.autoComplete.directoryServer", getter_Copies(prefName));
|
nsresult rv = aPref->GetCharPref("ldap_2.autoComplete.directoryServer", getter_Copies(prefName));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
if (prefName.IsEmpty())
|
if (prefName.IsEmpty())
|
||||||
|
@ -572,7 +562,7 @@ nsAbAutoCompleteSession::SearchReplicatedLDAPDirectories(nsIPref *aPref, nsAbAut
|
||||||
fileNamePref = prefName + NS_LITERAL_CSTRING(".filename");
|
fileNamePref = prefName + NS_LITERAL_CSTRING(".filename");
|
||||||
|
|
||||||
nsXPIDLCString fileName;
|
nsXPIDLCString fileName;
|
||||||
rv = aPref->CopyCharPref(fileNamePref.get(), getter_Copies(fileName));
|
rv = aPref->GetCharPref(fileNamePref.get(), getter_Copies(fileName));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
// if there is no fileName, bail out now.
|
// if there is no fileName, bail out now.
|
||||||
|
@ -716,10 +706,11 @@ NS_IMETHODIMP nsAbAutoCompleteSession::OnStartLookup(const PRUnichar *uSearchStr
|
||||||
PRBool enableLocalAutocomplete;
|
PRBool enableLocalAutocomplete;
|
||||||
PRBool enableReplicatedLDAPAutocomplete;
|
PRBool enableReplicatedLDAPAutocomplete;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = NeedToSearchLocalDirectories(prefs, &enableLocalAutocomplete);
|
// check if using autocomplete for local address books
|
||||||
|
rv = prefs->GetBoolPref("mail.enable_autocomplete", &enableLocalAutocomplete);
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
rv = NeedToSearchReplicatedLDAPDirectories(prefs, &enableReplicatedLDAPAutocomplete);
|
rv = NeedToSearchReplicatedLDAPDirectories(prefs, &enableReplicatedLDAPAutocomplete);
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#include "nsIAbDirectory.h"
|
#include "nsIAbDirectory.h"
|
||||||
#include "nsIAbAutoCompleteSession.h"
|
#include "nsIAbAutoCompleteSession.h"
|
||||||
|
|
||||||
class nsIPref;
|
class nsIPrefBranch;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -131,9 +131,7 @@ private:
|
||||||
nsresult SearchDirectory(const nsACString& aURI, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results);
|
nsresult SearchDirectory(const nsACString& aURI, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results);
|
||||||
nsresult SearchPreviousResults(nsAbAutoCompleteSearchString *uSearchString, nsIAutoCompleteResults *previousSearchResult, nsIAutoCompleteResults* results);
|
nsresult SearchPreviousResults(nsAbAutoCompleteSearchString *uSearchString, nsIAutoCompleteResults *previousSearchResult, nsIAutoCompleteResults* results);
|
||||||
|
|
||||||
nsresult SearchReplicatedLDAPDirectories(nsIPref *aPrefs, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results);
|
nsresult SearchReplicatedLDAPDirectories(nsIPrefBranch *aPrefs, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results);
|
||||||
nsresult NeedToSearchReplicatedLDAPDirectories(nsIPref *aPrefs, PRBool *aNeedToSearch);
|
|
||||||
nsresult NeedToSearchLocalDirectories(nsIPref *aPrefs, PRBool *aNeedToSearch);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@
|
||||||
#include "nsAutoLock.h"
|
#include "nsAutoLock.h"
|
||||||
#include "nsNetCID.h"
|
#include "nsNetCID.h"
|
||||||
#include "nsIIOService.h"
|
#include "nsIIOService.h"
|
||||||
#include "nsIPref.h"
|
|
||||||
#include "nsXPCOM.h"
|
#include "nsXPCOM.h"
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
#include "nsIPrefBranch.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsCOMArray.h"
|
#include "nsCOMArray.h"
|
||||||
#include "nsArrayEnumerator.h"
|
#include "nsArrayEnumerator.h"
|
||||||
|
@ -120,7 +120,7 @@ nsresult nsAbLDAPDirectory::InitiateConnection ()
|
||||||
mURL = do_CreateInstance(NS_LDAPURL_CONTRACTID, &rv);
|
mURL = do_CreateInstance(NS_LDAPURL_CONTRACTID, &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// use mURINoQuery to get a prefName
|
// use mURINoQuery to get a prefName
|
||||||
|
@ -129,7 +129,7 @@ nsresult nsAbLDAPDirectory::InitiateConnection ()
|
||||||
|
|
||||||
// turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
|
// turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
|
||||||
nsXPIDLCString URI;
|
nsXPIDLCString URI;
|
||||||
rv = prefs->CopyCharPref(prefName.get(), getter_Copies(URI));
|
rv = prefs->GetCharPref(prefName.get(), getter_Copies(URI));
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -231,7 +231,7 @@ NS_IMETHODIMP nsAbLDAPDirectory::GetChildCards(nsIEnumerator** result)
|
||||||
nsCOMPtr <nsIRDFService> rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1",&rv);
|
nsCOMPtr <nsIRDFService> rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1",&rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// use mURINoQuery to get a prefName
|
// use mURINoQuery to get a prefName
|
||||||
|
@ -239,7 +239,7 @@ NS_IMETHODIMP nsAbLDAPDirectory::GetChildCards(nsIEnumerator** result)
|
||||||
prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".filename");
|
prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".filename");
|
||||||
|
|
||||||
nsXPIDLCString fileName;
|
nsXPIDLCString fileName;
|
||||||
rv = prefs->CopyCharPref(prefName.get(), getter_Copies(fileName));
|
rv = prefs->GetCharPref(prefName.get(), getter_Copies(fileName));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
// if there is no fileName, bail out now.
|
// if there is no fileName, bail out now.
|
||||||
|
@ -374,7 +374,7 @@ NS_IMETHODIMP nsAbLDAPDirectory::StartSearch ()
|
||||||
new nsAbDirSearchListener (this);
|
new nsAbDirSearchListener (this);
|
||||||
queryListener = _queryListener;
|
queryListener = _queryListener;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// use mURINoQuery to get a prefName
|
// use mURINoQuery to get a prefName
|
||||||
|
@ -480,7 +480,7 @@ NS_IMETHODIMP nsAbLDAPDirectory::GetIsSecure(PRBool *aIsSecure)
|
||||||
NS_ENSURE_ARG_POINTER(aIsSecure);
|
NS_ENSURE_ARG_POINTER(aIsSecure);
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// use mURINoQuery to get a prefName
|
// use mURINoQuery to get a prefName
|
||||||
|
|
|
@ -41,7 +41,9 @@
|
||||||
#include "nsMsgSearchAdapter.h"
|
#include "nsMsgSearchAdapter.h"
|
||||||
#include "nsMsgSearchScopeTerm.h"
|
#include "nsMsgSearchScopeTerm.h"
|
||||||
#include "nsMsgI18N.h"
|
#include "nsMsgI18N.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
#include "nsIPrefLocalizedString.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsMsgSearchTerm.h"
|
#include "nsMsgSearchTerm.h"
|
||||||
|
@ -326,22 +328,27 @@ nsresult
|
||||||
nsMsgSearchAdapter::GetSearchCharsets(PRUnichar **srcCharset, PRUnichar **dstCharset)
|
nsMsgSearchAdapter::GetSearchCharsets(PRUnichar **srcCharset, PRUnichar **dstCharset)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
nsAutoString destination;
|
||||||
NS_ENSURE_ARG(srcCharset);
|
NS_ENSURE_ARG(srcCharset);
|
||||||
NS_ENSURE_ARG(dstCharset);
|
NS_ENSURE_ARG(dstCharset);
|
||||||
|
|
||||||
if (m_defaultCharset.IsEmpty())
|
if (m_defaultCharset.IsEmpty())
|
||||||
{
|
{
|
||||||
m_forceAsciiSearch = PR_FALSE; // set the default value in case of error
|
m_forceAsciiSearch = PR_FALSE; // set the default value in case of error
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
rv = prefs->GetLocalizedUnicharPref("mailnews.view_default_charset", getter_Copies(m_defaultCharset));
|
nsCOMPtr<nsIPrefLocalizedString> localizedstr;
|
||||||
rv = prefs->GetBoolPref("mailnews.force_ascii_search", &m_forceAsciiSearch);
|
rv = prefs->GetComplexValue("mailnews.view_default_charset", NS_GET_IID(nsIPrefLocalizedString),
|
||||||
|
getter_AddRefs(localizedstr));
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
localizedstr->GetData(getter_Copies(m_defaultCharset));
|
||||||
|
|
||||||
|
prefs->GetBoolPref("mailnews.force_ascii_search", &m_forceAsciiSearch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*srcCharset = nsCRT::strdup(m_defaultCharset.IsEmpty() ?
|
*srcCharset = m_defaultCharset.IsEmpty() ?
|
||||||
NS_LITERAL_STRING("ISO-8859-1").get() : m_defaultCharset.get());
|
ToNewUnicode(NS_LITERAL_STRING("ISO-8859-1")) : ToNewUnicode(m_defaultCharset);
|
||||||
*dstCharset = nsCRT::strdup(*srcCharset);
|
|
||||||
|
|
||||||
if (m_scope)
|
if (m_scope)
|
||||||
{
|
{
|
||||||
|
@ -355,10 +362,13 @@ nsMsgSearchAdapter::GetSearchCharsets(PRUnichar **srcCharset, PRUnichar **dstCha
|
||||||
{
|
{
|
||||||
nsXPIDLCString folderCharset;
|
nsXPIDLCString folderCharset;
|
||||||
folder->GetCharset(getter_Copies(folderCharset));
|
folder->GetCharset(getter_Copies(folderCharset));
|
||||||
PR_Free(*dstCharset);
|
AppendASCIItoUTF16(folderCharset, destination);
|
||||||
*dstCharset = ToNewUnicode(folderCharset);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
destination.Assign(*srcCharset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// If
|
// If
|
||||||
|
@ -366,10 +376,9 @@ nsMsgSearchAdapter::GetSearchCharsets(PRUnichar **srcCharset, PRUnichar **dstCha
|
||||||
// the source. (CS_DEFAULT is an indication that the charset
|
// the source. (CS_DEFAULT is an indication that the charset
|
||||||
// was undefined or unavailable.)
|
// was undefined or unavailable.)
|
||||||
// ### well, it's not really anymore. Is there an equivalent?
|
// ### well, it's not really anymore. Is there an equivalent?
|
||||||
if (!nsCRT::strcmp(*dstCharset, m_defaultCharset.get()))
|
if (destination.Equals(m_defaultCharset))
|
||||||
{
|
{
|
||||||
PR_Free(*dstCharset);
|
destination.Assign(*srcCharset);
|
||||||
*dstCharset = nsCRT::strdup(*srcCharset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_forceAsciiSearch)
|
if (m_forceAsciiSearch)
|
||||||
|
@ -381,9 +390,10 @@ nsMsgSearchAdapter::GetSearchCharsets(PRUnichar **srcCharset, PRUnichar **dstCha
|
||||||
// If the dest csid is ISO Latin 1 or MacRoman, attempt to convert the
|
// If the dest csid is ISO Latin 1 or MacRoman, attempt to convert the
|
||||||
// source text to US-ASCII. (Not for now.)
|
// source text to US-ASCII. (Not for now.)
|
||||||
// if ((dst_csid == CS_LATIN1) || (dst_csid == CS_MAC_ROMAN))
|
// if ((dst_csid == CS_LATIN1) || (dst_csid == CS_MAC_ROMAN))
|
||||||
PR_Free(*dstCharset);
|
destination.AssignLiteral("us-ascii");
|
||||||
*dstCharset = nsCRT::strdup(NS_LITERAL_STRING("us-ascii").get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*dstCharset = ToNewUnicode(destination);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1084,12 +1094,12 @@ NS_IMETHODIMP nsMsgSearchValidityManager::GetTable (int whichTable, nsIMsgSearch
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(ppOutTable);
|
NS_ENSURE_ARG_POINTER(ppOutTable);
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv;
|
||||||
*ppOutTable = nsnull;
|
*ppOutTable = nsnull;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> pref = do_GetService(NS_PREF_CONTRACTID, &rv);
|
nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
nsXPIDLCString customHeaders;
|
nsXPIDLCString customHeaders;
|
||||||
if (NS_SUCCEEDED(rv) && pref)
|
if (NS_SUCCEEDED(rv))
|
||||||
pref->GetCharPref(PREF_CUSTOM_HEADERS, getter_Copies(customHeaders));
|
pref->GetCharPref(PREF_CUSTOM_HEADERS, getter_Copies(customHeaders));
|
||||||
|
|
||||||
switch (whichTable)
|
switch (whichTable)
|
||||||
|
|
|
@ -68,6 +68,9 @@
|
||||||
#include "nsIWeakReference.h"
|
#include "nsIWeakReference.h"
|
||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
#include "nsIAlertsService.h"
|
#include "nsIAlertsService.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
#include "nsISupportsPrimitives.h"
|
||||||
|
|
||||||
#ifdef MOZ_THUNDERBIRD
|
#ifdef MOZ_THUNDERBIRD
|
||||||
#define PROFILE_COMMANDLINE_ARG " -profile "
|
#define PROFILE_COMMANDLINE_ARG " -profile "
|
||||||
|
@ -328,13 +331,12 @@ nsMessengerWinIntegration::Init()
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
// get pref service
|
// get pref service
|
||||||
nsCOMPtr<nsIPref> prefService;
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
prefService = do_GetService(NS_PREF_CONTRACTID, &rv);
|
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
// first check the timer value
|
// first check the timer value
|
||||||
PRInt32 timerInterval;
|
PRInt32 timerInterval = 0;
|
||||||
prefService->GetIntPref(TIMER_INTERVAL_PREF, &timerInterval);
|
prefBranch->GetIntPref(TIMER_INTERVAL_PREF, &timerInterval);
|
||||||
|
|
||||||
// return if the timer value is negative or ZERO
|
// return if the timer value is negative or ZERO
|
||||||
if (timerInterval > 0)
|
if (timerInterval > 0)
|
||||||
|
@ -472,12 +474,11 @@ nsresult nsMessengerWinIntegration::ShowAlertMessage(const PRUnichar * aAlertTit
|
||||||
if (mAlertInProgress)
|
if (mAlertInProgress)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefService;
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
prefService = do_GetService(NS_PREF_CONTRACTID, &rv);
|
|
||||||
PRBool showAlert = PR_TRUE;
|
PRBool showAlert = PR_TRUE;
|
||||||
|
|
||||||
if (prefService)
|
if (prefBranch)
|
||||||
prefService->GetBoolPref(SHOW_ALERT_PREF, &showAlert);
|
prefBranch->GetBoolPref(SHOW_ALERT_PREF, &showAlert);
|
||||||
|
|
||||||
if (showAlert)
|
if (showAlert)
|
||||||
{
|
{
|
||||||
|
@ -1032,19 +1033,20 @@ nsMessengerWinIntegration::SetupInbox()
|
||||||
providerPrefixPref.Append(".unreadMailCountRegistryKeyPrefix");
|
providerPrefixPref.Append(".unreadMailCountRegistryKeyPrefix");
|
||||||
|
|
||||||
// get pref service
|
// get pref service
|
||||||
nsCOMPtr<nsIPref> prefService;
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
prefService = do_GetService(NS_PREF_CONTRACTID, &rv);
|
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
nsXPIDLString prefixValue;
|
nsCOMPtr<nsISupportsString> tmp;
|
||||||
prefService->CopyUnicharPref(providerPrefixPref.get(), getter_Copies(prefixValue));
|
rv = prefBranch->GetComplexValue(providerPrefixPref.get(), NS_GET_IID(nsISupportsString),
|
||||||
if (prefixValue.get())
|
getter_AddRefs(tmp));
|
||||||
mEmailPrefix.Assign(prefixValue);
|
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
tmp->GetData(mEmailPrefix);
|
||||||
else
|
else
|
||||||
mEmailPrefix.Truncate(0);
|
mEmailPrefix.Truncate();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mEmailPrefix.Truncate(0);
|
mEmailPrefix.Truncate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get user's email address
|
// Get user's email address
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIPref.h"
|
|
||||||
#include "nsInt64.h"
|
#include "nsInt64.h"
|
||||||
#include "nsISupportsArray.h"
|
#include "nsISupportsArray.h"
|
||||||
#include "nsIObserver.h"
|
#include "nsIObserver.h"
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include "nsMsgContentPolicy.h"
|
#include "nsMsgContentPolicy.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
#include "nsIPrefBranch.h"
|
|
||||||
#include "nsIPrefBranchInternal.h"
|
#include "nsIPrefBranchInternal.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
@ -96,11 +95,8 @@ nsMsgContentPolicy::nsMsgContentPolicy()
|
||||||
nsMsgContentPolicy::~nsMsgContentPolicy()
|
nsMsgContentPolicy::~nsMsgContentPolicy()
|
||||||
{
|
{
|
||||||
// hey, we are going away...clean up after ourself....unregister our observer
|
// hey, we are going away...clean up after ourself....unregister our observer
|
||||||
nsresult rv = NS_OK;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
nsCOMPtr<nsIPrefBranchInternal> prefInternal = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIPrefBranchInternal> prefInternal = do_QueryInterface(prefBranch, &rv);
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
prefInternal->RemoveObserver(kBlockRemoteImages, this);
|
prefInternal->RemoveObserver(kBlockRemoteImages, this);
|
||||||
|
@ -108,7 +104,6 @@ nsMsgContentPolicy::~nsMsgContentPolicy()
|
||||||
prefInternal->RemoveObserver(kRemoteImagesWhiteListURI, this);
|
prefInternal->RemoveObserver(kRemoteImagesWhiteListURI, this);
|
||||||
prefInternal->RemoveObserver(kAllowPlugins, this);
|
prefInternal->RemoveObserver(kAllowPlugins, this);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsMsgContentPolicy::Init()
|
nsresult nsMsgContentPolicy::Init()
|
||||||
|
@ -116,20 +111,18 @@ nsresult nsMsgContentPolicy::Init()
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
// register ourself as an observer on the mail preference to block remote images
|
// register ourself as an observer on the mail preference to block remote images
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
nsCOMPtr<nsIPrefBranchInternal> prefInternal = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIPrefBranchInternal> prefInternal = do_QueryInterface(prefBranch, &rv);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
prefInternal->AddObserver(kBlockRemoteImages, this, PR_TRUE);
|
prefInternal->AddObserver(kBlockRemoteImages, this, PR_TRUE);
|
||||||
prefInternal->AddObserver(kRemoteImagesUseWhiteList, this, PR_TRUE);
|
prefInternal->AddObserver(kRemoteImagesUseWhiteList, this, PR_TRUE);
|
||||||
prefInternal->AddObserver(kRemoteImagesWhiteListURI, this, PR_TRUE);
|
prefInternal->AddObserver(kRemoteImagesWhiteListURI, this, PR_TRUE);
|
||||||
prefInternal->AddObserver(kAllowPlugins, this, PR_TRUE);
|
prefInternal->AddObserver(kAllowPlugins, this, PR_TRUE);
|
||||||
|
|
||||||
prefBranch->GetBoolPref(kAllowPlugins, &mAllowPlugins);
|
prefInternal->GetBoolPref(kAllowPlugins, &mAllowPlugins);
|
||||||
prefBranch->GetBoolPref(kRemoteImagesUseWhiteList, &mUseRemoteImageWhiteList);
|
prefInternal->GetBoolPref(kRemoteImagesUseWhiteList, &mUseRemoteImageWhiteList);
|
||||||
prefBranch->GetCharPref(kRemoteImagesWhiteListURI, getter_Copies(mRemoteImageWhiteListURI));
|
prefInternal->GetCharPref(kRemoteImagesWhiteListURI, getter_Copies(mRemoteImageWhiteListURI));
|
||||||
return prefBranch->GetBoolPref(kBlockRemoteImages, &mBlockRemoteImages);
|
return prefInternal->GetBoolPref(kBlockRemoteImages, &mBlockRemoteImages);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsMsgContentPolicy::IsSenderInWhiteList(nsIMsgDBHdr * aMsgHdr, PRBool * aWhiteListed)
|
nsresult nsMsgContentPolicy::IsSenderInWhiteList(nsIMsgDBHdr * aMsgHdr, PRBool * aWhiteListed)
|
||||||
|
@ -299,21 +292,21 @@ nsMsgContentPolicy::ShouldProcess(PRUint32 aContentType,
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgContentPolicy::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
|
NS_IMETHODIMP nsMsgContentPolicy::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
|
|
||||||
if (!nsCRT::strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic))
|
if (!nsCRT::strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic))
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
NS_LossyConvertUCS2toASCII pref(aData);
|
NS_LossyConvertUCS2toASCII pref(aData);
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPrefBranchInternal> prefBranchInt = do_QueryInterface(aSubject, &rv);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (pref.Equals(kBlockRemoteImages))
|
if (pref.Equals(kBlockRemoteImages))
|
||||||
rv = prefBranch->GetBoolPref(kBlockRemoteImages, &mBlockRemoteImages);
|
prefBranchInt->GetBoolPref(kBlockRemoteImages, &mBlockRemoteImages);
|
||||||
else if (pref.Equals(kRemoteImagesUseWhiteList))
|
else if (pref.Equals(kRemoteImagesUseWhiteList))
|
||||||
prefBranch->GetBoolPref(kRemoteImagesUseWhiteList, &mUseRemoteImageWhiteList);
|
prefBranchInt->GetBoolPref(kRemoteImagesUseWhiteList, &mUseRemoteImageWhiteList);
|
||||||
else if (pref.Equals(kRemoteImagesWhiteListURI))
|
else if (pref.Equals(kRemoteImagesWhiteListURI))
|
||||||
prefBranch->GetCharPref(kRemoteImagesWhiteListURI, getter_Copies(mRemoteImageWhiteListURI));
|
prefBranchInt->GetCharPref(kRemoteImagesWhiteListURI, getter_Copies(mRemoteImageWhiteListURI));
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -52,7 +52,8 @@
|
||||||
#include "MailNewsTypes.h"
|
#include "MailNewsTypes.h"
|
||||||
#include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later...
|
#include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later...
|
||||||
#include "nsIFileChannel.h"
|
#include "nsIFileChannel.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
|
@ -103,7 +104,7 @@ nsresult nsStatusBarBiffManager::Init()
|
||||||
nsresult nsStatusBarBiffManager::PlayBiffSound()
|
nsresult nsStatusBarBiffManager::PlayBiffSound()
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIPref> pref = do_GetService(NS_PREF_CONTRACTID, &rv);
|
nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
PRBool playSoundOnBiff = PR_FALSE;
|
PRBool playSoundOnBiff = PR_FALSE;
|
||||||
|
|
|
@ -60,6 +60,9 @@
|
||||||
#include "nsIMimeConverter.h"
|
#include "nsIMimeConverter.h"
|
||||||
#include "nsMsgMimeCID.h"
|
#include "nsMsgMimeCID.h"
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
#include "nsISupportsPrimitives.h"
|
||||||
|
#include "nsIPrefLocalizedString.h"
|
||||||
#include "nsIRelativeFilePref.h"
|
#include "nsIRelativeFilePref.h"
|
||||||
#include "nsAppDirectoryServiceDefs.h"
|
#include "nsAppDirectoryServiceDefs.h"
|
||||||
#include "nsICategoryManager.h"
|
#include "nsICategoryManager.h"
|
||||||
|
@ -1029,3 +1032,47 @@ NS_MSG_BASE nsresult NS_SetPersistentFile(const char *relPrefName,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_MSG_BASE nsresult NS_GetUnicharPreferenceWithDefault(nsIPrefBranch *prefBranch, //can be null, if so uses the root branch
|
||||||
|
const char *prefName,
|
||||||
|
const nsString& defValue,
|
||||||
|
nsString& prefValue)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG(prefName);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPrefBranch> pbr;
|
||||||
|
if(!prefBranch) {
|
||||||
|
pbr = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
prefBranch = pbr;
|
||||||
|
}
|
||||||
|
nsCOMPtr<nsISupportsString> str;
|
||||||
|
|
||||||
|
nsresult rv = prefBranch->GetComplexValue(prefName, NS_GET_IID(nsISupportsString), getter_AddRefs(str));
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
return str->GetData(prefValue);
|
||||||
|
|
||||||
|
prefValue = defValue;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_MSG_BASE nsresult NS_GetLocalizedUnicharPreferenceWithDefault(nsIPrefBranch *prefBranch, //can be null, if so uses the root branch
|
||||||
|
const char *prefName,
|
||||||
|
const nsString& defValue,
|
||||||
|
nsXPIDLString& prefValue)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG(prefName);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPrefBranch> pbr;
|
||||||
|
if(!prefBranch) {
|
||||||
|
pbr = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
prefBranch = pbr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPrefLocalizedString> str;
|
||||||
|
|
||||||
|
nsresult rv = prefBranch->GetComplexValue(prefName, NS_GET_IID(nsIPrefLocalizedString), getter_AddRefs(str));
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
str->ToString(getter_Copies(prefValue));
|
||||||
|
else
|
||||||
|
prefValue = defValue;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
||||||
class nsILocalFile;
|
class nsILocalFile;
|
||||||
|
class nsIPrefBranch;
|
||||||
|
|
||||||
//These are utility functions that can used throughout the mailnews code
|
//These are utility functions that can used throughout the mailnews code
|
||||||
|
|
||||||
|
@ -100,6 +101,16 @@ NS_MSG_BASE nsresult CreateServicesForPasswordManager();
|
||||||
|
|
||||||
NS_MSG_BASE nsresult IsRFC822HeaderFieldName(const char *aHdr, PRBool *aResult);
|
NS_MSG_BASE nsresult IsRFC822HeaderFieldName(const char *aHdr, PRBool *aResult);
|
||||||
|
|
||||||
|
NS_MSG_BASE nsresult NS_GetUnicharPreferenceWithDefault(nsIPrefBranch *prefBranch, //can be null, if so uses the root branch
|
||||||
|
const char *prefName,
|
||||||
|
const nsString& defValue,
|
||||||
|
nsString& prefValue);
|
||||||
|
|
||||||
|
NS_MSG_BASE nsresult NS_GetLocalizedUnicharPreferenceWithDefault(nsIPrefBranch *prefBranch, //can be null, if so uses the root branch
|
||||||
|
const char *prefName,
|
||||||
|
const nsString& defValue,
|
||||||
|
nsXPIDLString& prefValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this needs a listener, because we might have to create the folder
|
* this needs a listener, because we might have to create the folder
|
||||||
* on the server, and that is asynchronous
|
* on the server, and that is asynchronous
|
||||||
|
|
|
@ -70,6 +70,7 @@ REQUIRES = xpcom \
|
||||||
intl \
|
intl \
|
||||||
uconv \
|
uconv \
|
||||||
mailnews \
|
mailnews \
|
||||||
|
pref \
|
||||||
widget \
|
widget \
|
||||||
msgdb \
|
msgdb \
|
||||||
appshell \
|
appshell \
|
||||||
|
|
|
@ -38,12 +38,12 @@
|
||||||
|
|
||||||
#include "nsMsgCompFields.h"
|
#include "nsMsgCompFields.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsIPref.h"
|
|
||||||
#include "nsMsgI18N.h"
|
#include "nsMsgI18N.h"
|
||||||
#include "nsMsgComposeStringBundle.h"
|
#include "nsMsgComposeStringBundle.h"
|
||||||
#include "nsMsgRecipientArray.h"
|
#include "nsMsgRecipientArray.h"
|
||||||
#include "nsIMsgHeaderParser.h"
|
#include "nsIMsgHeaderParser.h"
|
||||||
#include "nsMsgCompUtils.h"
|
#include "nsMsgCompUtils.h"
|
||||||
|
#include "nsMsgUtils.h"
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "nsIFileChannel.h"
|
#include "nsIFileChannel.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
|
@ -70,18 +70,13 @@ nsMsgCompFields::nsMsgCompFields()
|
||||||
m_receiptHeaderType = nsIMsgMdnGenerator::eDntType;
|
m_receiptHeaderType = nsIMsgMdnGenerator::eDntType;
|
||||||
m_bodyIsAsciiOnly = PR_FALSE;
|
m_bodyIsAsciiOnly = PR_FALSE;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID));
|
|
||||||
if (prefs)
|
|
||||||
{
|
|
||||||
// Get the default charset from pref, use this as a mail charset.
|
// Get the default charset from pref, use this as a mail charset.
|
||||||
nsXPIDLString charset;
|
nsXPIDLString charset;
|
||||||
prefs->GetLocalizedUnicharPref("mailnews.send_default_charset", getter_Copies(charset));
|
NS_GetLocalizedUnicharPreferenceWithDefault(nsnull, "mailnews.send_default_charset",
|
||||||
if (charset.IsEmpty())
|
NS_LITERAL_STRING("ISO-8859-1"), charset);
|
||||||
m_DefaultCharacterSet.Assign("ISO-8859-1");
|
|
||||||
else
|
|
||||||
LossyCopyUTF16toASCII(charset, m_DefaultCharacterSet); // Charsets better be ASCII
|
LossyCopyUTF16toASCII(charset, m_DefaultCharacterSet); // Charsets better be ASCII
|
||||||
SetCharacterSet(m_DefaultCharacterSet.get());
|
SetCharacterSet(m_DefaultCharacterSet.get());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMsgCompFields::~nsMsgCompFields()
|
nsMsgCompFields::~nsMsgCompFields()
|
||||||
|
|
|
@ -37,8 +37,8 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsMsgCompUtils.h"
|
#include "nsMsgCompUtils.h"
|
||||||
#include "nsIPref.h"
|
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
#include "nsIFileSpec.h"
|
#include "nsIFileSpec.h"
|
||||||
|
@ -64,7 +64,6 @@
|
||||||
#include "nsIMsgCompUtils.h"
|
#include "nsIMsgCompUtils.h"
|
||||||
#include "nsIMsgMdnGenerator.h"
|
#include "nsIMsgMdnGenerator.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
|
||||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||||
static NS_DEFINE_CID(kHTTPHandlerCID, NS_HTTPPROTOCOLHANDLER_CID);
|
static NS_DEFINE_CID(kHTTPHandlerCID, NS_HTTPPROTOCOLHANDLER_CID);
|
||||||
|
|
||||||
|
@ -172,9 +171,9 @@ nsMsgMIMESetConformToStandard (PRBool conform_p)
|
||||||
mime_headers_use_quoted_printable_p = PR_TRUE;
|
mime_headers_use_quoted_printable_p = PR_TRUE;
|
||||||
else {
|
else {
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (NS_SUCCEEDED(rv) && prefs) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
rv = prefs->GetBoolPref("mail.strictly_mime_headers", &mime_headers_use_quoted_printable_p);
|
prefs->GetBoolPref("mail.strictly_mime_headers", &mime_headers_use_quoted_printable_p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,7 +279,7 @@ mime_generate_headers (nsMsgCompFields *fields,
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
*status = 0;
|
*status = 0;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
*status = rv;
|
*status = rv;
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
@ -1622,8 +1621,6 @@ msg_make_filename_qtext(const char *srcText, PRBool stripCRLFs)
|
||||||
void
|
void
|
||||||
msg_pick_real_name (nsMsgAttachmentHandler *attachment, const PRUnichar *proposedName, const char *charset)
|
msg_pick_real_name (nsMsgAttachmentHandler *attachment, const PRUnichar *proposedName, const char *charset)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
|
||||||
const char *s, *s2;
|
const char *s, *s2;
|
||||||
char *s3;
|
char *s3;
|
||||||
|
|
||||||
|
@ -1670,7 +1667,10 @@ msg_pick_real_name (nsMsgAttachmentHandler *attachment, const PRUnichar *propose
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 parmFolding = 0;
|
PRInt32 parmFolding = 0;
|
||||||
if (NS_SUCCEEDED(rv) && prefs)
|
nsresult rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
prefs->GetIntPref("mail.strictly_mime.parm_folding", &parmFolding);
|
prefs->GetIntPref("mail.strictly_mime.parm_folding", &parmFolding);
|
||||||
|
|
||||||
if (parmFolding == 0 || parmFolding == 1)
|
if (parmFolding == 0 || parmFolding == 1)
|
||||||
|
@ -1965,10 +1965,10 @@ GetFolderURIFromUserPrefs(nsMsgDeliverMode aMode, nsIMsgIdentity* identity)
|
||||||
|
|
||||||
if (aMode == nsIMsgSend::nsMsgQueueForLater) // QueueForLater (Outbox)
|
if (aMode == nsIMsgSend::nsMsgQueueForLater) // QueueForLater (Outbox)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (NS_FAILED(rv) || !prefs)
|
if (NS_FAILED(rv))
|
||||||
return nsnull;
|
return nsnull;
|
||||||
rv = prefs->CopyCharPref("mail.default_sendlater_uri", &uri);
|
rv = prefs->GetCharPref("mail.default_sendlater_uri", &uri);
|
||||||
if (NS_FAILED(rv) || !uri)
|
if (NS_FAILED(rv) || !uri)
|
||||||
{
|
{
|
||||||
uri = PR_smprintf("%s", ANY_SERVER);
|
uri = PR_smprintf("%s", ANY_SERVER);
|
||||||
|
@ -2132,13 +2132,10 @@ PRBool UseFormatFlowed(const char *charset)
|
||||||
PRBool disableForCertainCharsets = PR_TRUE;
|
PRBool disableForCertainCharsets = PR_TRUE;
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
if(prefs)
|
|
||||||
{
|
|
||||||
|
|
||||||
rv = prefs->GetBoolPref("mailnews.send_plaintext_flowed", &sendFlowed);
|
rv = prefs->GetBoolPref("mailnews.send_plaintext_flowed", &sendFlowed);
|
||||||
if (NS_SUCCEEDED(rv) && !sendFlowed)
|
if (NS_SUCCEEDED(rv) && !sendFlowed)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
@ -2151,12 +2148,6 @@ PRBool UseFormatFlowed(const char *charset)
|
||||||
&disableForCertainCharsets);
|
&disableForCertainCharsets);
|
||||||
if (NS_SUCCEEDED(rv) && !disableForCertainCharsets)
|
if (NS_SUCCEEDED(rv) && !disableForCertainCharsets)
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No prefs service. Be careful. Don't use format=flowed.
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Just the check for charset left.
|
// Just the check for charset left.
|
||||||
|
|
||||||
|
@ -2171,6 +2162,4 @@ PRBool UseFormatFlowed(const char *charset)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,8 @@
|
||||||
#include "nsICharsetConverterManager.h"
|
#include "nsICharsetConverterManager.h"
|
||||||
#include "nsMsgCompCID.h"
|
#include "nsMsgCompCID.h"
|
||||||
#include "nsMsgQuote.h"
|
#include "nsMsgQuote.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsIDocumentEncoder.h" // for editor output flags
|
#include "nsIDocumentEncoder.h" // for editor output flags
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "nsIMsgHeaderParser.h"
|
#include "nsIMsgHeaderParser.h"
|
||||||
|
@ -123,47 +124,28 @@
|
||||||
// Defines....
|
// Defines....
|
||||||
static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
||||||
|
|
||||||
static nsresult GetReplyHeaderInfo(PRInt32* reply_header_type,
|
static void GetReplyHeaderInfo(PRInt32* reply_header_type,
|
||||||
PRUnichar** reply_header_locale,
|
nsString& reply_header_locale,
|
||||||
PRUnichar** reply_header_authorwrote,
|
nsXPIDLString& reply_header_authorwrote,
|
||||||
PRUnichar** reply_header_ondate,
|
nsXPIDLString& reply_header_ondate,
|
||||||
PRUnichar** reply_header_separator,
|
nsString& reply_header_separator,
|
||||||
PRUnichar** reply_header_colon,
|
nsString& reply_header_colon,
|
||||||
PRUnichar** reply_header_originalmessage)
|
nsXPIDLString& reply_header_originalmessage)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID));
|
|
||||||
if (prefs) {
|
|
||||||
rv = prefs->GetIntPref("mailnews.reply_header_type", reply_header_type);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
*reply_header_type = 1;
|
*reply_header_type = 1;
|
||||||
|
if(NS_SUCCEEDED(rv)) {
|
||||||
|
prefBranch->GetIntPref("mailnews.reply_header_type", reply_header_type);
|
||||||
|
|
||||||
rv = prefs->CopyUnicharPref("mailnews.reply_header_locale", reply_header_locale);
|
NS_GetUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_locale", EmptyString(), reply_header_locale);
|
||||||
if (NS_FAILED(rv) || !*reply_header_locale)
|
NS_GetLocalizedUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_authorwrote", NS_LITERAL_STRING("%s wrote"), reply_header_authorwrote);
|
||||||
*reply_header_locale = nsCRT::strdup(EmptyString().get());
|
NS_GetLocalizedUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_ondate", NS_LITERAL_STRING("On %s"), reply_header_ondate);
|
||||||
|
NS_GetUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_separator", NS_LITERAL_STRING(", "), reply_header_separator);
|
||||||
rv = prefs->GetLocalizedUnicharPref("mailnews.reply_header_authorwrote", reply_header_authorwrote);
|
NS_GetUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_colon", NS_LITERAL_STRING(":"), reply_header_colon);
|
||||||
if (NS_FAILED(rv) || !*reply_header_authorwrote)
|
NS_GetLocalizedUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_originalmessage", NS_LITERAL_STRING("--- Original Message ---"), reply_header_originalmessage);
|
||||||
*reply_header_authorwrote = nsCRT::strdup(NS_LITERAL_STRING("%s wrote").get());
|
|
||||||
|
|
||||||
rv = prefs->GetLocalizedUnicharPref("mailnews.reply_header_ondate", reply_header_ondate);
|
|
||||||
if (NS_FAILED(rv) || !*reply_header_ondate)
|
|
||||||
*reply_header_ondate = nsCRT::strdup(NS_LITERAL_STRING("On %s").get());
|
|
||||||
|
|
||||||
rv = prefs->CopyUnicharPref("mailnews.reply_header_separator", reply_header_separator);
|
|
||||||
if (NS_FAILED(rv) || !*reply_header_separator)
|
|
||||||
*reply_header_separator = nsCRT::strdup(NS_LITERAL_STRING(", ").get());
|
|
||||||
|
|
||||||
rv = prefs->CopyUnicharPref("mailnews.reply_header_colon", reply_header_colon);
|
|
||||||
if (NS_FAILED(rv) || !*reply_header_colon)
|
|
||||||
*reply_header_colon = nsCRT::strdup(NS_LITERAL_STRING(":").get());
|
|
||||||
|
|
||||||
rv = prefs->GetLocalizedUnicharPref("mailnews.reply_header_originalmessage", reply_header_originalmessage);
|
|
||||||
if (NS_FAILED(rv) || !*reply_header_originalmessage)
|
|
||||||
*reply_header_originalmessage = nsCRT::strdup(NS_LITERAL_STRING("--- Original Message ---").get());
|
|
||||||
}
|
}
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsresult RemoveDuplicateAddresses(const char * addresses, const char * anothersAddresses, PRBool removeAliasesToMe, char** newAddress)
|
static nsresult RemoveDuplicateAddresses(const char * addresses, const char * anothersAddresses, PRBool removeAliasesToMe, char** newAddress)
|
||||||
|
@ -245,9 +227,9 @@ nsMsgCompose::nsMsgCompose()
|
||||||
// For TagConvertible
|
// For TagConvertible
|
||||||
// Read and cache pref
|
// Read and cache pref
|
||||||
mConvertStructs = PR_FALSE;
|
mConvertStructs = PR_FALSE;
|
||||||
nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID));
|
nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||||
if (prefs)
|
if (prefBranch)
|
||||||
prefs->GetBoolPref("converter.html2txt.structs", &mConvertStructs);
|
prefBranch->GetBoolPref("converter.html2txt.structs", &mConvertStructs);
|
||||||
|
|
||||||
m_composeHTML = PR_FALSE;
|
m_composeHTML = PR_FALSE;
|
||||||
mRecycledWindow = PR_TRUE;
|
mRecycledWindow = PR_TRUE;
|
||||||
|
@ -1025,10 +1007,10 @@ NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity
|
||||||
m_compFields->GetSubject(msgSubject);
|
m_compFields->GetSubject(msgSubject);
|
||||||
|
|
||||||
PRBool showProgress = PR_FALSE;
|
PRBool showProgress = PR_FALSE;
|
||||||
nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID));
|
nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||||
if (prefs)
|
if (prefBranch)
|
||||||
{
|
{
|
||||||
prefs->GetBoolPref("mailnews.show_send_progress", &showProgress);
|
prefBranch->GetBoolPref("mailnews.show_send_progress", &showProgress);
|
||||||
if (showProgress)
|
if (showProgress)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMsgComposeProgressParams> params = do_CreateInstance(NS_MSGCOMPOSEPROGRESSPARAMS_CONTRACTID, &rv);
|
nsCOMPtr<nsIMsgComposeProgressParams> params = do_CreateInstance(NS_MSGCOMPOSEPROGRESSPARAMS_CONTRACTID, &rv);
|
||||||
|
@ -1405,10 +1387,10 @@ NS_IMETHODIMP nsMsgCompose::GetComposeHTML(PRBool *aComposeHTML)
|
||||||
nsresult nsMsgCompose::GetWrapLength(PRInt32 *aWrapLength)
|
nsresult nsMsgCompose::GetWrapLength(PRInt32 *aWrapLength)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
return prefs->GetIntPref("mailnews.wraplength", aWrapLength);
|
return prefBranch->GetIntPref("mailnews.wraplength", aWrapLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
|
@ -1555,7 +1537,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
nsCAutoString originCharset(charset);
|
nsCAutoString originCharset(charset);
|
||||||
|
|
||||||
// use send_default_charset if reply_in_default_charset is on.
|
// use send_default_charset if reply_in_default_charset is on.
|
||||||
nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID));
|
nsCOMPtr<nsIPrefBranch> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||||
if (prefs)
|
if (prefs)
|
||||||
{
|
{
|
||||||
PRBool replyInDefault = PR_FALSE;
|
PRBool replyInDefault = PR_FALSE;
|
||||||
|
@ -1563,9 +1545,9 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
&replyInDefault);
|
&replyInDefault);
|
||||||
if (replyInDefault) {
|
if (replyInDefault) {
|
||||||
nsXPIDLString str;
|
nsXPIDLString str;
|
||||||
rv = prefs->GetLocalizedUnicharPref("mailnews.send_default_charset",
|
NS_GetLocalizedUnicharPreferenceWithDefault(prefs, "mailnews.send_default_charset",
|
||||||
getter_Copies(str));
|
EmptyString(), str);
|
||||||
if (NS_SUCCEEDED(rv) && !str.IsEmpty())
|
if (!str.IsEmpty())
|
||||||
LossyCopyUTF16toASCII(str, charset);
|
LossyCopyUTF16toASCII(str, charset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1824,20 +1806,20 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
||||||
|
|
||||||
PRBool header, headerDate;
|
PRBool header, headerDate;
|
||||||
PRInt32 replyHeaderType;
|
PRInt32 replyHeaderType;
|
||||||
nsXPIDLString replyHeaderLocale;
|
nsAutoString replyHeaderLocale;
|
||||||
nsXPIDLString replyHeaderAuthorwrote;
|
nsXPIDLString replyHeaderAuthorwrote;
|
||||||
nsXPIDLString replyHeaderOndate;
|
nsXPIDLString replyHeaderOndate;
|
||||||
nsXPIDLString replyHeaderSeparator;
|
nsAutoString replyHeaderSeparator;
|
||||||
nsXPIDLString replyHeaderColon;
|
nsAutoString replyHeaderColon;
|
||||||
|
|
||||||
// Get header type, locale and strings from pref.
|
// Get header type, locale and strings from pref.
|
||||||
rv = GetReplyHeaderInfo(&replyHeaderType,
|
GetReplyHeaderInfo(&replyHeaderType,
|
||||||
getter_Copies(replyHeaderLocale),
|
replyHeaderLocale,
|
||||||
getter_Copies(replyHeaderAuthorwrote),
|
replyHeaderAuthorwrote,
|
||||||
getter_Copies(replyHeaderOndate),
|
replyHeaderOndate,
|
||||||
getter_Copies(replyHeaderSeparator),
|
replyHeaderSeparator,
|
||||||
getter_Copies(replyHeaderColon),
|
replyHeaderColon,
|
||||||
getter_Copies(replyHeaderOriginalmessage));
|
replyHeaderOriginalmessage);
|
||||||
|
|
||||||
switch (replyHeaderType)
|
switch (replyHeaderType)
|
||||||
{
|
{
|
||||||
|
@ -1963,22 +1945,22 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
||||||
|
|
||||||
if (mCitePrefix.IsEmpty())
|
if (mCitePrefix.IsEmpty())
|
||||||
{
|
{
|
||||||
if (!replyHeaderOriginalmessage)
|
if (replyHeaderOriginalmessage.IsEmpty())
|
||||||
{
|
{
|
||||||
// This is not likely to happen but load the string if it's not done already.
|
// This is not likely to happen but load the string if it's not done already.
|
||||||
PRInt32 replyHeaderType;
|
PRInt32 replyHeaderType;
|
||||||
nsXPIDLString replyHeaderLocale;
|
nsAutoString replyHeaderLocale;
|
||||||
nsXPIDLString replyHeaderAuthorwrote;
|
nsXPIDLString replyHeaderAuthorwrote;
|
||||||
nsXPIDLString replyHeaderOndate;
|
nsXPIDLString replyHeaderOndate;
|
||||||
nsXPIDLString replyHeaderSeparator;
|
nsAutoString replyHeaderSeparator;
|
||||||
nsXPIDLString replyHeaderColon;
|
nsAutoString replyHeaderColon;
|
||||||
rv = GetReplyHeaderInfo(&replyHeaderType,
|
GetReplyHeaderInfo(&replyHeaderType,
|
||||||
getter_Copies(replyHeaderLocale),
|
replyHeaderLocale,
|
||||||
getter_Copies(replyHeaderAuthorwrote),
|
replyHeaderAuthorwrote,
|
||||||
getter_Copies(replyHeaderOndate),
|
replyHeaderOndate,
|
||||||
getter_Copies(replyHeaderSeparator),
|
replyHeaderSeparator,
|
||||||
getter_Copies(replyHeaderColon),
|
replyHeaderColon,
|
||||||
getter_Copies(replyHeaderOriginalmessage));
|
replyHeaderOriginalmessage);
|
||||||
}
|
}
|
||||||
mCitePrefix.AppendLiteral("\n\n");
|
mCitePrefix.AppendLiteral("\n\n");
|
||||||
mCitePrefix.Append(replyHeaderOriginalmessage);
|
mCitePrefix.Append(replyHeaderOriginalmessage);
|
||||||
|
@ -4085,18 +4067,17 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
||||||
*/
|
*/
|
||||||
nsAutoString recipientsStr;
|
nsAutoString recipientsStr;
|
||||||
nsAutoString nonHtmlRecipientsStr;
|
nsAutoString nonHtmlRecipientsStr;
|
||||||
nsAutoString plaintextDomains;
|
nsXPIDLString plaintextDomains;
|
||||||
nsAutoString htmlDomains;
|
nsXPIDLString htmlDomains;
|
||||||
nsAutoString domain;
|
nsAutoString domain;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID));
|
nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||||
if (prefs)
|
if (prefBranch)
|
||||||
{
|
{
|
||||||
nsXPIDLString str;
|
NS_GetLocalizedUnicharPreferenceWithDefault(prefBranch, "mailnews.plaintext_domains", EmptyString(),
|
||||||
prefs->CopyUnicharPref("mailnews.plaintext_domains", getter_Copies(str));
|
plaintextDomains);
|
||||||
plaintextDomains = str;
|
NS_GetLocalizedUnicharPreferenceWithDefault(prefBranch, "mailnews.html_domains", EmptyString(),
|
||||||
prefs->CopyUnicharPref("mailnews.html_domains", getter_Copies(str));
|
htmlDomains);
|
||||||
htmlDomains = str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool atLeastOneRecipientPrefersUnknown = PR_FALSE;
|
PRBool atLeastOneRecipientPrefersUnknown = PR_FALSE;
|
||||||
|
|
|
@ -70,7 +70,8 @@
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsIDocShellTreeOwner.h"
|
#include "nsIDocShellTreeOwner.h"
|
||||||
#include "nsIBaseWindow.h"
|
#include "nsIBaseWindow.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsIPrefBranchInternal.h"
|
#include "nsIPrefBranchInternal.h"
|
||||||
|
|
||||||
#include "nsMsgBaseCID.h"
|
#include "nsMsgBaseCID.h"
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
#include "nsSmtpServer.h"
|
#include "nsSmtpServer.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
|
@ -59,9 +60,11 @@ NS_INTERFACE_MAP_BEGIN(nsSmtpServer)
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISmtpServer)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISmtpServer)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
nsSmtpServer::nsSmtpServer()
|
nsSmtpServer::nsSmtpServer():
|
||||||
|
mKey("")
|
||||||
{
|
{
|
||||||
m_logonFailed = PR_FALSE;
|
m_logonFailed = PR_FALSE;
|
||||||
|
getPrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSmtpServer::~nsSmtpServer()
|
nsSmtpServer::~nsSmtpServer()
|
||||||
|
@ -82,7 +85,33 @@ nsSmtpServer::GetKey(char * *aKey)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::SetKey(const char * aKey)
|
nsSmtpServer::SetKey(const char * aKey)
|
||||||
{
|
{
|
||||||
|
NS_ASSERTION(aKey, "Bad key pointer");
|
||||||
mKey = aKey;
|
mKey = aKey;
|
||||||
|
return getPrefs();
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult nsSmtpServer::getPrefs()
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIPrefService> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
nsCAutoString branchName;
|
||||||
|
branchName.AssignLiteral("mail.smtpserver.");
|
||||||
|
branchName += mKey;
|
||||||
|
branchName.Append('.');
|
||||||
|
rv = prefs->GetBranch(branchName.get(), getter_AddRefs(mPrefBranch));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
if(!mDefPrefBranch) {
|
||||||
|
branchName.AssignLiteral("mail.smtpserver.default.");
|
||||||
|
rv = prefs->GetBranch(branchName.get(), getter_AddRefs(mDefPrefBranch));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,13 +119,8 @@ NS_IMETHODIMP
|
||||||
nsSmtpServer::GetHostname(char * *aHostname)
|
nsSmtpServer::GetHostname(char * *aHostname)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCAutoString pref;
|
|
||||||
NS_ENSURE_ARG_POINTER(aHostname);
|
NS_ENSURE_ARG_POINTER(aHostname);
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
rv = mPrefBranch->GetCharPref("hostname", aHostname);
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
getPrefString("hostname", pref);
|
|
||||||
rv = prefs->CopyCharPref(pref.get(), aHostname);
|
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
*aHostname=nsnull;
|
*aHostname=nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -105,16 +129,10 @@ nsSmtpServer::GetHostname(char * *aHostname)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::SetHostname(const char * aHostname)
|
nsSmtpServer::SetHostname(const char * aHostname)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
nsCAutoString pref;
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
getPrefString("hostname", pref);
|
|
||||||
if (aHostname)
|
if (aHostname)
|
||||||
return prefs->SetCharPref(pref.get(), aHostname);
|
return mPrefBranch->SetCharPref("hostname", aHostname);
|
||||||
else
|
else
|
||||||
prefs->ClearUserPref(pref.get());
|
mPrefBranch->ClearUserPref("hostname");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,13 +141,8 @@ NS_IMETHODIMP
|
||||||
nsSmtpServer::GetPort(PRInt32 *aPort)
|
nsSmtpServer::GetPort(PRInt32 *aPort)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCAutoString pref;
|
|
||||||
NS_ENSURE_ARG_POINTER(aPort);
|
NS_ENSURE_ARG_POINTER(aPort);
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
rv = mPrefBranch->GetIntPref("port", aPort);
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
getPrefString("port", pref);
|
|
||||||
rv = prefs->GetIntPref(pref.get(), aPort);
|
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
*aPort = 0;
|
*aPort = 0;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -138,16 +151,10 @@ nsSmtpServer::GetPort(PRInt32 *aPort)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::SetPort(PRInt32 aPort)
|
nsSmtpServer::SetPort(PRInt32 aPort)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
nsCAutoString pref;
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
getPrefString("port", pref);
|
|
||||||
if (aPort)
|
if (aPort)
|
||||||
return prefs->SetIntPref(pref.get(), aPort);
|
return mPrefBranch->SetIntPref("port", aPort);
|
||||||
else
|
else
|
||||||
prefs->ClearUserPref(pref.get());
|
mPrefBranch->ClearUserPref("port");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,143 +164,89 @@ nsSmtpServer::GetDisplayname(char * *aDisplayname)
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_ENSURE_ARG_POINTER(aDisplayname);
|
NS_ENSURE_ARG_POINTER(aDisplayname);
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
nsCAutoString hpref;
|
|
||||||
getPrefString("hostname", hpref);
|
|
||||||
|
|
||||||
nsCAutoString ppref;
|
|
||||||
getPrefString("port", ppref);
|
|
||||||
|
|
||||||
nsXPIDLCString hostname;
|
nsXPIDLCString hostname;
|
||||||
rv = prefs->CopyCharPref(hpref.get(), getter_Copies(hostname));
|
rv = mPrefBranch->GetCharPref("hostname", getter_Copies(hostname));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
*aDisplayname=nsnull;
|
*aDisplayname=nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
PRInt32 port;
|
PRInt32 port;
|
||||||
rv = prefs->GetIntPref(ppref.get(), &port);
|
rv = mPrefBranch->GetIntPref("port", &port);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
port = 0;
|
port = 0;
|
||||||
|
|
||||||
if (port) {
|
if (port) {
|
||||||
nsCAutoString combined;
|
hostname.Append(':');
|
||||||
combined = hostname.get();
|
hostname.AppendInt(port);
|
||||||
combined += ":";
|
|
||||||
combined.AppendInt(port);
|
|
||||||
*aDisplayname = ToNewCString(combined);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*aDisplayname = ToNewCString(hostname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*aDisplayname = ToNewCString(hostname);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::GetTrySSL(PRInt32 *trySSL)
|
nsSmtpServer::GetTrySSL(PRInt32 *trySSL)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
nsCAutoString pref;
|
|
||||||
NS_ENSURE_ARG_POINTER(trySSL);
|
NS_ENSURE_ARG_POINTER(trySSL);
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
return getIntPrefWithDefault("try_ssl", trySSL, 0);
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
*trySSL= 0;
|
|
||||||
getPrefString("try_ssl", pref);
|
|
||||||
rv = prefs->GetIntPref(pref.get(), trySSL);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
getDefaultIntPref(prefs, 0, "try_ssl", trySSL);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::SetTrySSL(PRInt32 trySSL)
|
nsSmtpServer::SetTrySSL(PRInt32 trySSL)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
return mPrefBranch->SetIntPref("try_ssl", trySSL);
|
||||||
nsCAutoString pref;
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
getPrefString("try_ssl", pref);
|
|
||||||
return prefs->SetIntPref(pref.get(), trySSL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::GetTrySecAuth(PRBool *trySecAuth)
|
nsSmtpServer::GetTrySecAuth(PRBool *trySecAuth)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCAutoString pref;
|
|
||||||
NS_ENSURE_ARG_POINTER(trySecAuth);
|
NS_ENSURE_ARG_POINTER(trySecAuth);
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
*trySecAuth = PR_TRUE;
|
*trySecAuth = PR_TRUE;
|
||||||
getPrefString("trySecAuth", pref);
|
rv = mPrefBranch->GetBoolPref("trySecAuth", trySecAuth);
|
||||||
rv = prefs->GetBoolPref(pref.get(), trySecAuth);
|
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
prefs->GetBoolPref("mail.smtpserver.default.trySecAuth", trySecAuth);
|
mDefPrefBranch->GetBoolPref("trySecAuth", trySecAuth);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::GetAuthMethod(PRInt32 *authMethod)
|
nsSmtpServer::GetAuthMethod(PRInt32 *authMethod)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
nsCAutoString pref;
|
|
||||||
NS_ENSURE_ARG_POINTER(authMethod);
|
NS_ENSURE_ARG_POINTER(authMethod);
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
return getIntPrefWithDefault("auth_method", authMethod, 1);
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
*authMethod = 1;
|
|
||||||
getPrefString("auth_method", pref);
|
|
||||||
rv = prefs->GetIntPref(pref.get(), authMethod);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
rv = getDefaultIntPref(prefs, 1, "auth_method", authMethod);
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSmtpServer::getDefaultIntPref(nsIPref *prefs,
|
nsSmtpServer::getIntPrefWithDefault(const char *prefName,
|
||||||
PRInt32 defVal,
|
PRInt32 *val,
|
||||||
const char *prefName,
|
PRInt32 defVal)
|
||||||
PRInt32 *val)
|
|
||||||
{
|
{
|
||||||
// mail.smtpserver.default.<prefName>
|
nsresult rv = mPrefBranch->GetIntPref(prefName, val);
|
||||||
nsCAutoString fullPrefName;
|
if (NS_SUCCEEDED(rv))
|
||||||
fullPrefName = "mail.smtpserver.default.";
|
return NS_OK;
|
||||||
fullPrefName.Append(prefName);
|
|
||||||
nsresult rv = prefs->GetIntPref(fullPrefName.get(), val);
|
rv = mDefPrefBranch->GetIntPref(prefName, val);
|
||||||
|
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
{ // last resort
|
{ // last resort
|
||||||
*val = defVal;
|
*val = defVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::SetAuthMethod(PRInt32 authMethod)
|
nsSmtpServer::SetAuthMethod(PRInt32 authMethod)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
return mPrefBranch->SetIntPref("auth_method", authMethod);
|
||||||
nsCAutoString pref;
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
getPrefString("auth_method", pref);
|
|
||||||
return prefs->SetIntPref(pref.get(), authMethod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::GetUsername(char * *aUsername)
|
nsSmtpServer::GetUsername(char * *aUsername)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCAutoString pref;
|
|
||||||
NS_ENSURE_ARG_POINTER(aUsername);
|
NS_ENSURE_ARG_POINTER(aUsername);
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
rv = mPrefBranch->GetCharPref("username", aUsername);
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
getPrefString("username", pref);
|
|
||||||
rv = prefs->CopyCharPref(pref.get(), aUsername);
|
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
*aUsername = nsnull;
|
*aUsername = nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -302,16 +255,10 @@ nsSmtpServer::GetUsername(char * *aUsername)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::SetUsername(const char * aUsername)
|
nsSmtpServer::SetUsername(const char * aUsername)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
nsCAutoString pref;
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
getPrefString("username", pref);
|
|
||||||
if (aUsername)
|
if (aUsername)
|
||||||
return prefs->SetCharPref(pref.get(), aUsername);
|
return mPrefBranch->SetCharPref("username", aUsername);
|
||||||
else
|
else
|
||||||
prefs->ClearUserPref(pref.get());
|
mPrefBranch->ClearUserPref("username");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,15 +283,10 @@ nsSmtpServer::GetPassword(char * *aPassword)
|
||||||
// is everything after the first '.'
|
// is everything after the first '.'
|
||||||
// user_pref("mail.smtp.useMatchingDomainServer", true);
|
// user_pref("mail.smtp.useMatchingDomainServer", true);
|
||||||
|
|
||||||
nsresult rv;
|
|
||||||
nsCAutoString accountKeyPref;
|
|
||||||
nsXPIDLCString accountKey;
|
nsXPIDLCString accountKey;
|
||||||
PRBool useMatchingHostNameServer = PR_FALSE;
|
PRBool useMatchingHostNameServer = PR_FALSE;
|
||||||
PRBool useMatchingDomainServer = PR_FALSE;
|
PRBool useMatchingDomainServer = PR_FALSE;
|
||||||
getPrefString("incomingAccount", accountKeyPref);
|
mPrefBranch->GetCharPref("incomingAccount", getter_Copies(accountKey));
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
prefBranch->GetCharPref(accountKeyPref.get(), getter_Copies(accountKey));
|
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgAccountManager> accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID);
|
nsCOMPtr<nsIMsgAccountManager> accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID);
|
||||||
nsCOMPtr<nsIMsgIncomingServer> incomingServerToUse;
|
nsCOMPtr<nsIMsgIncomingServer> incomingServerToUse;
|
||||||
|
@ -356,6 +298,9 @@ nsSmtpServer::GetPassword(char * *aPassword)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
prefBranch->GetBoolPref("mail.smtp.useMatchingHostNameServer", &useMatchingHostNameServer);
|
prefBranch->GetBoolPref("mail.smtp.useMatchingHostNameServer", &useMatchingHostNameServer);
|
||||||
prefBranch->GetBoolPref("mail.smtp.useMatchingDomainServer", &useMatchingDomainServer);
|
prefBranch->GetBoolPref("mail.smtp.useMatchingDomainServer", &useMatchingDomainServer);
|
||||||
if (useMatchingHostNameServer || useMatchingDomainServer)
|
if (useMatchingHostNameServer || useMatchingDomainServer)
|
||||||
|
@ -378,7 +323,7 @@ nsSmtpServer::GetPassword(char * *aPassword)
|
||||||
{
|
{
|
||||||
PRUint32 count = 0;
|
PRUint32 count = 0;
|
||||||
allServers->Count(&count);
|
allServers->Count(&count);
|
||||||
PRInt32 i;
|
PRUint32 i;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryElementAt(allServers, i);
|
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryElementAt(allServers, i);
|
||||||
|
@ -601,30 +546,13 @@ nsSmtpServer::GetServerURI(char **aResult)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsSmtpServer::getPrefString(const char *pref, nsCAutoString& result)
|
|
||||||
{
|
|
||||||
result = "mail.smtpserver.";
|
|
||||||
result += mKey;
|
|
||||||
result += ".";
|
|
||||||
result += pref;
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::SetRedirectorType(const char *aRedirectorType)
|
nsSmtpServer::SetRedirectorType(const char *aRedirectorType)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
nsCAutoString pref;
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
getPrefString("redirector_type", pref);
|
|
||||||
if (aRedirectorType)
|
if (aRedirectorType)
|
||||||
return prefs->SetCharPref(pref.get(), aRedirectorType);
|
return mPrefBranch->SetCharPref("redirector_type", aRedirectorType);
|
||||||
else
|
|
||||||
prefs->ClearUserPref(pref.get());
|
mPrefBranch->ClearUserPref("redirector_type");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,17 +560,8 @@ NS_IMETHODIMP
|
||||||
nsSmtpServer::GetRedirectorType(char **aResult)
|
nsSmtpServer::GetRedirectorType(char **aResult)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr <nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch;
|
rv = mPrefBranch->GetCharPref("redirector_type", aResult);
|
||||||
rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
|
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
|
||||||
|
|
||||||
nsCAutoString prefName;
|
|
||||||
getPrefString("redirector_type", prefName);
|
|
||||||
|
|
||||||
rv = prefBranch->GetCharPref(prefName.get(), aResult);
|
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
*aResult = nsnull;
|
*aResult = nsnull;
|
||||||
|
|
||||||
|
@ -671,9 +590,12 @@ nsSmtpServer::GetRedirectorType(char **aResult)
|
||||||
rv = GetHostname(getter_Copies(hostName));
|
rv = GetHostname(getter_Copies(hostName));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
prefName.Assign("default_redirector_type.smtp.");
|
nsCAutoString prefName;
|
||||||
|
prefName.AssignLiteral("default_redirector_type.smtp.");
|
||||||
prefName.Append(hostName);
|
prefName.Append(hostName);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
nsXPIDLCString defaultRedirectorType;
|
nsXPIDLCString defaultRedirectorType;
|
||||||
rv = prefBranch->GetCharPref(prefName.get(), getter_Copies(defaultRedirectorType));
|
rv = prefBranch->GetCharPref(prefName.get(), getter_Copies(defaultRedirectorType));
|
||||||
if (NS_SUCCEEDED(rv) && !defaultRedirectorType.IsEmpty())
|
if (NS_SUCCEEDED(rv) && !defaultRedirectorType.IsEmpty())
|
||||||
|
@ -690,21 +612,5 @@ nsSmtpServer::GetRedirectorType(char **aResult)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::ClearAllValues()
|
nsSmtpServer::ClearAllValues()
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
return mPrefBranch->DeleteBranch("");
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
nsCAutoString rootPref("mail.smtpserver.");
|
|
||||||
rootPref += mKey;
|
|
||||||
|
|
||||||
rv = prefs->EnumerateChildren(rootPref.get(), clearPrefEnum, (void *)prefs.get());
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsSmtpServer::clearPrefEnum(const char *aPref, void *aClosure)
|
|
||||||
{
|
|
||||||
nsIPref *prefs = (nsIPref *)aClosure;
|
|
||||||
prefs->ClearUserPref(aPref);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsISmtpServer.h"
|
#include "nsISmtpServer.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsWeakReference.h"
|
#include "nsWeakReference.h"
|
||||||
|
|
||||||
class nsSmtpServer : public nsISmtpServer,
|
class nsSmtpServer : public nsISmtpServer,
|
||||||
|
@ -55,13 +56,13 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsCString mKey;
|
nsCString mKey;
|
||||||
|
nsCOMPtr<nsIPrefBranch> mPrefBranch;
|
||||||
|
nsCOMPtr<nsIPrefBranch> mDefPrefBranch;
|
||||||
|
|
||||||
nsresult getPrefString(const char *pref, nsCAutoString& result);
|
nsresult getPrefs();
|
||||||
nsresult getDefaultIntPref(nsIPref *prefs, PRInt32 defVal, const char *prefName, PRInt32 *val);
|
nsresult getIntPrefWithDefault(const char *prefName, PRInt32 *val, PRInt32 defval);
|
||||||
nsCString m_password;
|
nsCString m_password;
|
||||||
PRBool m_logonFailed;
|
PRBool m_logonFailed;
|
||||||
static void clearPrefEnum(const char *aPref, void *aClosure);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,7 +39,8 @@
|
||||||
#include "msgCore.h" // precompiled header...
|
#include "msgCore.h" // precompiled header...
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsIIOService.h"
|
#include "nsIIOService.h"
|
||||||
#include "nsIPipe.h"
|
#include "nsIPipe.h"
|
||||||
#include "nsNetCID.h"
|
#include "nsNetCID.h"
|
||||||
|
@ -68,6 +69,7 @@
|
||||||
#define MAIL_ROOT_PREF "mail."
|
#define MAIL_ROOT_PREF "mail."
|
||||||
#define PREF_MAIL_SMTPSERVERS "mail.smtpservers"
|
#define PREF_MAIL_SMTPSERVERS "mail.smtpservers"
|
||||||
#define PREF_MAIL_SMTPSERVERS_APPEND_SERVERS "mail.smtpservers.appendsmtpservers"
|
#define PREF_MAIL_SMTPSERVERS_APPEND_SERVERS "mail.smtpservers.appendsmtpservers"
|
||||||
|
#define PREF_MAIL_SMTP_DEFAULTSERVER "mail.smtp.defaultserver"
|
||||||
|
|
||||||
typedef struct _findServerByKeyEntry {
|
typedef struct _findServerByKeyEntry {
|
||||||
const char *key;
|
const char *key;
|
||||||
|
@ -383,12 +385,15 @@ nsSmtpService::loadSmtpServers()
|
||||||
if (mSmtpServersLoaded) return NS_OK;
|
if (mSmtpServersLoaded) return NS_OK;
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefService> prefService(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefRootBranch;
|
||||||
|
prefService->GetBranch(nsnull, getter_AddRefs(prefRootBranch));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsXPIDLCString tempServerList;
|
nsXPIDLCString tempServerList;
|
||||||
nsXPIDLCString serverList;
|
nsXPIDLCString serverList;
|
||||||
rv = prefs->CopyCharPref(PREF_MAIL_SMTPSERVERS, getter_Copies(tempServerList));
|
rv = prefRootBranch->GetCharPref(PREF_MAIL_SMTPSERVERS, getter_Copies(tempServerList));
|
||||||
|
|
||||||
//Get the pref in a tempServerList and then parse it to see if it has dupes.
|
//Get the pref in a tempServerList and then parse it to see if it has dupes.
|
||||||
//if so remove the dupes and then create the serverList.
|
//if so remove the dupes and then create the serverList.
|
||||||
|
@ -422,8 +427,7 @@ nsSmtpService::loadSmtpServers()
|
||||||
// We need to check if we have any pre-configured smtp servers so that
|
// We need to check if we have any pre-configured smtp servers so that
|
||||||
// those servers can be appended to the list.
|
// those servers can be appended to the list.
|
||||||
nsXPIDLCString appendServerList;
|
nsXPIDLCString appendServerList;
|
||||||
rv = prefs->CopyCharPref(PREF_MAIL_SMTPSERVERS_APPEND_SERVERS,
|
rv = prefRootBranch->GetCharPref(PREF_MAIL_SMTPSERVERS_APPEND_SERVERS, getter_Copies(appendServerList));
|
||||||
getter_Copies(appendServerList));
|
|
||||||
|
|
||||||
// Get the list of smtp servers (either from regular pref i.e, mail.smtpservers or
|
// Get the list of smtp servers (either from regular pref i.e, mail.smtpservers or
|
||||||
// from preconfigured pref mail.smtpservers.appendsmtpservers) and create a keyed
|
// from preconfigured pref mail.smtpservers.appendsmtpservers) and create a keyed
|
||||||
|
@ -438,18 +442,18 @@ nsSmtpService::loadSmtpServers()
|
||||||
* is stored in mailnews.js file. If a given vendor needs to add more preconfigured
|
* is stored in mailnews.js file. If a given vendor needs to add more preconfigured
|
||||||
* smtp servers, the default version number can be increased. Comparing version
|
* smtp servers, the default version number can be increased. Comparing version
|
||||||
* number from user's prefs file and the default one from mailnews.js, we
|
* number from user's prefs file and the default one from mailnews.js, we
|
||||||
* can add new smp servers and any other version level changes that need to be done.
|
* can add new smtp servers and any other version level changes that need to be done.
|
||||||
*
|
*
|
||||||
* 2. pref("mail.smtpservers.appendsmtpservers", <comma separated servers list>);
|
* 2. pref("mail.smtpservers.appendsmtpservers", <comma separated servers list>);
|
||||||
* This pref contains the list of pre-configured smp servers that ISP/Vendor wants to
|
* This pref contains the list of pre-configured smp servers that ISP/Vendor wants to
|
||||||
* to add to the existing servers list.
|
* to add to the existing servers list.
|
||||||
*/
|
*/
|
||||||
nsCOMPtr<nsIPrefBranch> defaultsPrefBranch;
|
nsCOMPtr<nsIPrefBranch> defaultsPrefBranch;
|
||||||
rv = prefs->GetDefaultBranch(MAIL_ROOT_PREF, getter_AddRefs(defaultsPrefBranch));
|
rv = prefService->GetDefaultBranch(MAIL_ROOT_PREF, getter_AddRefs(defaultsPrefBranch));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch;
|
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||||
rv = prefs->GetBranch(MAIL_ROOT_PREF, getter_AddRefs(prefBranch));
|
rv = prefService->GetBranch(MAIL_ROOT_PREF, getter_AddRefs(prefBranch));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
PRInt32 appendSmtpServersCurrentVersion=0;
|
PRInt32 appendSmtpServersCurrentVersion=0;
|
||||||
|
@ -527,10 +531,10 @@ nsresult
|
||||||
nsSmtpService::saveKeyList()
|
nsSmtpService::saveKeyList()
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
return prefs->SetCharPref(PREF_MAIL_SMTPSERVERS, mServerKeyList.get());
|
return prefBranch->SetCharPref(PREF_MAIL_SMTPSERVERS, mServerKeyList.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -545,15 +549,12 @@ nsSmtpService::createKeyedServer(const char *key, nsISmtpServer** aResult)
|
||||||
server->SetKey(key);
|
server->SetKey(key);
|
||||||
mSmtpServers->AppendElement(server);
|
mSmtpServers->AppendElement(server);
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
if (mServerKeyList.IsEmpty())
|
if (mServerKeyList.IsEmpty())
|
||||||
mServerKeyList = key;
|
mServerKeyList = key;
|
||||||
else {
|
else {
|
||||||
mServerKeyList += ",";
|
mServerKeyList.Append(',');
|
||||||
mServerKeyList += key;
|
mServerKeyList += key;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (aResult) {
|
if (aResult) {
|
||||||
*aResult = server;
|
*aResult = server;
|
||||||
|
@ -594,13 +595,12 @@ nsSmtpService::GetDefaultServer(nsISmtpServer **aServer)
|
||||||
*aServer = nsnull;
|
*aServer = nsnull;
|
||||||
// always returns NS_OK, just leaving *aServer at nsnull
|
// always returns NS_OK, just leaving *aServer at nsnull
|
||||||
if (!mDefaultSmtpServer) {
|
if (!mDefaultSmtpServer) {
|
||||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// try to get it from the prefs
|
// try to get it from the prefs
|
||||||
nsXPIDLCString defaultServerKey;
|
nsXPIDLCString defaultServerKey;
|
||||||
rv = pref->CopyCharPref("mail.smtp.defaultserver",
|
rv = prefBranch->GetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, getter_Copies(defaultServerKey));
|
||||||
getter_Copies(defaultServerKey));
|
|
||||||
if (NS_SUCCEEDED(rv) &&
|
if (NS_SUCCEEDED(rv) &&
|
||||||
!defaultServerKey.IsEmpty()) {
|
!defaultServerKey.IsEmpty()) {
|
||||||
|
|
||||||
|
@ -630,7 +630,7 @@ nsSmtpService::GetDefaultServer(nsISmtpServer **aServer)
|
||||||
nsXPIDLCString serverKey;
|
nsXPIDLCString serverKey;
|
||||||
mDefaultSmtpServer->GetKey(getter_Copies(serverKey));
|
mDefaultSmtpServer->GetKey(getter_Copies(serverKey));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
pref->SetCharPref("mail.smtp.defaultserver", serverKey);
|
prefBranch->SetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, serverKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,8 +655,9 @@ nsSmtpService::SetDefaultServer(nsISmtpServer *aServer)
|
||||||
nsresult rv = aServer->GetKey(getter_Copies(serverKey));
|
nsresult rv = aServer->GetKey(getter_Copies(serverKey));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
pref->SetCharPref("mail.smtp.defaultserver", serverKey);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
prefBranch->SetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, serverKey);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
#include "nsIPrompt.h"
|
#include "nsIPrompt.h"
|
||||||
#include "nsIMsgCompUtils.h"
|
#include "nsIMsgCompUtils.h"
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
#include "nsIPrefBranchInternal.h"
|
|
||||||
#include "nsIPrefBranch.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,6 @@
|
||||||
|
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
#include "nsIPrefBranch.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsIPref.h"
|
|
||||||
#include "nsIPrefBranchInternal.h"
|
|
||||||
|
|
||||||
#include "nspr.h"
|
#include "nspr.h"
|
||||||
PRLogModuleInfo *PALMSYNC;
|
PRLogModuleInfo *PALMSYNC;
|
||||||
|
|
|
@ -68,7 +68,6 @@
|
||||||
#include "EudoraDebugLog.h"
|
#include "EudoraDebugLog.h"
|
||||||
|
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
#include "nsIPref.h"
|
|
||||||
#include "nsMsgUtils.h"
|
#include "nsMsgUtils.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID( kMsgSendCID, NS_MSGSEND_CID);
|
static NS_DEFINE_CID( kMsgSendCID, NS_MSGSEND_CID);
|
||||||
|
@ -619,7 +618,7 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg)
|
||||||
ExtractCharset( headerVal);
|
ExtractCharset( headerVal);
|
||||||
// Use platform charset as default if the msg doesn't specify one
|
// Use platform charset as default if the msg doesn't specify one
|
||||||
// (ie, no 'charset' param in the Content-Type: header). As the last
|
// (ie, no 'charset' param in the Content-Type: header). As the last
|
||||||
// resort we'll use the mail defaul charset.
|
// resort we'll use the mail default charset.
|
||||||
if (headerVal.IsEmpty())
|
if (headerVal.IsEmpty())
|
||||||
{
|
{
|
||||||
headerVal.AssignWithConversion(nsMsgI18NFileSystemCharset());
|
headerVal.AssignWithConversion(nsMsgI18NFileSystemCharset());
|
||||||
|
@ -628,10 +627,9 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg)
|
||||||
if (m_defCharset.IsEmpty())
|
if (m_defCharset.IsEmpty())
|
||||||
{
|
{
|
||||||
nsXPIDLString defaultCharset;
|
nsXPIDLString defaultCharset;
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
NS_GetLocalizedUnicharPreferenceWithDefault(nsnull, "mailnews.view_default_charset",
|
||||||
if (NS_SUCCEEDED(rv))
|
NS_LITERAL_STRING("ISO-8859-1"), defaultCharset);
|
||||||
rv = prefs->GetLocalizedUnicharPref("mailnews.view_default_charset", getter_Copies(defaultCharset));
|
m_defCharset = defaultCharset;
|
||||||
m_defCharset.Assign(defaultCharset ? defaultCharset.get() : NS_LITERAL_STRING("ISO-8859-1").get());
|
|
||||||
}
|
}
|
||||||
headerVal = m_defCharset;
|
headerVal = m_defCharset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ REQUIRES = xpcom \
|
||||||
mork \
|
mork \
|
||||||
intl \
|
intl \
|
||||||
msgbase \
|
msgbase \
|
||||||
|
pref \
|
||||||
mailnews \
|
mailnews \
|
||||||
necko \
|
necko \
|
||||||
msgdb \
|
msgdb \
|
||||||
|
|
|
@ -69,7 +69,6 @@
|
||||||
#include "OutlookDebugLog.h"
|
#include "OutlookDebugLog.h"
|
||||||
|
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
#include "nsIPref.h"
|
|
||||||
#include "nsMsgUtils.h"
|
#include "nsMsgUtils.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID( kMsgSendCID, NS_MSGSEND_CID);
|
static NS_DEFINE_CID( kMsgSendCID, NS_MSGSEND_CID);
|
||||||
|
@ -623,17 +622,16 @@ nsresult nsOutlookCompose::SendTheMessage( nsIFileSpec *pMsg, nsMsgDeliverMode m
|
||||||
ExtractCharset( headerVal);
|
ExtractCharset( headerVal);
|
||||||
// Use platform charset as default if the msg doesn't specify one
|
// Use platform charset as default if the msg doesn't specify one
|
||||||
// (ie, no 'charset' param in the Content-Type: header). As the last
|
// (ie, no 'charset' param in the Content-Type: header). As the last
|
||||||
// resort we'll use the mail defaul charset.
|
// resort we'll use the mail default charset.
|
||||||
if (headerVal.IsEmpty())
|
if (headerVal.IsEmpty())
|
||||||
{
|
{
|
||||||
headerVal.AssignWithConversion(nsMsgI18NFileSystemCharset());
|
headerVal.AssignWithConversion(nsMsgI18NFileSystemCharset());
|
||||||
if (headerVal.IsEmpty())
|
if (headerVal.IsEmpty())
|
||||||
{ // last resort
|
{ // last resort
|
||||||
nsXPIDLString defaultCharset;
|
nsXPIDLString defaultCharset;
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
NS_GetLocalizedUnicharPreferenceWithDefault(nsnull, "mailnews.view_default_charset",
|
||||||
if (NS_SUCCEEDED(rv))
|
NS_LITERAL_STRING("ISO-8859-1"), defaultCharset);
|
||||||
rv = prefs->GetLocalizedUnicharPref("mailnews.view_default_charset", getter_Copies(defaultCharset));
|
headerVal = defaultCharset;
|
||||||
headerVal.Assign(defaultCharset.IsEmpty() ? NS_LITERAL_STRING("ISO-8859-1").get() : defaultCharset.get());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_pMsgFields->SetCharacterSet( NS_LossyConvertUTF16toASCII(headerVal).get() );
|
m_pMsgFields->SetCharacterSet( NS_LossyConvertUTF16toASCII(headerVal).get() );
|
||||||
|
|
|
@ -67,7 +67,8 @@
|
||||||
#include "nsTextStringBundle.h"
|
#include "nsTextStringBundle.h"
|
||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
#include "nsTextAddress.h"
|
#include "nsTextAddress.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "nsProxiedService.h"
|
#include "nsProxiedService.h"
|
||||||
#include "TextDebugLog.h"
|
#include "TextDebugLog.h"
|
||||||
|
@ -713,10 +714,10 @@ NS_IMETHODIMP ImportAddressImpl::InitFieldMap(nsIFileSpec *location, nsIImportFi
|
||||||
// from the same file format.
|
// from the same file format.
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (NS_SUCCEEDED( rv)) {
|
if (NS_SUCCEEDED( rv)) {
|
||||||
nsXPIDLCString prefStr;
|
nsXPIDLCString prefStr;
|
||||||
rv = prefs->CopyCharPref( "mailnews.import.text.fieldmap", getter_Copies(prefStr));
|
rv = prefs->GetCharPref( "mailnews.import.text.fieldmap", getter_Copies(prefStr));
|
||||||
if (NS_SUCCEEDED( rv)) {
|
if (NS_SUCCEEDED( rv)) {
|
||||||
const char *pStr = (const char *)prefStr;
|
const char *pStr = (const char *)prefStr;
|
||||||
if (pStr) {
|
if (pStr) {
|
||||||
|
@ -791,12 +792,12 @@ void ImportAddressImpl::SaveFieldMap( nsIImportFieldMap *pMap)
|
||||||
|
|
||||||
PRBool done = PR_FALSE;
|
PRBool done = PR_FALSE;
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
// NS_WITH_PROXIED_SERVICE( nsIPref, prefs, kPrefServiceCID, NS_UI_THREAD_EVENTQ, &rv);
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
|
||||||
if (NS_SUCCEEDED( rv)) {
|
if (NS_SUCCEEDED( rv)) {
|
||||||
nsXPIDLCString prefStr;
|
nsXPIDLCString prefStr;
|
||||||
rv = prefs->CopyCharPref( "mailnews.import.text.fieldmap", getter_Copies(prefStr));
|
rv = prefs->GetCharPref( "mailnews.import.text.fieldmap", getter_Copies(prefStr));
|
||||||
if (NS_SUCCEEDED( rv)) {
|
if (NS_SUCCEEDED( rv)) {
|
||||||
if (str.Equals(prefStr))
|
if (str.Equals(prefStr))
|
||||||
done = PR_TRUE;
|
done = PR_TRUE;
|
||||||
|
|
|
@ -65,7 +65,8 @@
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsMsgBaseCID.h"
|
#include "nsMsgBaseCID.h"
|
||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsUnicharUtils.h"
|
#include "nsUnicharUtils.h"
|
||||||
#include "nsIMsgAttachment.h"
|
#include "nsIMsgAttachment.h"
|
||||||
|
@ -299,10 +300,10 @@ nsMapiHook::IsBlindSendAllowed()
|
||||||
{
|
{
|
||||||
PRBool enabled = PR_FALSE;
|
PRBool enabled = PR_FALSE;
|
||||||
PRBool warn = PR_TRUE;
|
PRBool warn = PR_TRUE;
|
||||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID);
|
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
if (prefs) {
|
if (prefBranch) {
|
||||||
prefs->GetBoolPref(PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND,&warn);
|
prefBranch->GetBoolPref(PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND, &warn);
|
||||||
prefs->GetBoolPref(PREF_MAPI_BLIND_SEND_ENABLED,&enabled);
|
prefBranch->GetBoolPref(PREF_MAPI_BLIND_SEND_ENABLED, &enabled);
|
||||||
}
|
}
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
@ -335,11 +336,10 @@ nsMapiHook::IsBlindSendAllowed()
|
||||||
PRBool okayToContinue = PR_FALSE;
|
PRBool okayToContinue = PR_FALSE;
|
||||||
dlgService->ConfirmCheck(nsnull, nsnull, warningMsg, dontShowAgainMessage, &continueToWarn, &okayToContinue);
|
dlgService->ConfirmCheck(nsnull, nsnull, warningMsg, dontShowAgainMessage, &continueToWarn, &okayToContinue);
|
||||||
|
|
||||||
if (!continueToWarn && okayToContinue && prefs)
|
if (!continueToWarn && okayToContinue && prefBranch)
|
||||||
prefs->SetBoolPref(PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND,PR_FALSE);
|
prefBranch->SetBoolPref(PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND, PR_FALSE);
|
||||||
|
|
||||||
return okayToContinue;
|
return okayToContinue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is used for Send without UI
|
// this is used for Send without UI
|
||||||
|
|
|
@ -46,10 +46,6 @@
|
||||||
#include "nsICategoryManager.h"
|
#include "nsICategoryManager.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
|
||||||
#include "nsIPrefService.h"
|
|
||||||
#include "nsIPrefBranch.h"
|
|
||||||
#include "nsIPrefBranchInternal.h"
|
|
||||||
|
|
||||||
#include "msgMapiSupport.h"
|
#include "msgMapiSupport.h"
|
||||||
#include "nsMapiRegistryUtils.h"
|
#include "nsMapiRegistryUtils.h"
|
||||||
#include "nsMapiRegistry.h"
|
#include "nsMapiRegistry.h"
|
||||||
|
|
|
@ -53,7 +53,9 @@
|
||||||
#include "comi18n.h"
|
#include "comi18n.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIStringCharsetDetector.h"
|
#include "nsIStringCharsetDetector.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
#include "nsMsgUtils.h"
|
||||||
#include "mimebuf.h"
|
#include "mimebuf.h"
|
||||||
#include "nsMsgI18N.h"
|
#include "nsMsgI18N.h"
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
|
@ -239,11 +241,10 @@ PRInt32 generate_encodedwords(char *pUTF8, const char *charset, char method, cha
|
||||||
if (!nsCRT::strcasecmp("ISO-2022-JP", charset)) {
|
if (!nsCRT::strcasecmp("ISO-2022-JP", charset)) {
|
||||||
static PRInt32 conv_kana = -1;
|
static PRInt32 conv_kana = -1;
|
||||||
if (conv_kana < 0) {
|
if (conv_kana < 0) {
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (nsnull != prefs && NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
PRBool val;
|
PRBool val = PR_FALSE; // no pref means need the mapping
|
||||||
if (NS_FAILED(prefs->GetBoolPref("mailnews.send_hankaku_kana", &val)))
|
prefBranch->GetBoolPref("mailnews.send_hankaku_kana", &val);
|
||||||
val = PR_FALSE; // no pref means need the mapping
|
|
||||||
conv_kana = val ? 0 : 1;
|
conv_kana = val ? 0 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -753,24 +754,18 @@ char * NextChar_UTF8(char *str)
|
||||||
nsresult
|
nsresult
|
||||||
MIME_detect_charset(const char *aBuf, PRInt32 aLength, const char** aCharset)
|
MIME_detect_charset(const char *aBuf, PRInt32 aLength, const char** aCharset)
|
||||||
{
|
{
|
||||||
nsresult res;
|
nsresult res = NS_ERROR_UNEXPECTED;
|
||||||
char theBuffer[128];
|
|
||||||
nsFixedCString detector_contractid(theBuffer, sizeof(theBuffer), 0);
|
|
||||||
nsXPIDLString detector_name;
|
nsXPIDLString detector_name;
|
||||||
nsCOMPtr<nsIStringCharsetDetector> detector;
|
|
||||||
*aCharset = nsnull;
|
*aCharset = nsnull;
|
||||||
|
|
||||||
detector_contractid.Assign(NS_STRCDETECTOR_CONTRACTID_BASE);
|
NS_GetLocalizedUnicharPreferenceWithDefault(nsnull, "intl.charset.detector", EmptyString(), detector_name);
|
||||||
|
|
||||||
|
if (!detector_name.IsEmpty()) {
|
||||||
|
nsCAutoString detector_contractid;
|
||||||
|
detector_contractid.AssignLiteral(NS_STRCDETECTOR_CONTRACTID_BASE);
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
|
|
||||||
if (NS_SUCCEEDED(res)) {
|
|
||||||
if (NS_SUCCEEDED(prefs->GetLocalizedUnicharPref("intl.charset.detector", getter_Copies(detector_name)))) {
|
|
||||||
AppendUTF16toUTF8(detector_name, detector_contractid);
|
AppendUTF16toUTF8(detector_name, detector_contractid);
|
||||||
}
|
nsCOMPtr<nsIStringCharsetDetector> detector = do_CreateInstance(detector_contractid.get(), &res);
|
||||||
}
|
|
||||||
|
|
||||||
if (detector_contractid.Length() > sizeof(NS_STRCDETECTOR_CONTRACTID_BASE)) {
|
|
||||||
detector = do_CreateInstance(detector_contractid.get(), &res);
|
|
||||||
if (NS_SUCCEEDED(res)) {
|
if (NS_SUCCEEDED(res)) {
|
||||||
nsDetectionConfident oConfident;
|
nsDetectionConfident oConfident;
|
||||||
res = detector->DoIt(aBuf, aLength, aCharset, oConfident);
|
res = detector->DoIt(aBuf, aLength, aCharset, oConfident);
|
||||||
|
|
|
@ -56,7 +56,8 @@
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
#include "prio.h"
|
#include "prio.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "msgCore.h"
|
#include "msgCore.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
|
@ -107,8 +108,6 @@ static NS_DEFINE_CID(kCMsgComposeServiceCID, NS_MSGCOMPOSESERVICE_CID);
|
||||||
// THIS SHOULD ALL MOVE TO ANOTHER FILE AFTER LANDING!
|
// THIS SHOULD ALL MOVE TO ANOTHER FILE AFTER LANDING!
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Define CIDs...
|
|
||||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
|
||||||
|
|
||||||
// safe filename for all OSes
|
// safe filename for all OSes
|
||||||
#define SAFE_TMP_FILENAME "nsmime.tmp"
|
#define SAFE_TMP_FILENAME "nsmime.tmp"
|
||||||
|
@ -439,9 +438,9 @@ GetMailXlateionPreference(void)
|
||||||
nsresult res;
|
nsresult res;
|
||||||
PRBool xlate = PR_FALSE;
|
PRBool xlate = PR_FALSE;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &res));
|
||||||
if (NS_SUCCEEDED(res) && prefs)
|
if(NS_SUCCEEDED(res))
|
||||||
res = prefs->GetBoolPref("mail.unknown", &xlate);
|
prefBranch->GetBoolPref("mail.unknown", &xlate);
|
||||||
|
|
||||||
return xlate;
|
return xlate;
|
||||||
}
|
}
|
||||||
|
@ -454,9 +453,9 @@ GetMailSigningPreference(void)
|
||||||
nsresult res;
|
nsresult res;
|
||||||
PRBool signit = PR_FALSE;
|
PRBool signit = PR_FALSE;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &res));
|
||||||
if (NS_SUCCEEDED(res) && prefs)
|
if(NS_SUCCEEDED(res))
|
||||||
res = prefs->GetBoolPref("mail.unknown", &signit);
|
prefBranch->GetBoolPref("mail.unknown", &signit);
|
||||||
|
|
||||||
return signit;
|
return signit;
|
||||||
}
|
}
|
||||||
|
@ -1210,9 +1209,9 @@ mime_insert_forwarded_message_headers(char **body,
|
||||||
PRInt32 show_headers = 0;
|
PRInt32 show_headers = 0;
|
||||||
nsresult res;
|
nsresult res;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &res));
|
||||||
if (NS_SUCCEEDED(res) && prefs)
|
if (NS_SUCCEEDED(res))
|
||||||
res = prefs->GetIntPref("mail.show_headers", &show_headers);
|
prefBranch->GetIntPref("mail.show_headers", &show_headers);
|
||||||
|
|
||||||
switch (show_headers)
|
switch (show_headers)
|
||||||
{
|
{
|
||||||
|
@ -1652,10 +1651,10 @@ mime_parse_stream_complete (nsMIMESession *stream)
|
||||||
}
|
}
|
||||||
PR_FREEIF(mdd->mailcharset);
|
PR_FREEIF(mdd->mailcharset);
|
||||||
|
|
||||||
// Release the prefs service
|
// Release the prefbranch
|
||||||
MimeObject *obj = (mdd ? mdd->obj : 0);
|
MimeObject *obj = (mdd ? mdd->obj : 0);
|
||||||
if ( (obj) && (obj->options) && (obj->options->prefs) )
|
if ( (obj) && (obj->options))
|
||||||
obj->options->prefs->Release();
|
obj->options->m_prefBranch = 0;
|
||||||
|
|
||||||
mdd->identity = nsnull;
|
mdd->identity = nsnull;
|
||||||
PR_Free(mdd->url_name);
|
PR_Free(mdd->url_name);
|
||||||
|
@ -2107,7 +2106,7 @@ mime_bridge_create_draft_stream(
|
||||||
mdd->options->decompose_file_output_fn = mime_decompose_file_output_fn;
|
mdd->options->decompose_file_output_fn = mime_decompose_file_output_fn;
|
||||||
mdd->options->decompose_file_close_fn = mime_decompose_file_close_fn;
|
mdd->options->decompose_file_close_fn = mime_decompose_file_close_fn;
|
||||||
|
|
||||||
rv = CallGetService(kPrefCID, &(mdd->options->prefs));
|
mdd->options->m_prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
goto FAIL;
|
goto FAIL;
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@
|
||||||
#include "nsMimeStringResources.h"
|
#include "nsMimeStringResources.h"
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
#include "nsMsgUtils.h"
|
#include "nsMsgUtils.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "imgILoader.h"
|
#include "imgILoader.h"
|
||||||
|
|
||||||
#ifdef MOZ_THUNDERBIRD
|
#ifdef MOZ_THUNDERBIRD
|
||||||
|
@ -431,7 +431,7 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs,
|
||||||
contentTypeHandlerInitStruct ctHandlerInfo;
|
contentTypeHandlerInitStruct ctHandlerInfo;
|
||||||
|
|
||||||
// Read some prefs
|
// Read some prefs
|
||||||
nsIPref *pref = GetPrefServiceManager(opts);
|
nsIPrefBranch *prefBranch = GetPrefBranch(opts);
|
||||||
PRInt32 html_as = 0; // def. see below
|
PRInt32 html_as = 0; // def. see below
|
||||||
PRInt32 types_of_classes_to_disallow = 0; /* Let only a few libmime classes
|
PRInt32 types_of_classes_to_disallow = 0; /* Let only a few libmime classes
|
||||||
process incoming data. This protects from bugs (e.g. buffer overflows)
|
process incoming data. This protects from bugs (e.g. buffer overflows)
|
||||||
|
@ -448,10 +448,10 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs,
|
||||||
*/
|
*/
|
||||||
if (opts && opts->format_out != nsMimeOutput::nsMimeMessageFilterSniffer &&
|
if (opts && opts->format_out != nsMimeOutput::nsMimeMessageFilterSniffer &&
|
||||||
opts->format_out != nsMimeOutput::nsMimeMessageDecrypt)
|
opts->format_out != nsMimeOutput::nsMimeMessageDecrypt)
|
||||||
if (pref)
|
if (prefBranch)
|
||||||
{
|
{
|
||||||
pref->GetIntPref("mailnews.display.html_as", &html_as);
|
prefBranch->GetIntPref("mailnews.display.html_as", &html_as);
|
||||||
pref->GetIntPref("mailnews.display.disallow_mime_handlers",
|
prefBranch->GetIntPref("mailnews.display.disallow_mime_handlers",
|
||||||
&types_of_classes_to_disallow);
|
&types_of_classes_to_disallow);
|
||||||
if (types_of_classes_to_disallow > 0 && html_as == 0)
|
if (types_of_classes_to_disallow > 0 && html_as == 0)
|
||||||
// We have non-sensical prefs. Do some fixup.
|
// We have non-sensical prefs. Do some fixup.
|
||||||
|
@ -466,8 +466,8 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs,
|
||||||
// it is faster to read the pref first then figure out the msg hdr for the current url only if we have to
|
// it is faster to read the pref first then figure out the msg hdr for the current url only if we have to
|
||||||
// XXX instead of reading this pref every time, part of mime should be an observer listening to this pref change
|
// XXX instead of reading this pref every time, part of mime should be an observer listening to this pref change
|
||||||
// and updating internal state accordingly. But none of the other prefs in this file seem to be doing that...=(
|
// and updating internal state accordingly. But none of the other prefs in this file seem to be doing that...=(
|
||||||
if (pref)
|
if (prefBranch)
|
||||||
pref->GetBoolPref("mailnews.display.sanitizeJunkMail", &sanitizeJunkMail);
|
prefBranch->GetBoolPref("mailnews.display.sanitizeJunkMail", &sanitizeJunkMail);
|
||||||
|
|
||||||
if (sanitizeJunkMail)
|
if (sanitizeJunkMail)
|
||||||
{
|
{
|
||||||
|
@ -559,8 +559,8 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs,
|
||||||
if (opts && opts->format_out != nsMimeOutput::nsMimeMessageFilterSniffer)
|
if (opts && opts->format_out != nsMimeOutput::nsMimeMessageFilterSniffer)
|
||||||
{
|
{
|
||||||
PRBool disable_format_flowed = PR_FALSE;
|
PRBool disable_format_flowed = PR_FALSE;
|
||||||
if (pref)
|
if (prefBranch)
|
||||||
pref->GetBoolPref("mailnews.display.disable_format_flowed_support",
|
prefBranch->GetBoolPref("mailnews.display.disable_format_flowed_support",
|
||||||
&disable_format_flowed);
|
&disable_format_flowed);
|
||||||
|
|
||||||
if(!disable_format_flowed)
|
if(!disable_format_flowed)
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
#include "prlog.h"
|
#include "prlog.h"
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
#include "nsMimeStringResources.h"
|
#include "nsMimeStringResources.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "mimemoz2.h" // for prefs
|
#include "mimemoz2.h" // for prefs
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
|
||||||
|
@ -236,10 +236,10 @@ MimeMultipartAlternative_display_part_p(MimeObject *self,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// prefer_plaintext pref
|
// prefer_plaintext pref
|
||||||
nsIPref *pref = GetPrefServiceManager(self->options);
|
nsIPrefBranch *prefBranch = GetPrefBranch(self->options);
|
||||||
PRBool prefer_plaintext = PR_FALSE;
|
PRBool prefer_plaintext = PR_FALSE;
|
||||||
if (pref)
|
if (prefBranch)
|
||||||
(void)pref->GetBoolPref("mailnews.display.prefer_plaintext",
|
prefBranch->GetBoolPref("mailnews.display.prefer_plaintext",
|
||||||
&prefer_plaintext);
|
&prefer_plaintext);
|
||||||
if (prefer_plaintext
|
if (prefer_plaintext
|
||||||
&& self->options->format_out != nsMimeOutput::nsMimeMessageSaveAs
|
&& self->options->format_out != nsMimeOutput::nsMimeMessageSaveAs
|
||||||
|
|
|
@ -55,7 +55,8 @@
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "mimemoz2.h"
|
#include "mimemoz2.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsFileSpec.h"
|
#include "nsFileSpec.h"
|
||||||
#include "comi18n.h"
|
#include "comi18n.h"
|
||||||
|
@ -100,7 +101,6 @@
|
||||||
// </for>
|
// </for>
|
||||||
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
|
||||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||||
// <for functions="HTML2Plaintext,HTMLSantinize">
|
// <for functions="HTML2Plaintext,HTMLSantinize">
|
||||||
static NS_DEFINE_CID(kParserCID, NS_PARSER_CID);
|
static NS_DEFINE_CID(kParserCID, NS_PARSER_CID);
|
||||||
|
@ -954,9 +954,9 @@ mime_display_stream_complete (nsMIMESession *stream)
|
||||||
int status;
|
int status;
|
||||||
PRBool abortNow = PR_FALSE;
|
PRBool abortNow = PR_FALSE;
|
||||||
|
|
||||||
// Release the prefs service
|
// Release the prefbranch
|
||||||
if ( (obj->options) && (obj->options->prefs) )
|
if ( (obj->options) )
|
||||||
obj->options->prefs->Release();
|
obj->options->m_prefBranch = 0;
|
||||||
|
|
||||||
if ((obj->options) && (obj->options->headers == MimeHeadersOnly))
|
if ((obj->options) && (obj->options->headers == MimeHeadersOnly))
|
||||||
abortNow = PR_TRUE;
|
abortNow = PR_TRUE;
|
||||||
|
@ -1370,13 +1370,13 @@ PRBool MimeObjectChildIsMessageBody(MimeObject *obj,
|
||||||
//
|
//
|
||||||
|
|
||||||
// Get the connnection to prefs service manager
|
// Get the connnection to prefs service manager
|
||||||
nsIPref *
|
nsIPrefBranch *
|
||||||
GetPrefServiceManager(MimeDisplayOptions *opt)
|
GetPrefBranch(MimeDisplayOptions *opt)
|
||||||
{
|
{
|
||||||
if (!opt)
|
if (!opt)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
return opt->prefs;
|
return opt->m_prefBranch;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the text converter...
|
// Get the text converter...
|
||||||
|
@ -1392,7 +1392,6 @@ GetTextConverter(MimeDisplayOptions *opt)
|
||||||
MimeDisplayOptions::MimeDisplayOptions()
|
MimeDisplayOptions::MimeDisplayOptions()
|
||||||
{
|
{
|
||||||
conv = nsnull; // For text conversion...
|
conv = nsnull; // For text conversion...
|
||||||
prefs = nsnull; /* Connnection to prefs service manager */
|
|
||||||
format_out = 0; // The format out type
|
format_out = 0; // The format out type
|
||||||
url = nsnull;
|
url = nsnull;
|
||||||
|
|
||||||
|
@ -1537,8 +1536,8 @@ mime_bridge_create_display_stream(
|
||||||
// memset(msd->options, 0, sizeof(*msd->options));
|
// memset(msd->options, 0, sizeof(*msd->options));
|
||||||
msd->options->format_out = format_out; // output format
|
msd->options->format_out = format_out; // output format
|
||||||
|
|
||||||
rv = CallGetService(kPrefCID, &(msd->options->prefs));
|
msd->options->m_prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||||
if (! (msd->options->prefs && NS_SUCCEEDED(rv)))
|
if (NS_FAILED(rv))
|
||||||
{
|
{
|
||||||
PR_FREEIF(msd);
|
PR_FREEIF(msd);
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
@ -1548,7 +1547,7 @@ mime_bridge_create_display_stream(
|
||||||
rv = CallCreateInstance(MOZ_TXTTOHTMLCONV_CONTRACTID, &(msd->options->conv));
|
rv = CallCreateInstance(MOZ_TXTTOHTMLCONV_CONTRACTID, &(msd->options->conv));
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
{
|
{
|
||||||
msd->options->prefs->Release();
|
msd->options->m_prefBranch = 0;
|
||||||
PR_FREEIF(msd);
|
PR_FREEIF(msd);
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
@ -1595,15 +1594,27 @@ mime_bridge_create_display_stream(
|
||||||
// Now, get the libmime prefs...
|
// Now, get the libmime prefs...
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
MIME_WrapLongLines = PR_TRUE;
|
||||||
|
MIME_VariableWidthPlaintext = PR_TRUE;
|
||||||
|
msd->options->force_user_charset = PR_FALSE;
|
||||||
|
|
||||||
|
if (msd->options->m_prefBranch)
|
||||||
|
{
|
||||||
|
msd->options->m_prefBranch->GetBoolPref("mail.wrap_long_lines", &MIME_WrapLongLines);
|
||||||
|
msd->options->m_prefBranch->GetBoolPref("mail.fixed_width_messages", &MIME_VariableWidthPlaintext);
|
||||||
|
//
|
||||||
|
// Charset overrides takes place here
|
||||||
|
//
|
||||||
|
// We have a bool pref (mail.force_user_charset) to deal with attachments.
|
||||||
|
// 1) If true - libmime does NO conversion and just passes it through to raptor
|
||||||
|
// 2) If false, then we try to use the charset of the part and if not available,
|
||||||
|
// the charset of the root message
|
||||||
|
//
|
||||||
|
msd->options->m_prefBranch->GetBoolPref("mail.force_user_charset", &(msd->options->force_user_charset));
|
||||||
|
msd->options->m_prefBranch->GetBoolPref("mail.inline_attachments", &(msd->options->show_attachment_inline_p));
|
||||||
|
}
|
||||||
/* This pref is written down in with the
|
/* This pref is written down in with the
|
||||||
opposite sense of what we like to use... */
|
opposite sense of what we like to use... */
|
||||||
MIME_WrapLongLines = PR_TRUE;
|
|
||||||
if (msd->options->prefs)
|
|
||||||
msd->options->prefs->GetBoolPref("mail.wrap_long_lines", &MIME_WrapLongLines);
|
|
||||||
|
|
||||||
MIME_VariableWidthPlaintext = PR_TRUE;
|
|
||||||
if (msd->options->prefs)
|
|
||||||
msd->options->prefs->GetBoolPref("mail.fixed_width_messages", &MIME_VariableWidthPlaintext);
|
|
||||||
MIME_VariableWidthPlaintext = !MIME_VariableWidthPlaintext;
|
MIME_VariableWidthPlaintext = !MIME_VariableWidthPlaintext;
|
||||||
|
|
||||||
msd->options->wrap_long_lines_p = MIME_WrapLongLines;
|
msd->options->wrap_long_lines_p = MIME_WrapLongLines;
|
||||||
|
@ -1644,27 +1655,11 @@ mime_bridge_create_display_stream(
|
||||||
|
|
||||||
msd->options->variable_width_plaintext_p = MIME_VariableWidthPlaintext;
|
msd->options->variable_width_plaintext_p = MIME_VariableWidthPlaintext;
|
||||||
|
|
||||||
//
|
|
||||||
// Charset overrides takes place here
|
|
||||||
//
|
|
||||||
// We have a bool pref (mail.force_user_charset) to deal with attachments.
|
|
||||||
// 1) If true - libmime does NO conversion and just passes it through to raptor
|
|
||||||
// 2) If false, then we try to use the charset of the part and if not available,
|
|
||||||
// the charset of the root message
|
|
||||||
//
|
|
||||||
msd->options->force_user_charset = PR_FALSE;
|
|
||||||
|
|
||||||
if (msd->options->prefs)
|
|
||||||
msd->options->prefs->GetBoolPref("mail.force_user_charset", &(msd->options->force_user_charset));
|
|
||||||
|
|
||||||
// If this is a part, then we should emit the HTML to render the data
|
// If this is a part, then we should emit the HTML to render the data
|
||||||
// (i.e. embedded images)
|
// (i.e. embedded images)
|
||||||
if (msd->options->part_to_load && msd->options->format_out != nsMimeOutput::nsMimeMessageBodyDisplay)
|
if (msd->options->part_to_load && msd->options->format_out != nsMimeOutput::nsMimeMessageBodyDisplay)
|
||||||
msd->options->write_html_p = PR_FALSE;
|
msd->options->write_html_p = PR_FALSE;
|
||||||
|
|
||||||
if (msd->options->prefs)
|
|
||||||
msd->options->prefs->GetBoolPref("mail.inline_attachments", &(msd->options->show_attachment_inline_p));
|
|
||||||
|
|
||||||
obj = mime_new ((MimeObjectClass *)&mimeMessageClass, (MimeHeaders *) NULL, MESSAGE_RFC822);
|
obj = mime_new ((MimeObjectClass *)&mimeMessageClass, (MimeHeaders *) NULL, MESSAGE_RFC822);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
{
|
{
|
||||||
|
@ -2089,8 +2084,8 @@ nsresult GetMailNewsFont(MimeObject *obj, PRBool styleFixed, PRInt32 *fontPixel
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
nsIPref *prefs = GetPrefServiceManager(obj->options);
|
nsIPrefBranch *prefBranch = GetPrefBranch(obj->options);
|
||||||
if (prefs) {
|
if (prefBranch) {
|
||||||
MimeInlineText *text = (MimeInlineText *) obj;
|
MimeInlineText *text = (MimeInlineText *) obj;
|
||||||
nsCAutoString charset;
|
nsCAutoString charset;
|
||||||
|
|
||||||
|
@ -2124,13 +2119,21 @@ nsresult GetMailNewsFont(MimeObject *obj, PRBool styleFixed, PRInt32 *fontPixel
|
||||||
// get a font size from pref
|
// get a font size from pref
|
||||||
prefStr.Assign(!styleFixed ? "font.size.variable." : "font.size.fixed.");
|
prefStr.Assign(!styleFixed ? "font.size.variable." : "font.size.fixed.");
|
||||||
prefStr.Append(fontLang);
|
prefStr.Append(fontLang);
|
||||||
rv = prefs->GetIntPref(prefStr.get(), fontPixelSize);
|
rv = prefBranch->GetIntPref(prefStr.get(), fontPixelSize);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefDefBranch;
|
||||||
|
nsCOMPtr<nsIPrefService> prefSvc(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
if(prefSvc)
|
||||||
|
rv = prefSvc->GetDefaultBranch("", getter_AddRefs(prefDefBranch));
|
||||||
|
|
||||||
|
if(!prefDefBranch)
|
||||||
|
return rv;
|
||||||
|
|
||||||
// get original font size
|
// get original font size
|
||||||
PRInt32 originalSize;
|
PRInt32 originalSize;
|
||||||
rv = prefs->GetDefaultIntPref(prefStr.get(), &originalSize);
|
rv = prefDefBranch->GetIntPref(prefStr.get(), &originalSize);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ class nsOutputFileStream;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefBranch.h"
|
||||||
|
|
||||||
typedef struct _nsMIMESession nsMIMESession;
|
typedef struct _nsMIMESession nsMIMESession;
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ extern "C" nsresult mimeEmitterStartHeader(MimeDisplayOptions *opt, PRBool r
|
||||||
extern "C" nsresult mimeEmitterUpdateCharacterSet(MimeDisplayOptions *opt, const char *aCharset);
|
extern "C" nsresult mimeEmitterUpdateCharacterSet(MimeDisplayOptions *opt, const char *aCharset);
|
||||||
|
|
||||||
/* To Get the connnection to prefs service manager */
|
/* To Get the connnection to prefs service manager */
|
||||||
extern "C" nsIPref *GetPrefServiceManager(MimeDisplayOptions *opt);
|
extern "C" nsIPrefBranch *GetPrefBranch(MimeDisplayOptions *opt);
|
||||||
|
|
||||||
// Get the text converter...
|
// Get the text converter...
|
||||||
mozITXTToHTMLConv *GetTextConverter(MimeDisplayOptions *opt);
|
mozITXTToHTMLConv *GetTextConverter(MimeDisplayOptions *opt);
|
||||||
|
|
|
@ -52,8 +52,11 @@
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
#include "nsIPrefLocalizedString.h"
|
||||||
|
#include "nsMsgUtils.h"
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
|
|
||||||
|
@ -88,8 +91,6 @@ MimeInlineTextClassInitialize(MimeInlineTextClass *clazz)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
MimeInlineText_initialize (MimeObject *obj)
|
MimeInlineText_initialize (MimeObject *obj)
|
||||||
{
|
{
|
||||||
|
@ -140,13 +141,14 @@ static int MimeInlineText_initializeCharset(MimeObject *obj)
|
||||||
if (!text->charset)
|
if (!text->charset)
|
||||||
{
|
{
|
||||||
nsresult res;
|
nsresult res;
|
||||||
nsXPIDLString detector_name;
|
|
||||||
|
|
||||||
text->charsetOverridable = PR_TRUE;
|
text->charsetOverridable = PR_TRUE;
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &res));
|
||||||
if (NS_SUCCEEDED(res)) {
|
if (NS_SUCCEEDED(res))
|
||||||
if (NS_SUCCEEDED(prefs->GetLocalizedUnicharPref("intl.charset.detector", getter_Copies(detector_name)))) {
|
{
|
||||||
|
nsCOMPtr<nsIPrefLocalizedString> str;
|
||||||
|
if (NS_SUCCEEDED(prefBranch->GetComplexValue("intl.charset.detector", NS_GET_IID(nsIPrefLocalizedString), getter_AddRefs(str)))) {
|
||||||
//only if we can get autodetector name correctly, do we set this to true
|
//only if we can get autodetector name correctly, do we set this to true
|
||||||
text->inputAutodetect = PR_TRUE;
|
text->inputAutodetect = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -156,19 +158,13 @@ static int MimeInlineText_initializeCharset(MimeObject *obj)
|
||||||
text->charset = nsCRT::strdup(obj->options->default_charset);
|
text->charset = nsCRT::strdup(obj->options->default_charset);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// New change for falling back to a default view charset
|
if (NS_SUCCEEDED(res))
|
||||||
nsresult rv;
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));
|
|
||||||
if ( NS_SUCCEEDED(rv) && prefs)
|
|
||||||
{
|
{
|
||||||
nsXPIDLString value;
|
nsXPIDLString value;
|
||||||
rv = prefs->GetLocalizedUnicharPref("mailnews.view_default_charset", getter_Copies(value));
|
NS_GetLocalizedUnicharPreferenceWithDefault(prefBranch, "mailnews.view_default_charset", EmptyString(), value);
|
||||||
if(NS_SUCCEEDED(rv)) {
|
|
||||||
text->charset = ToNewUTF8String(value);
|
text->charset = ToNewUTF8String(value);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
|
||||||
if (!text->charset)
|
|
||||||
text->charset = nsCRT::strdup("");
|
text->charset = nsCRT::strdup("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "prlog.h"
|
#include "prlog.h"
|
||||||
#include "msgCore.h"
|
#include "msgCore.h"
|
||||||
#include "mimemoz2.h"
|
#include "mimemoz2.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
|
|
||||||
|
@ -161,9 +162,9 @@ printf("buffer: -%s-\n", NS_LossyConvertUCS2toASCII(*textHTMLSan->complete_buffe
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char* allowedTags = 0;
|
char* allowedTags = 0;
|
||||||
nsIPref *prefs = GetPrefServiceManager(obj->options);
|
nsIPrefBranch *prefBranch = GetPrefBranch(obj->options);
|
||||||
if (prefs)
|
if (prefBranch)
|
||||||
prefs->CopyCharPref("mailnews.display.html_sanitizer.allowed_tags",
|
prefBranch->GetCharPref("mailnews.display.html_sanitizer.allowed_tags",
|
||||||
&allowedTags);
|
&allowedTags);
|
||||||
|
|
||||||
#ifdef DEBUG_BenB
|
#ifdef DEBUG_BenB
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsMimeStringResources.h"
|
#include "nsMimeStringResources.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "mimemoz2.h"
|
#include "mimemoz2.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
|
@ -133,13 +133,13 @@ MimeInlineTextPlainFlowed_parse_begin (MimeObject *obj)
|
||||||
text->mQuotedStyleSetting = 0; // mail.quoted_style
|
text->mQuotedStyleSetting = 0; // mail.quoted_style
|
||||||
text->mCitationColor = nsnull; // mail.citation_color
|
text->mCitationColor = nsnull; // mail.citation_color
|
||||||
|
|
||||||
nsIPref *prefs = GetPrefServiceManager(obj->options);
|
nsIPrefBranch *prefBranch = GetPrefBranch(obj->options);
|
||||||
if (prefs)
|
if (prefBranch)
|
||||||
{
|
{
|
||||||
prefs->GetIntPref("mail.quoted_size", &(text->mQuotedSizeSetting));
|
prefBranch->GetIntPref("mail.quoted_size", &(text->mQuotedSizeSetting));
|
||||||
prefs->GetIntPref("mail.quoted_style", &(text->mQuotedStyleSetting));
|
prefBranch->GetIntPref("mail.quoted_style", &(text->mQuotedStyleSetting));
|
||||||
prefs->CopyCharPref("mail.citation_color", &(text->mCitationColor));
|
prefBranch->GetCharPref("mail.citation_color", &(text->mCitationColor));
|
||||||
nsresult rv = prefs->GetBoolPref("mail.fixed_width_messages",
|
nsresult rv = prefBranch->GetBoolPref("mail.fixed_width_messages",
|
||||||
&(exdata->fixedwidthfont));
|
&(exdata->fixedwidthfont));
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get pref");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get pref");
|
||||||
// Check at least the success of one
|
// Check at least the success of one
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#include "nsMimeStringResources.h"
|
#include "nsMimeStringResources.h"
|
||||||
#include "mimemoz2.h"
|
#include "mimemoz2.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
#include "nsMsgI18N.h"
|
#include "nsMsgI18N.h"
|
||||||
|
|
||||||
|
@ -151,14 +151,14 @@ MimeInlineTextPlain_parse_begin (MimeObject *obj)
|
||||||
text->mCitationColor = nsnull; // mail.citation_color
|
text->mCitationColor = nsnull; // mail.citation_color
|
||||||
PRBool graphicalQuote = PR_TRUE; // mail.quoted_graphical
|
PRBool graphicalQuote = PR_TRUE; // mail.quoted_graphical
|
||||||
|
|
||||||
nsIPref *prefs = GetPrefServiceManager(obj->options);
|
nsIPrefBranch *prefBranch = GetPrefBranch(obj->options);
|
||||||
if (prefs)
|
if (prefBranch)
|
||||||
{
|
{
|
||||||
prefs->GetIntPref("mail.quoted_size", &(text->mQuotedSizeSetting));
|
prefBranch->GetIntPref("mail.quoted_size", &(text->mQuotedSizeSetting));
|
||||||
prefs->GetIntPref("mail.quoted_style", &(text->mQuotedStyleSetting));
|
prefBranch->GetIntPref("mail.quoted_style", &(text->mQuotedStyleSetting));
|
||||||
prefs->CopyCharPref("mail.citation_color", &(text->mCitationColor));
|
prefBranch->GetCharPref("mail.citation_color", &(text->mCitationColor));
|
||||||
prefs->GetBoolPref("mail.quoted_graphical", &graphicalQuote);
|
prefBranch->GetBoolPref("mail.quoted_graphical", &graphicalQuote);
|
||||||
prefs->GetBoolPref("mail.quoteasblock", &(text->mBlockquoting));
|
prefBranch->GetBoolPref("mail.quoteasblock", &(text->mBlockquoting));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rawPlainText)
|
if (!rawPlainText)
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#include "nsIMimeStreamConverter.h"
|
#include "nsIMimeStreamConverter.h"
|
||||||
#include "nsIUnicodeDecoder.h"
|
#include "nsIUnicodeDecoder.h"
|
||||||
#include "nsIUnicodeEncoder.h"
|
#include "nsIUnicodeEncoder.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "mozITXTToHTMLConv.h"
|
#include "mozITXTToHTMLConv.h"
|
||||||
|
|
||||||
#define MIME_DRAFTS
|
#define MIME_DRAFTS
|
||||||
|
@ -166,7 +166,7 @@ public:
|
||||||
MimeDisplayOptions();
|
MimeDisplayOptions();
|
||||||
virtual ~MimeDisplayOptions();
|
virtual ~MimeDisplayOptions();
|
||||||
mozITXTToHTMLConv *conv; // For text conversion...
|
mozITXTToHTMLConv *conv; // For text conversion...
|
||||||
nsIPref *prefs; /* Connnection to prefs service manager */
|
nsCOMPtr<nsIPrefBranch> m_prefBranch; /* prefBranch-service */
|
||||||
nsMimeOutputType format_out; // The format out type
|
nsMimeOutputType format_out; // The format out type
|
||||||
nsCString charsetForCachedInputDecoder;
|
nsCString charsetForCachedInputDecoder;
|
||||||
nsCOMPtr<nsIUnicodeDecoder> m_inputCharsetToUnicodeDecoder;
|
nsCOMPtr<nsIUnicodeDecoder> m_inputCharsetToUnicodeDecoder;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче