From 8c2e98e9537c223638245e460518320a8002ef5b Mon Sep 17 00:00:00 2001 From: "bienvenu%nventure.com" Date: Sun, 4 Jan 2004 21:47:17 +0000 Subject: [PATCH] replace nsIPref with nsIPrefBranch in mailnews, patch by arne.anka@stupido.com, r=me, sr=mscott git-svn-id: svn://10.0.0.236/trunk@150872 18797224-902f-48f8-a5cc-f745e15eee43 --- .../base/src/nsMessengerBootstrap.cpp | 12 ++-- .../compose/src/nsMsgAttachmentHandler.cpp | 20 +++---- .../compose/src/nsMsgComposeService.cpp | 60 ++++++------------- mozilla/mailnews/compose/src/nsMsgSend.cpp | 26 ++++---- .../mailnews/compose/src/nsMsgSendLater.cpp | 10 ++-- .../mailnews/db/msgdb/src/nsMsgDatabase.cpp | 16 ++--- .../extensions/mdn/src/nsMsgMdnGenerator.cpp | 33 +++++----- .../mailnews/local/src/nsLocalMailFolder.cpp | 9 +-- .../mailnews/local/src/nsMovemailService.cpp | 4 -- .../mailnews/local/src/nsNoIncomingServer.cpp | 1 - mozilla/mailnews/local/src/nsNoneService.cpp | 4 -- mozilla/mailnews/local/src/nsParseMailbox.cpp | 1 - .../local/src/nsPop3IncomingServer.cpp | 1 - mozilla/mailnews/local/src/nsPop3Protocol.cpp | 1 - mozilla/mailnews/local/src/nsPop3Service.cpp | 3 - .../mapi/mapihook/src/nsMapiRegistryUtils.cpp | 1 - .../mime/cthandlers/vcard/mimevcrd.cpp | 1 - .../mime/emitters/src/nsEmitterUtils.cpp | 1 - .../mime/emitters/src/nsMimeBaseEmitter.cpp | 9 +-- .../mime/emitters/src/nsMimeBaseEmitter.h | 2 - .../mime/emitters/src/nsMimeHtmlEmitter.cpp | 12 ++-- mozilla/mailnews/mime/src/mimehdrs.cpp | 1 - .../mailnews/mime/src/nsStreamConverter.cpp | 19 +++--- 23 files changed, 97 insertions(+), 150 deletions(-) diff --git a/mozilla/mailnews/base/src/nsMessengerBootstrap.cpp b/mozilla/mailnews/base/src/nsMessengerBootstrap.cpp index 566045a27c0..7f9e11928ab 100644 --- a/mozilla/mailnews/base/src/nsMessengerBootstrap.cpp +++ b/mozilla/mailnews/base/src/nsMessengerBootstrap.cpp @@ -46,7 +46,8 @@ #include "nsMsgBaseCID.h" #include "nsIMsgMailSession.h" #include "nsIMsgFolderCache.h" -#include "nsIPref.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" #include "nsIDOMWindow.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" @@ -54,7 +55,6 @@ #include "nsString.h" #include "nsIURI.h" #include "nsIDialogParamBlock.h" -static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); NS_IMPL_THREADSAFE_ADDREF(nsMessengerBootstrap) NS_IMPL_THREADSAFE_RELEASE(nsMessengerBootstrap) @@ -74,12 +74,12 @@ NS_IMETHODIMP nsMessengerBootstrap::GetChromeUrlForTask(char **aChromeUrlForTask { #ifndef MOZ_THUNDERBIRD if (!aChromeUrlForTask) return NS_ERROR_FAILURE; - nsresult rv; - nsCOMPtr prefService(do_GetService(kPrefServiceCID, &rv)); - if (NS_SUCCEEDED(rv)) + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (pPrefBranch) { + nsresult rv; PRInt32 layout; - rv = prefService->GetIntPref("mail.pane_config", &layout); + rv = pPrefBranch->GetIntPref("mail.pane_config", &layout); if(NS_SUCCEEDED(rv)) { if(layout == 0) diff --git a/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp b/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp index fa6017c8f40..869adba3f10 100644 --- a/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp +++ b/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp @@ -38,10 +38,10 @@ #include "nsMsgAttachmentHandler.h" #include "nsMsgCopy.h" -#include "nsIPref.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" #include "nsMsgSend.h" #include "nsMsgCompUtils.h" -#include "nsIPref.h" #include "nsMsgEncoders.h" #include "nsMsgI18N.h" #include "nsURLFetcher.h" @@ -67,8 +67,6 @@ #include "nsNetUtil.h" -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); - /////////////////////////////////////////////////////////////////////////// // Mac Specific Attachment Handling for AppleDouble Encoded Files /////////////////////////////////////////////////////////////////////////// @@ -250,8 +248,7 @@ nsMsgAttachmentHandler::AnalyzeSnarfedFile(void) int nsMsgAttachmentHandler::PickEncoding(const char *charset, nsIMsgSend *mime_delivery_state) { - nsresult rv; - nsCOMPtr prefs(do_GetService(kPrefCID, &rv)); + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); // use the boolean so we only have to test for uuencode vs base64 once PRBool needsB64 = PR_FALSE; @@ -264,8 +261,8 @@ nsMsgAttachmentHandler::PickEncoding(const char *charset, nsIMsgSend *mime_deliv /* Allow users to override our percentage-wise guess on whether the file is text or binary */ - if (NS_SUCCEEDED(rv) && prefs) - prefs->GetBoolPref ("mail.file_attach_binary", &forceB64); + if (pPrefBranch) + pPrefBranch->GetBoolPref ("mail.file_attach_binary", &forceB64); if (!mMainBody && (forceB64 || mime_type_requires_b64_p (m_type))) { @@ -1117,10 +1114,9 @@ nsMsgAttachmentHandler::UrlExit(nsresult status, const PRUnichar* aMsg) // Conversion to plain text desired. // PRInt32 width = 72; - nsresult rv; - nsCOMPtr prefs(do_GetService(kPrefCID, &rv)); - if (NS_SUCCEEDED(rv) && prefs) - prefs->GetIntPref("mailnews.wraplength", &width); + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (pPrefBranch) + pPrefBranch->GetIntPref("mailnews.wraplength", &width); // Let sanity reign! if (width == 0) width = 72; diff --git a/mozilla/mailnews/compose/src/nsMsgComposeService.cpp b/mozilla/mailnews/compose/src/nsMsgComposeService.cpp index a4d6b0d597f..af713f83123 100644 --- a/mozilla/mailnews/compose/src/nsMsgComposeService.cpp +++ b/mozilla/mailnews/compose/src/nsMsgComposeService.cpp @@ -171,10 +171,6 @@ nsMsgComposeService::~nsMsgComposeService() nsresult nsMsgComposeService::Init() { nsresult rv = NS_OK; - nsCOMPtr prefService = do_GetService(NS_PREF_CONTRACTID); - if (!prefService) - return NS_ERROR_FAILURE; - // Register observers // Register for quit application and profile change, we will need to clear the cache. @@ -186,16 +182,11 @@ nsresult nsMsgComposeService::Init() } // Register some pref observer - nsCOMPtr prefs; - rv = prefService->GetBranch(nsnull, getter_AddRefs(prefs)); - if (NS_SUCCEEDED(rv)) - { - nsCOMPtr pbi = do_QueryInterface(prefs, &rv); - if (NS_SUCCEEDED(rv)) - rv = pbi->AddObserver(PREF_MAIL_COMPOSE_MAXRECYCLEDWINDOWS, this, PR_TRUE); - } + nsCOMPtr pbi = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (pbi) + rv = pbi->AddObserver(PREF_MAIL_COMPOSE_MAXRECYCLEDWINDOWS, this, PR_TRUE); - Reset(); + Reset(); AddGlobalHtmlDomains(); @@ -214,15 +205,9 @@ void nsMsgComposeService::Reset() mMaxRecycledWindows = 0; } - nsCOMPtr prefService = do_GetService(NS_PREF_CONTRACTID); - if (!prefService) - return; - nsCOMPtr prefs; - rv = prefService->GetBranch(nsnull, getter_AddRefs(prefs)); - if (NS_FAILED(rv)) - return; - - rv = prefs->GetIntPref(PREF_MAIL_COMPOSE_MAXRECYCLEDWINDOWS, &mMaxRecycledWindows); + nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if(prefs) + rv = prefs->GetIntPref(PREF_MAIL_COMPOSE_MAXRECYCLEDWINDOWS, &mMaxRecycledWindows); if (NS_SUCCEEDED(rv) && mMaxRecycledWindows > 0) { mCachedWindows = new nsMsgCachedWindowInfo[mMaxRecycledWindows]; @@ -388,22 +373,16 @@ nsMsgComposeService::DetermineComposeHTML(nsIMsgIdentity *aIdentity, MSG_Compose } else { - nsresult rv; - // default identity not found. Use the mail.html_compose pref to determine // message compose type (HTML or PlainText). - nsCOMPtr prefService = do_GetService(NS_PREF_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) + nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) { - nsCOMPtr prefs; - rv = prefService->GetBranch(MAIL_ROOT_PREF, getter_AddRefs(prefs)); + nsresult rv; + PRBool useHTMLCompose; + rv = prefs->GetBoolPref(MAIL_ROOT_PREF "html_compose", &useHTMLCompose); if (NS_SUCCEEDED(rv)) - { - PRBool useHTMLCompose; - rv = prefs->GetBoolPref("html_compose", &useHTMLCompose); - if (NS_SUCCEEDED(rv)) - *aComposeHTML = useHTMLCompose; - } + *aComposeHTML = useHTMLCompose; } } break; @@ -556,14 +535,9 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo nsCOMPtr sink = do_CreateInstance(MOZ_SANITIZINGHTMLSERIALIZER_CONTRACTID); nsXPIDLCString allowedTags; - nsCOMPtr prefService = do_GetService(NS_PREF_CONTRACTID); - if (prefService) - { - nsCOMPtr prefs; - rv = prefService->GetBranch(MAILNEWS_ROOT_PREF, getter_AddRefs(prefs)); - if (NS_SUCCEEDED(rv)) - prefs->GetCharPref("display.html_sanitizer.allowed_tags", getter_Copies(allowedTags)); - } + nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) + prefs->GetCharPref(MAILNEWS_ROOT_PREF "display.html_sanitizer.allowed_tags", getter_Copies(allowedTags)); if (parser && sink) { @@ -989,7 +963,7 @@ nsresult nsMsgComposeService::AddGlobalHtmlDomains() { nsresult rv; - nsCOMPtr prefs = do_GetService(NS_PREF_CONTRACTID, &rv); + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv,rv); nsCOMPtr prefBranch; diff --git a/mozilla/mailnews/compose/src/nsMsgSend.cpp b/mozilla/mailnews/compose/src/nsMsgSend.cpp index 2f0bcda9530..567d6edeac9 100644 --- a/mozilla/mailnews/compose/src/nsMsgSend.cpp +++ b/mozilla/mailnews/compose/src/nsMsgSend.cpp @@ -49,7 +49,8 @@ #include "nsIMsgMailSession.h" #include "nsIMsgIdentity.h" #include "nsEscape.h" -#include "nsIPref.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" #include "nsIMsgMailNewsUrl.h" #include "nsMsgDeliveryListener.h" #include "nsMsgComposeStringBundle.h" @@ -110,7 +111,6 @@ #include "nsRDFCID.h" #include "nsIMsgAccountManager.h" -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); #define PREF_MAIL_SEND_STRUCT "mail.send_struct" @@ -1726,10 +1726,10 @@ nsMsgComposeAndSend::GetBodyFromEditor() { PRUint32 whattodo = mozITXTToHTMLConv::kURLs; PRBool enable_structs = PR_FALSE; - nsCOMPtr prefs(do_GetService(kPrefCID, &rv)); - if (NS_SUCCEEDED(rv) && prefs) + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (pPrefBranch) { - rv = prefs->GetBoolPref(PREF_MAIL_SEND_STRUCT,&enable_structs); + rv = pPrefBranch->GetBoolPref(PREF_MAIL_SEND_STRUCT, &enable_structs); if (enable_structs) whattodo = whattodo | mozITXTToHTMLConv::kStructPhrase; } @@ -3171,11 +3171,11 @@ nsMsgComposeAndSend::Init( // Needed for mime encoding! // PRBool strictly_mime = PR_TRUE; - nsCOMPtr prefs(do_GetService(kPrefCID, &rv)); - if (NS_SUCCEEDED(rv) && prefs) + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (pPrefBranch) { - rv = prefs->GetBoolPref(PREF_MAIL_STRICTLY_MIME, &strictly_mime); - rv = prefs->GetIntPref(PREF_MAIL_MESSAGE_WARNING_SIZE, (PRInt32 *) &mMessageWarningSize); + rv = pPrefBranch->GetBoolPref(PREF_MAIL_STRICTLY_MIME, &strictly_mime); + rv = pPrefBranch->GetIntPref(PREF_MAIL_MESSAGE_WARNING_SIZE, (PRInt32 *) &mMessageWarningSize); } nsMsgMIMESetConformToStandard(strictly_mime); @@ -3381,11 +3381,9 @@ nsMsgComposeAndSend::DeliverFileAsMail() nsresult rv; PRBool collectOutgoingAddresses = PR_TRUE; - nsCOMPtr prefs(do_GetService(kPrefCID, &rv)); - if (NS_SUCCEEDED(rv) && prefs) - { - prefs->GetBoolPref(PREF_MAIL_COLLECT_EMAIL_ADDRESS_OUTGOING,&collectOutgoingAddresses); - } + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (pPrefBranch) + pPrefBranch->GetBoolPref(PREF_MAIL_COLLECT_EMAIL_ADDRESS_OUTGOING, &collectOutgoingAddresses); nsCOMPtr addressCollecter = diff --git a/mozilla/mailnews/compose/src/nsMsgSendLater.cpp b/mozilla/mailnews/compose/src/nsMsgSendLater.cpp index 252e6ecf5ca..d062d1fa55b 100644 --- a/mozilla/mailnews/compose/src/nsMsgSendLater.cpp +++ b/mozilla/mailnews/compose/src/nsMsgSendLater.cpp @@ -38,7 +38,8 @@ #include "nsMsgSendLater.h" #include "nsCOMPtr.h" #include "nsMsgCopy.h" -#include "nsIPref.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" #include "nsIEnumerator.h" #include "nsIFileSpec.h" #include "nsISmtpService.h" @@ -71,7 +72,6 @@ #include "nsIMimeConverter.h" #include "nsMsgMimeCID.h" -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kISupportsArrayCID, NS_SUPPORTSARRAY_CID); NS_IMPL_ISUPPORTS2(nsMsgSendLater, nsIMsgSendLater, nsIStreamListener) @@ -389,9 +389,9 @@ SendOperationListener::OnStopSending(const char *aMsgID, nsresult aStatus, const // // Now delete the message from the outbox folder. // - nsCOMPtr prefs(do_GetService(kPrefCID, &rv)); - if (NS_SUCCEEDED(rv) && prefs) - prefs->GetBoolPref("mail.really_delete_draft", &deleteMsgs); + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); + if (pPrefBranch) + pPrefBranch->GetBoolPref("mail.really_delete_draft", &deleteMsgs); mSendLater->SetOrigMsgDisposition(); if (deleteMsgs) diff --git a/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp b/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp index 65bc5d51d61..0fdbe01c4b5 100644 --- a/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp +++ b/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp @@ -82,13 +82,13 @@ static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID); #include "nsICollation.h" #include "nsCollationCID.h" -#include "nsIPref.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" #if defined(DEBUG_sspitzer_) || defined(DEBUG_seth_) #define DEBUG_MSGKEYSET 1 #endif -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID); #define MSG_HASH_SIZE 512 @@ -3704,10 +3704,10 @@ nsresult nsMsgDatabase::GetBoolPref(const char *prefName, PRBool *result) { PRBool prefValue = PR_FALSE; nsresult rv; - nsCOMPtr prefs(do_GetService(kPrefCID, &rv)); - if (NS_SUCCEEDED(rv) && prefs) + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); + if (pPrefBranch) { - rv = prefs->GetBoolPref(prefName, &prefValue); + rv = pPrefBranch->GetBoolPref(prefName, &prefValue); *result = prefValue; } return rv; @@ -3717,10 +3717,10 @@ nsresult nsMsgDatabase::GetIntPref(const char *prefName, PRInt32 *result) { PRInt32 prefValue = 0; nsresult rv; - nsCOMPtr prefs(do_GetService(kPrefCID, &rv)); - if (NS_SUCCEEDED(rv) && prefs) + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); + if (pPrefBranch) { - rv = prefs->GetIntPref(prefName, &prefValue); + rv = pPrefBranch->GetIntPref(prefName, &prefValue); *result = prefValue; } return rv; diff --git a/mozilla/mailnews/extensions/mdn/src/nsMsgMdnGenerator.cpp b/mozilla/mailnews/extensions/mdn/src/nsMsgMdnGenerator.cpp index e6c3803b00c..82cd60e6708 100644 --- a/mozilla/mailnews/extensions/mdn/src/nsMsgMdnGenerator.cpp +++ b/mozilla/mailnews/extensions/mdn/src/nsMsgMdnGenerator.cpp @@ -60,7 +60,7 @@ #include "nsMsgCompCID.h" #include "nsIPrompt.h" #include "nsIMsgCompUtils.h" -#include "nsIPref.h" +#include "nsIPrefService.h" #include "nsIPrefBranchInternal.h" #include "nsIPrefBranch.h" #include "nsIStringBundle.h" @@ -923,27 +923,24 @@ nsresult nsMsgMdnGenerator::InitAndProcess() } else { - nsCOMPtr prefs = - do_GetService(NS_PREF_CONTRACTID, &rv); - if (NS_FAILED(rv)) - return rv; + PRBool bVal = PR_FALSE; - nsCOMPtr prefBranch; - - rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch)); + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; - PRBool bVal = PR_FALSE; - prefBranch->GetBoolPref("mail.mdn.report.enabled", - &bVal); - m_mdnEnabled = bVal; - prefBranch->GetIntPref("mail.mdn.report.not_in_to_cc", - &m_notInToCcOp); - prefBranch->GetIntPref("mail.mdn.report.outside_domain", - &m_outsideDomainOp); - prefBranch->GetIntPref("mail.mdn.report.other", - &m_otherOp); + if(prefBranch) + { + prefBranch->GetBoolPref("mail.mdn.report.enabled", + &bVal); + m_mdnEnabled = bVal; + prefBranch->GetIntPref("mail.mdn.report.not_in_to_cc", + &m_notInToCcOp); + prefBranch->GetIntPref("mail.mdn.report.outside_domain", + &m_outsideDomainOp); + prefBranch->GetIntPref("mail.mdn.report.other", + &m_otherOp); + } } } } diff --git a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp index 7c023928cb0..42948681c4f 100644 --- a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp @@ -42,7 +42,8 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsIPref.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" #include "prlog.h" #include "msgCore.h" // precompiled header... @@ -1219,9 +1220,9 @@ nsresult nsMsgLocalMailFolder::ConfirmFolderDeletion(nsIMsgWindow *aMsgWindow, P { PRBool confirmDeletion = PR_TRUE; nsresult rv; - nsCOMPtr prefs(do_GetService(NS_PREF_CONTRACTID, &rv)); - if (NS_SUCCEEDED(rv)) - prefs->GetBoolPref("mailnews.confirm.moveFoldersToTrash", &confirmDeletion); + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); + if (pPrefBranch) + pPrefBranch->GetBoolPref("mailnews.confirm.moveFoldersToTrash", &confirmDeletion); if (confirmDeletion) { if (!mMsgStringService) diff --git a/mozilla/mailnews/local/src/nsMovemailService.cpp b/mozilla/mailnews/local/src/nsMovemailService.cpp index 29cdce3f0f1..c7ca4cd1b81 100644 --- a/mozilla/mailnews/local/src/nsMovemailService.cpp +++ b/mozilla/mailnews/local/src/nsMovemailService.cpp @@ -64,8 +64,6 @@ #include "nsAppDirectoryServiceDefs.h" #include "nsMsgUtils.h" -#include "nsIPref.h" - #include "nsMsgLocalCID.h" #include "nsMsgBaseCID.h" #include "nsXPIDLString.h" @@ -83,8 +81,6 @@ const char * gDefaultSpoolPaths[] = { }; #define NUM_DEFAULT_SPOOL_PATHS (sizeof(gDefaultSpoolPaths)/sizeof(gDefaultSpoolPaths[0])) -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); - nsMovemailService::nsMovemailService() { #ifdef MOVEMAIL_DEBUG diff --git a/mozilla/mailnews/local/src/nsNoIncomingServer.cpp b/mozilla/mailnews/local/src/nsNoIncomingServer.cpp index 932afd8b7b0..d8d6e655858 100644 --- a/mozilla/mailnews/local/src/nsNoIncomingServer.cpp +++ b/mozilla/mailnews/local/src/nsNoIncomingServer.cpp @@ -42,7 +42,6 @@ #include "prprf.h" #include "nsIFileSpec.h" -#include "nsIPref.h" #include "nsXPIDLString.h" #include "nsNoIncomingServer.h" diff --git a/mozilla/mailnews/local/src/nsNoneService.cpp b/mozilla/mailnews/local/src/nsNoneService.cpp index 5b070248871..596d4c18881 100644 --- a/mozilla/mailnews/local/src/nsNoneService.cpp +++ b/mozilla/mailnews/local/src/nsNoneService.cpp @@ -44,8 +44,6 @@ #include "nsIMsgProtocolInfo.h" #include "nsIMsgMailSession.h" -#include "nsIPref.h" - #include "nsMsgLocalCID.h" #include "nsMsgBaseCID.h" #include "nsXPIDLString.h" @@ -59,8 +57,6 @@ #define PREF_MAIL_ROOT_NONE "mail.root.none" // old - for backward compatibility only #define PREF_MAIL_ROOT_NONE_REL "mail.root.none-rel" -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); - nsNoneService::nsNoneService() { } diff --git a/mozilla/mailnews/local/src/nsParseMailbox.cpp b/mozilla/mailnews/local/src/nsParseMailbox.cpp index 2e970d43c51..ae8669039da 100644 --- a/mozilla/mailnews/local/src/nsParseMailbox.cpp +++ b/mozilla/mailnews/local/src/nsParseMailbox.cpp @@ -62,7 +62,6 @@ #include "nsIIOService.h" #include "nsNetCID.h" #include "nsRDFCID.h" -#include "nsIPref.h" #include "nsIRDFService.h" #include "nsMsgI18N.h" #include "nsAppDirectoryServiceDefs.h" diff --git a/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp b/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp index 4b2d847fb92..4d10be3ef28 100644 --- a/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp +++ b/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp @@ -40,7 +40,6 @@ #include "prprf.h" #include "nsCOMPtr.h" -#include "nsIPref.h" #include "nsXPIDLString.h" #include "nsIStringBundle.h" diff --git a/mozilla/mailnews/local/src/nsPop3Protocol.cpp b/mozilla/mailnews/local/src/nsPop3Protocol.cpp index 3b814f22ee7..a1fe1ed19e5 100644 --- a/mozilla/mailnews/local/src/nsPop3Protocol.cpp +++ b/mozilla/mailnews/local/src/nsPop3Protocol.cpp @@ -53,7 +53,6 @@ #include "nsLocalStringBundle.h" #include "nsTextFormatter.h" #include "nsCOMPtr.h" -#include "nsIPref.h" #include "nsIMsgWindow.h" #include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later... #include "nsIDocShell.h" diff --git a/mozilla/mailnews/local/src/nsPop3Service.cpp b/mozilla/mailnews/local/src/nsPop3Service.cpp index 68e491c47e3..d216f12f5a7 100644 --- a/mozilla/mailnews/local/src/nsPop3Service.cpp +++ b/mozilla/mailnews/local/src/nsPop3Service.cpp @@ -43,8 +43,6 @@ #include "nsIPop3IncomingServer.h" #include "nsIMsgMailSession.h" -#include "nsIPref.h" - #include "nsPop3URL.h" #include "nsPop3Sink.h" #include "nsPop3Protocol.h" @@ -69,7 +67,6 @@ #define PREF_MAIL_ROOT_POP3 "mail.root.pop3" // old - for backward compatibility only #define PREF_MAIL_ROOT_POP3_REL "mail.root.pop3-rel" -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kPop3UrlCID, NS_POP3URL_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); diff --git a/mozilla/mailnews/mapi/mapihook/src/nsMapiRegistryUtils.cpp b/mozilla/mailnews/mapi/mapihook/src/nsMapiRegistryUtils.cpp index 79c8775ca7a..69404f9c706 100644 --- a/mozilla/mailnews/mapi/mapihook/src/nsMapiRegistryUtils.cpp +++ b/mozilla/mailnews/mapi/mapihook/src/nsMapiRegistryUtils.cpp @@ -50,7 +50,6 @@ #include "nsDirectoryService.h" #include "nsDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h" -#include "nsIPref.h" #define EXE_EXTENSION ".exe" #define MOZ_HWND_BROADCAST_MSG_TIMEOUT 5000 diff --git a/mozilla/mailnews/mime/cthandlers/vcard/mimevcrd.cpp b/mozilla/mailnews/mime/cthandlers/vcard/mimevcrd.cpp index d1ea0f06073..cfbd5c18324 100644 --- a/mozilla/mailnews/mime/cthandlers/vcard/mimevcrd.cpp +++ b/mozilla/mailnews/mime/cthandlers/vcard/mimevcrd.cpp @@ -56,7 +56,6 @@ #include "nsReadableUtils.h" #include "nsIStringBundle.h" -#include "nsIPref.h" #include "nsVCardStringResources.h" #include "nsCRT.h" diff --git a/mozilla/mailnews/mime/emitters/src/nsEmitterUtils.cpp b/mozilla/mailnews/mime/emitters/src/nsEmitterUtils.cpp index 3c3a56211b3..860f9604f4f 100644 --- a/mozilla/mailnews/mime/emitters/src/nsEmitterUtils.cpp +++ b/mozilla/mailnews/mime/emitters/src/nsEmitterUtils.cpp @@ -40,7 +40,6 @@ #include "nsMailHeaders.h" #include "nsIMimeEmitter.h" #include "nsIStringBundle.h" -#include "nsIPref.h" #include "nsIServiceManager.h" #include "nsIIOService.h" #include "nsIURI.h" diff --git a/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.cpp b/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.cpp index b97ad5d9d9c..ae47723e014 100644 --- a/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.cpp +++ b/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.cpp @@ -44,7 +44,8 @@ #include "nsMimeBaseEmitter.h" #include "nsMailHeaders.h" #include "nscore.h" -#include "nsIPref.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" #include "nsIServiceManager.h" #include "nsEscape.h" #include "prmem.h" @@ -125,9 +126,9 @@ nsMimeBaseEmitter::nsMimeBaseEmitter() gMimeEmitterLogModule = PR_NewLogModule("MIME"); // Do prefs last since we can live without this if it fails... - mPrefs = do_GetService(NS_PREF_CONTRACTID); - if (mPrefs) - mPrefs->GetIntPref("mail.show_headers", &mHeaderDisplayType); + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (pPrefBranch) + pPrefBranch->GetIntPref("mail.show_headers", &mHeaderDisplayType); } nsMimeBaseEmitter::~nsMimeBaseEmitter(void) diff --git a/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.h b/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.h index 278ab21e21d..bf16dfe6d91 100644 --- a/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.h +++ b/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.h @@ -46,7 +46,6 @@ #include "nsIOutputStream.h" #include "nsIAsyncInputStream.h" #include "nsIURI.h" -#include "nsIPref.h" #include "nsIChannel.h" #include "nsString.h" #include "nsFileSpec.h" @@ -147,7 +146,6 @@ protected: PRUint32 mTotalRead; // Output control and info... - nsCOMPtr mPrefs; // Connnection to prefs service manager PRBool mDocHeader; // For header determination... nsIURI *mURL; // the url for the data being processed... PRInt32 mHeaderDisplayType; // The setting for header output... diff --git a/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp b/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp index e0db75d8dad..9951b971f16 100644 --- a/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp +++ b/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp @@ -43,6 +43,8 @@ #include "nsMailHeaders.h" #include "nscore.h" #include "nsEmitterUtils.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" #include "nsEscape.h" #include "nsIMimeStreamConverter.h" #include "nsIMsgWindow.h" @@ -185,9 +187,9 @@ NS_IMETHODIMP nsMimeHtmlDisplayEmitter::WriteHTMLHeaders() nsresult rv = GetHeaderSink(getter_AddRefs(headerSink)); PRInt32 viewMode = 0; - nsCOMPtr prefs = do_GetService(NS_PREF_CONTRACTID, &rv); - if (prefs) - rv = prefs->GetIntPref("mail.show_headers", &viewMode); + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); + if (pPrefBranch) + rv = pPrefBranch->GetIntPref("mail.show_headers", &viewMode); if (headerSink) { @@ -211,8 +213,8 @@ NS_IMETHODIMP nsMimeHtmlDisplayEmitter::WriteHTMLHeaders() if (nsCRT::strcasecmp("Date", headerInfo->name) == 0) { PRBool displayOriginalDate = PR_FALSE; - if (prefs) - prefs->GetBoolPref("mailnews.display.original_date", &displayOriginalDate); + if (pPrefBranch) + pPrefBranch->GetBoolPref("mailnews.display.original_date", &displayOriginalDate); if (displayOriginalDate) headerValues[numHeadersAdded] = ToNewUnicode(nsDependentCString(headerValue)); diff --git a/mozilla/mailnews/mime/src/mimehdrs.cpp b/mozilla/mailnews/mime/src/mimehdrs.cpp index f0255851d2c..3ed0b4c5125 100644 --- a/mozilla/mailnews/mime/src/mimehdrs.cpp +++ b/mozilla/mailnews/mime/src/mimehdrs.cpp @@ -44,7 +44,6 @@ #include "mimemoz2.h" #include "nsIMimeEmitter.h" #include "nsCRT.h" -#include "nsIPref.h" #include "nsEscape.h" #include "nsMsgMessageFlags.h" #include "nsMimeAddress.h" diff --git a/mozilla/mailnews/mime/src/nsStreamConverter.cpp b/mozilla/mailnews/mime/src/nsStreamConverter.cpp index 809faad72f1..a038eb4db49 100644 --- a/mozilla/mailnews/mime/src/nsStreamConverter.cpp +++ b/mozilla/mailnews/mime/src/nsStreamConverter.cpp @@ -58,7 +58,8 @@ #include "nsMemory.h" #include "nsIPipe.h" #include "nsMimeStringResources.h" -#include "nsIPref.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" #include "nsNetUtil.h" #include "nsIMsgQuote.h" #include "nsIScriptSecurityManager.h" @@ -76,8 +77,6 @@ #define PREF_MAIL_DISPLAY_GLYPH "mail.display_glyph" #define PREF_MAIL_DISPLAY_STRUCT "mail.display_struct" -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); - //////////////////////////////////////////////////////////////// // Bridge routines for new stream converter XP-COM interface //////////////////////////////////////////////////////////////// @@ -221,11 +220,11 @@ bridge_new_new_uri(void *bridgeStream, nsIURI *aURI, PRInt32 aOutputType) // if the pref says always override and no manual override then set the folder charset to override if (!*override_charset) { - nsCOMPtr prefs = do_GetService(kPrefCID, &rv); - if (NS_SUCCEEDED(rv) && prefs) + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); + if (pPrefBranch) { PRBool force_override; - rv = prefs->GetBoolPref("mailnews.force_charset_override", &force_override); + rv = pPrefBranch->GetBoolPref("mailnews.force_charset_override", &force_override); if (NS_SUCCEEDED(rv) && force_override) { *override_charset = PR_TRUE; @@ -715,15 +714,15 @@ NS_IMETHODIMP nsStreamConverter::Init(nsIURI *aURI, nsIStreamListener * aOutList PRBool enable_emoticons = PR_TRUE; PRBool enable_structs = PR_TRUE; - nsCOMPtr prefs(do_GetService(kPrefCID, &rv)); - if (NS_SUCCEEDED(rv) && prefs) + nsCOMPtr pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); + if (pPrefBranch) { - rv = prefs->GetBoolPref(PREF_MAIL_DISPLAY_GLYPH,&enable_emoticons); + rv = pPrefBranch->GetBoolPref(PREF_MAIL_DISPLAY_GLYPH,&enable_emoticons); if (NS_FAILED(rv) || enable_emoticons) { whattodo = whattodo | mozITXTToHTMLConv::kGlyphSubstitution; } - rv = prefs->GetBoolPref(PREF_MAIL_DISPLAY_STRUCT,&enable_structs); + rv = pPrefBranch->GetBoolPref(PREF_MAIL_DISPLAY_STRUCT,&enable_structs); if (NS_FAILED(rv) || enable_structs) { whattodo = whattodo | mozITXTToHTMLConv::kStructPhrase;