code cleanup. use contract ids instead of static cids. remove some usused static cids.

This commit is contained in:
sspitzer%netscape.com 2002-09-16 00:46:09 +00:00
Родитель 7d12bc0885
Коммит 9ff863b820
37 изменённых файлов: 48 добавлений и 604 удалений

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

@ -67,8 +67,6 @@
#include "nsIWindowWatcher.h"
static NS_DEFINE_CID(kCAbSyncPostEngineCID, NS_ABSYNC_POST_ENGINE_CID);
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kAbCardPropertyCID, NS_ABCARDPROPERTY_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
@ -731,7 +729,7 @@ nsAbSync::OpenAB(char *aAbName, nsIAddrDatabase **aDatabase)
nsFileSpec* dbPath = nsnull;
nsCOMPtr<nsIAddrBookSession> abSession =
do_GetService(kAddrBookSessionCID, &rv);
do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
if(NS_SUCCEEDED(rv))
abSession->GetUserProfileDirectory(&dbPath);
@ -743,7 +741,7 @@ nsAbSync::OpenAB(char *aAbName, nsIAddrDatabase **aDatabase)
(*dbPath) += aAbName;
nsCOMPtr<nsIAddrDatabase> addrDBFactory =
do_GetService(kAddressBookDBCID, &rv);
do_GetService(NS_ADDRDATABASE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && addrDBFactory)
rv = addrDBFactory->Open(dbPath, PR_TRUE, aDatabase, PR_TRUE);

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

@ -46,14 +46,10 @@
#include "nsIAddrBookSession.h"
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
nsAbRDFResource::nsAbRDFResource(void)
{
NS_INIT_ISUPPORTS();
NS_INIT_ISUPPORTS();
mDatabase = nsnull;
}
@ -101,7 +97,7 @@ nsresult nsAbRDFResource::GetAbDatabase()
nsFileSpec* dbPath = nsnull;
nsCOMPtr<nsIAddrBookSession> abSession =
do_GetService(kAddrBookSessionCID, &rv);
do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
if(NS_SUCCEEDED(rv))
abSession->GetUserProfileDirectory(&dbPath);
@ -112,7 +108,7 @@ nsresult nsAbRDFResource::GetAbDatabase()
(*dbPath) += file;
nsCOMPtr<nsIAddrDatabase> addrDBFactory =
do_GetService(kAddressBookDBCID, &rv);
do_GetService(NS_ADDRDATABASE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && addrDBFactory)
rv = addrDBFactory->Open(dbPath, PR_TRUE, getter_AddRefs(mDatabase), PR_TRUE);

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

@ -133,7 +133,6 @@
#include "nsIMIMEService.h"
static NS_DEFINE_CID(kIStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID);
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kMsgSendLaterCID, NS_MSGSENDLATER_CID);
static NS_DEFINE_CID(kMsgCopyServiceCID, NS_MSGCOPYSERVICE_CID);

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

@ -54,8 +54,6 @@
#include "nsString.h"
#include "nsIURI.h"
#include "nsIDialogParamBlock.h"
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);

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

@ -97,7 +97,6 @@
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_CID(kAB4xUpgraderServiceCID, NS_AB4xUPGRADER_CID);
static NS_DEFINE_CID(kAddressBookCID, NS_ADDRESSBOOK_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
@ -527,7 +526,7 @@ nsMessengerMigrator::CreateLocalMailAccount(PRBool migrating)
{
nsresult rv;
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
// create the server
@ -669,7 +668,7 @@ nsMessengerMigrator::UpgradePrefs()
#endif
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
// create a dummy identity, for migration only
@ -1150,7 +1149,7 @@ nsMessengerMigrator::MigrateLocalMailAccount()
{
nsresult rv;
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
// create the server
@ -1274,7 +1273,7 @@ nsMessengerMigrator::MigrateMovemailAccount(nsIMsgIdentity *identity)
nsCOMPtr<nsIMsgIncomingServer> server;
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
// get the pop username
@ -1383,7 +1382,7 @@ nsMessengerMigrator::MigratePopAccount(nsIMsgIdentity *identity)
{
nsresult rv;
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgIncomingServer> server;
@ -1647,7 +1646,7 @@ nsMessengerMigrator::MigrateImapAccount(nsIMsgIdentity *identity, const char *ho
nsresult rv;
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
if (!hostAndPort) return NS_ERROR_NULL_POINTER;
@ -2303,7 +2302,7 @@ nsMessengerMigrator::MigrateNewsAccount(nsIMsgIdentity *identity, const char *ho
{
nsresult rv;
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
nsFileSpec thisNewsHostsDir = newsHostsDir;

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

@ -100,7 +100,6 @@ static NS_DEFINE_CID(kMsgAccountCID, NS_MSGACCOUNT_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kMsgBiffManagerCID, NS_MSGBIFFMANAGER_CID);
static NS_DEFINE_CID(kMsgFolderCacheCID, NS_MSGFOLDERCACHE_CID);
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
@ -1034,7 +1033,7 @@ PRBool PR_CALLBACK nsMsgAccountManager::cleanupOnExit(nsHashKey *aKey, void *aDa
{
nsCOMPtr<nsIUrlListener> urlListener;
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIEventQueueService> pEventQService =
do_GetService(kEventQueueServiceCID, &rv);

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

@ -49,7 +49,6 @@
#include "nsMsgBaseCID.h"
static NS_DEFINE_CID(kMorkCID, NS_MORK_CID);
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
const char *kFoldersScope = "ns:msg:db:row:scope:folders:all"; // scope for all folders table
const char *kFoldersTableKind = "ns:msg:db:table:kind:folders";

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

@ -63,7 +63,6 @@
#include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later...
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kMsgCopyServiceCID, NS_MSGCOPYSERVICE_CID);
nsIRDFResource* nsMsgFolderDataSource::kNC_Child = nsnull;
@ -279,7 +278,7 @@ nsresult nsMsgFolderDataSource::Init()
return rv;
nsCOMPtr<nsIMsgMailSession> mailSession =
do_GetService(kMsgMailSessionCID, &rv);
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if(NS_SUCCEEDED(rv))
mailSession->AddFolderListener(this,
@ -299,7 +298,7 @@ void nsMsgFolderDataSource::Cleanup()
if (!m_shuttingDown)
{
nsCOMPtr<nsIMsgMailSession> mailSession =
do_GetService(kMsgMailSessionCID, &rv);
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if(NS_SUCCEEDED(rv))
mailSession->RemoveFolderListener(this);

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

@ -65,11 +65,8 @@ NS_INTERFACE_MAP_BEGIN(nsMsgMailSession)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgMailSession)
NS_INTERFACE_MAP_END_THREADSAFE
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
nsMsgMailSession::nsMsgMailSession()
{
NS_INIT_ISUPPORTS();
}
@ -468,7 +465,7 @@ NS_IMETHODIMP nsMsgMailSession::RemoveMsgWindow(nsIMsgWindow *msgWindow)
{
nsresult rv;
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
accountManager->CleanupOnExit();
}

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

@ -1,439 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "msgCore.h"
#include "nsMsgNotificationManager.h"
#include "nsRDFCID.h"
#include "nsIRDFService.h"
#include "rdf.h"
#include "nsIMsgMailSession.h"
#include "nsMsgBaseCID.h"
#include "MailNewsTypes.h"
#include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later...
#include "nsMemory.h"
#include "nsXPIDLString.h"
#include "prprf.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
nsIRDFResource* nsMsgNotificationManager::kNC_FlashRoot = nsnull;
nsIRDFResource* nsMsgNotificationManager::kNC_Type = nsnull;
nsIRDFResource* nsMsgNotificationManager::kNC_Source = nsnull;
nsIRDFResource* nsMsgNotificationManager::kNC_Description = nsnull;
nsIRDFResource* nsMsgNotificationManager::kNC_TimeStamp = nsnull;
nsIRDFResource* nsMsgNotificationManager::kNC_URL = nsnull;
nsIRDFResource* nsMsgNotificationManager::kNC_Child = nsnull;
nsIRDFResource* nsMsgNotificationManager::kNC_NewMessages = nsnull;
nsIAtom * nsMsgNotificationManager::kBiffStateAtom = nsnull;
nsIAtom * nsMsgNotificationManager::kNumNewBiffMessagesAtom = nsnull;
#define NC_RDF_FLASHROOT "NC:FlashRoot"
#define NC_RDF_TYPE "http://home.netscape.com/NC-rdf#type"
#define NC_RDF_SOURCE "http://home.netscape.com/NC-rdf#source"
#define NC_RDF_DESCRIPTION "http://home.netscape.com/NC-rdf#description"
#define NC_RDF_TIMESTAMP "http://home.netscape.com/NC-rdf#timestamp"
#define NC_RDF_URL "http://home.netscape.com/NC-rdf#url"
#define NC_RDF_CHILD "http://home.netscape.com/NC-rdf#child"
#define NC_RDF_NEWMESSAGES "http://home.netscape.com/NC-rdf#MsgNewMessages"
nsMsgNotificationManager::nsMsgNotificationManager()
{
NS_INIT_ISUPPORTS();
}
nsMsgNotificationManager::~nsMsgNotificationManager()
{
NS_IF_RELEASE(kNC_FlashRoot);
NS_IF_RELEASE(kNC_Type);
NS_IF_RELEASE(kNC_Source);
NS_IF_RELEASE(kNC_Description);
NS_IF_RELEASE(kNC_TimeStamp);
NS_IF_RELEASE(kNC_URL);
NS_IF_RELEASE(kNC_Child);
NS_IF_RELEASE(kNC_NewMessages);
NS_IF_RELEASE(kNumNewBiffMessagesAtom);
NS_IF_RELEASE(kBiffStateAtom);
}
NS_IMPL_ADDREF(nsMsgNotificationManager)
NS_IMPL_RELEASE(nsMsgNotificationManager);
NS_IMETHODIMP
nsMsgNotificationManager::QueryInterface(REFNSIID iid, void** result)
{
if (! result)
return NS_ERROR_NULL_POINTER;
*result = nsnull;
if (iid.Equals(kISupportsIID))
{
*result = NS_STATIC_CAST(nsISupports*, this);
}
else if(iid.Equals(NS_GET_IID(nsIFolderListener)))
{
*result = NS_STATIC_CAST(nsIFolderListener*, this);
}
else if(iid.Equals(NS_GET_IID(nsIRDFDataSource)))
{
// Support nsIRDFDataSource by aggregation.
return mInMemoryDataSourceISupports->QueryInterface(iid, result);
}
if(*result)
{
NS_ADDREF_THIS();
return NS_OK;
}
return NS_NOINTERFACE;
}
nsresult nsMsgNotificationManager::Init()
{
nsresult rv;
rv = nsComponentManager::CreateInstance(kRDFInMemoryDataSourceCID,
this,
NS_GET_IID(nsISupports),
getter_AddRefs(mInMemoryDataSourceISupports));
if(NS_FAILED(rv))
return rv;
nsCOMPtr<nsIMsgMailSession> mailSession =
do_GetService(kMsgMailSessionCID, &rv);
if(NS_SUCCEEDED(rv))
rv = mailSession->AddFolderListener(this, nsIFolderListener::propertyChanged | nsIFolderListener::propertyFlagChanged);
if(NS_FAILED(rv))
return rv;
nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv));
if(NS_FAILED(rv))
return rv;
if (! kNC_FlashRoot)
{
rdfService->GetResource(NC_RDF_FLASHROOT, &kNC_FlashRoot);
rdfService->GetResource(NC_RDF_TYPE, &kNC_Type);
rdfService->GetResource(NC_RDF_SOURCE, &kNC_Source);
rdfService->GetResource(NC_RDF_DESCRIPTION, &kNC_Description);
rdfService->GetResource(NC_RDF_TIMESTAMP, &kNC_TimeStamp);
rdfService->GetResource(NC_RDF_URL, &kNC_URL);
rdfService->GetResource(NC_RDF_CHILD, &kNC_Child);
rdfService->GetResource(NC_RDF_NEWMESSAGES, &kNC_NewMessages);
kNumNewBiffMessagesAtom = NS_NewAtom("NumNewBiffMessages");
kBiffStateAtom = NS_NewAtom("BiffState");
}
return rv;
}
NS_IMETHODIMP nsMsgNotificationManager::OnItemAdded(nsISupports *parentItem, nsISupports *item, const char* viewString)
{
return NS_OK;
}
NS_IMETHODIMP nsMsgNotificationManager::OnItemRemoved(nsISupports *parentItem, nsISupports *item, const char* viewString)
{
return NS_OK;
}
NS_IMETHODIMP
nsMsgNotificationManager::OnItemPropertyChanged(nsISupports *item,
nsIAtom *property,
const char *oldValue,
const char *newValue)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(item));
if(folder)
{
if(kNumNewBiffMessagesAtom == property)
{
PRUint32 biffState;
rv = folder->GetBiffState(&biffState);
if(NS_SUCCEEDED(rv) && (biffState == nsIMsgFolder::nsMsgBiffState_NewMail))
{
rv = AddNewMailNotification(folder);
}
}
}
return rv;
}
NS_IMETHODIMP
nsMsgNotificationManager::OnItemUnicharPropertyChanged(nsISupports *item,
nsIAtom *property,
const PRUnichar* oldValue,
const PRUnichar* newValue)
{
return NS_OK;
}
NS_IMETHODIMP
nsMsgNotificationManager::OnItemIntPropertyChanged(nsISupports *item,
nsIAtom *property,
PRInt32 oldValue,
PRInt32 newValue)
{
return NS_OK;
}
NS_IMETHODIMP
nsMsgNotificationManager::OnItemBoolPropertyChanged(nsISupports *item,
nsIAtom *property,
PRBool oldValue,
PRBool newValue)
{
return NS_OK;
}
NS_IMETHODIMP
nsMsgNotificationManager::OnItemPropertyFlagChanged(nsISupports *item,
nsIAtom *property,
PRUint32 oldFlag,
PRUint32 newFlag)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(item));
if(folder)
{
if(kBiffStateAtom == property)
{
if(newFlag == nsIMsgFolder::nsMsgBiffState_NewMail)
{
rv = AddNewMailNotification(folder);
}
else
{
rv = RemoveNewMailNotification(folder);
}
}
}
return rv;
}
NS_IMETHODIMP
nsMsgNotificationManager::OnItemEvent(nsIFolder *folder, nsIAtom *aEvent)
{
return NS_OK;
}
nsresult nsMsgNotificationManager::AddNewMailNotification(nsIMsgFolder *folder)
{
nsresult rv;
nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv));
if(NS_FAILED(rv))
return rv;
//If there's currently a notification for this folder, remove it.
RemoveNewMailNotification(folder);
nsCAutoString newMailURI;
rv = BuildNewMailURI(folder, newMailURI);
if(NS_FAILED(rv))
return rv;
nsCOMPtr<nsIRDFResource> notificationResource;
rv = rdfService->GetResource(newMailURI.get(), getter_AddRefs(notificationResource));
if(NS_FAILED(rv))
return rv;
nsCOMPtr<nsIRDFLiteral> type, source, description, timeStamp, url;
nsString typeString, sourceString, descriptionString, timeStampString, urlString;
sourceString.Assign(NS_LITERAL_STRING("Messenger"));
descriptionString.Assign(NS_LITERAL_STRING("You have mail"));
timeStampString.Assign(NS_LITERAL_STRING("3:33pm"));
urlString.Assign(NS_LITERAL_STRING("test"));
nsCOMPtr<nsIRDFDataSource> ds = do_QueryInterface(mInMemoryDataSourceISupports);
ds->Assert(notificationResource, kNC_Type, kNC_NewMessages, PR_TRUE);
PRUnichar* folderDescription = nsnull;
rv = folder->GetNewMessagesNotificationDescription(&folderDescription);
if(NS_SUCCEEDED(rv) && folderDescription)
{
sourceString = folderDescription;
nsMemory::Free(folderDescription);
}
rv = rdfService->GetLiteral(sourceString.get(), getter_AddRefs(source));
if(NS_SUCCEEDED(rv))
{
ds->Assert(notificationResource, kNC_Source, source, PR_TRUE);
}
PRInt32 newMessages;
rv = folder->GetNumNewMessages(PR_FALSE, &newMessages);
if(NS_SUCCEEDED(rv))
{
char *str = PR_smprintf("%d new %s", newMessages, (newMessages == 1) ? "message" : "messages");
descriptionString.AssignWithConversion(str);
PR_smprintf_free(str);
}
// if flash panel is going to ignore the source, I'm going to add it to the description for now
nsXPIDLString folderName;
rv = folder->GetPrettyName(getter_Copies(folderName));
if (NS_SUCCEEDED(rv) && folderName)
{
descriptionString.Append(NS_LITERAL_STRING(" in "));
descriptionString.Append(folderName);
}
rv = rdfService->GetLiteral(descriptionString.get(), getter_AddRefs(description));
if(NS_SUCCEEDED(rv))
{
ds->Assert(notificationResource, kNC_Description, description, PR_TRUE);
}
//Supposedly rdf will convert this into a localized time string.
PRExplodedTime explode;
PR_ExplodeTime( PR_Now(), PR_LocalTimeParameters, &explode);
char buffer[128];
PR_FormatTime(buffer, sizeof(buffer), "%m/%d/%Y %I:%M %p", &explode);
timeStampString.AssignWithConversion(buffer);
rv = rdfService->GetLiteral(timeStampString.get(), getter_AddRefs(timeStamp));
if(NS_SUCCEEDED(rv))
{
ds->Assert(notificationResource, kNC_TimeStamp, timeStamp, PR_TRUE);
}
rv = rdfService->GetLiteral(urlString.get(), getter_AddRefs(url));
if(NS_SUCCEEDED(rv))
{
ds->Assert(notificationResource, kNC_URL, url, PR_TRUE);
}
ds->Assert(kNC_FlashRoot, kNC_Child, notificationResource, PR_TRUE);
return NS_OK;
}
nsresult nsMsgNotificationManager::RemoveNewMailNotification(nsIMsgFolder *folder)
{
nsresult rv;
nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv));
if(NS_FAILED(rv))
return rv;
nsCAutoString newMailURI;
rv = BuildNewMailURI(folder, newMailURI);
if(NS_FAILED(rv))
return rv;
nsCOMPtr<nsIRDFResource> notificationResource;
rv = rdfService->GetResource(newMailURI.get(), getter_AddRefs(notificationResource));
if(NS_FAILED(rv))
return rv;
RemoveOldValues(notificationResource);
nsCOMPtr<nsIRDFDataSource> ds = do_QueryInterface(mInMemoryDataSourceISupports);
ds->Unassert(kNC_FlashRoot, kNC_Child, notificationResource);
return NS_OK;
}
nsresult nsMsgNotificationManager::RemoveOldValues(nsIRDFResource *notificationResource)
{
nsCOMPtr<nsIRDFNode> target;
nsresult rv;
nsCOMPtr<nsIRDFDataSource> ds = do_QueryInterface(mInMemoryDataSourceISupports);
rv = ds->GetTarget(notificationResource, kNC_Description, PR_TRUE, getter_AddRefs(target));
if(NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE))
ds->Unassert(notificationResource, kNC_Description, target);
rv = ds->GetTarget(notificationResource, kNC_Type, PR_TRUE, getter_AddRefs(target));
if(NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE))
ds->Unassert(notificationResource, kNC_Type, target);
rv = ds->GetTarget(notificationResource, kNC_Source, PR_TRUE, getter_AddRefs(target));
if(NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE))
ds->Unassert(notificationResource, kNC_Source, target);
rv = ds->GetTarget(notificationResource, kNC_TimeStamp, PR_TRUE, getter_AddRefs(target));
if(NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE))
ds->Unassert(notificationResource, kNC_TimeStamp, target);
rv = ds->GetTarget(notificationResource, kNC_URL, PR_TRUE, getter_AddRefs(target));
if(NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE))
ds->Unassert(notificationResource, kNC_URL, target);
return NS_OK;
}
nsresult nsMsgNotificationManager::BuildNewMailURI(nsIMsgFolder *folder, nsCAutoString &newMailURI)
{
nsresult rv;
nsCOMPtr<nsIRDFResource> folderResource = do_QueryInterface(folder);
if(!folderResource)
return NS_ERROR_NO_INTERFACE;
const char *folderURI;
rv = folderResource->GetValueConst(&folderURI);
if(!(NS_SUCCEEDED(rv) && folderURI))
return rv;
newMailURI = "newmail:";
newMailURI += folderURI;
return NS_OK;
}

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

@ -54,11 +54,10 @@
#include "nsMsgNewsCID.h"
#include "nsINntpService.h"
#include "nsXPIDLString.h"
static NS_DEFINE_CID(kCImapService, NS_IMAPSERVICE_CID);
static NS_DEFINE_CID(kCMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_CID(kMsgSendLaterCID, NS_MSGSENDLATER_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kNntpServiceCID, NS_NNTPSERVICE_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
NS_IMPL_THREADSAFE_ISUPPORTS5(nsMsgOfflineManager,
@ -216,7 +215,7 @@ nsresult nsMsgOfflineManager::SendUnsentMessages()
nsCOMPtr<nsIMsgSendLater> pMsgSendLater = do_CreateInstance(kMsgSendLaterCID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kCMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
// now we have to iterate over the identities, finding the *unique* unsent messages folder
// for each one, determine if they have unsent messages, and if so, add them to the list
@ -303,7 +302,7 @@ nsresult nsMsgOfflineManager::DownloadOfflineNewsgroups()
{
nsresult rv;
ShowStatus("downloadingNewsgroups");
nsCOMPtr<nsINntpService> nntpService(do_GetService(kNntpServiceCID, &rv));
nsCOMPtr<nsINntpService> nntpService(do_GetService(NS_NNTPSERVICE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && nntpService)
rv = nntpService->DownloadNewsgroupsForOffline(m_window, this);

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

@ -66,7 +66,6 @@
#include "nsMsgUtils.h"
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
static PRTime gtimeOfLastPurgeCheck; //variable to know when to check for purge_threshhold
@ -373,7 +372,7 @@ nsresult nsMsgDBFolder::GetFolderCacheElemFromFileSpec(nsIFileSpec *fileSpec, ns
NS_ASSERTION(NS_SUCCEEDED(fileSpec->Exists(&exists)) && exists, "whoops, file doesn't exist, mac will break");
#endif
nsCOMPtr<nsIMsgAccountManager> accountMgr =
do_GetService(kMsgAccountManagerCID, &result);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &result);
if(NS_SUCCEEDED(result))
{
result = accountMgr->GetFolderCache(getter_AddRefs(folderCache));

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

@ -83,7 +83,6 @@
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kMsgFolderListenerManagerCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
@ -2325,7 +2324,7 @@ nsMsgFolder::NotifyPropertyChanged(nsIAtom *property,
//Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(kMsgFolderListenerManagerCID, &rv);
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
folderListenerManager->OnItemPropertyChanged(supports, property, oldValue, newValue);
@ -2355,7 +2354,7 @@ nsMsgFolder::NotifyUnicharPropertyChanged(nsIAtom *property,
// Notify listeners who listen to every folder
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(kMsgFolderListenerManagerCID, &rv);
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
rv = folderListenerManager->OnItemUnicharPropertyChanged(supports,
property,
@ -2384,7 +2383,7 @@ nsresult nsMsgFolder::NotifyIntPropertyChanged(nsIAtom *property, PRInt32 oldVal
//Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(kMsgFolderListenerManagerCID, &rv);
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
folderListenerManager->OnItemIntPropertyChanged(supports, property, oldValue, newValue);
@ -2412,7 +2411,7 @@ nsMsgFolder::NotifyBoolPropertyChanged(nsIAtom* property,
//Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(kMsgFolderListenerManagerCID, &rv);
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
folderListenerManager->OnItemBoolPropertyChanged(supports, property, oldValue, newValue);
@ -2437,7 +2436,7 @@ nsMsgFolder::NotifyPropertyFlagChanged(nsISupports *item, nsIAtom *property,
//Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(kMsgFolderListenerManagerCID, &rv);
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
folderListenerManager->OnItemPropertyFlagChanged(item, property, oldValue, newValue);
@ -2462,7 +2461,7 @@ nsresult nsMsgFolder::NotifyItemAdded(nsISupports *parentItem, nsISupports *item
//Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(kMsgFolderListenerManagerCID, &rv);
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
folderListenerManager->OnItemAdded(parentItem, item, viewString);
@ -2483,7 +2482,7 @@ nsresult nsMsgFolder::NotifyItemDeleted(nsISupports *parentItem, nsISupports *it
//Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(kMsgFolderListenerManagerCID, &rv);
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
folderListenerManager->OnItemRemoved(parentItem, item, viewString);
@ -2504,7 +2503,7 @@ nsresult nsMsgFolder::NotifyFolderEvent(nsIAtom* aEvent)
//Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(kMsgFolderListenerManagerCID, &rv);
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
folderListenerManager->OnItemEvent(this, aEvent);

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

@ -61,7 +61,6 @@
static NS_DEFINE_CID(kUrlListenerManagerCID, NS_URLLISTENERMANAGER_CID);
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
nsMsgMailNewsUrl::nsMsgMailNewsUrl()
@ -236,7 +235,7 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetMsgWindow(nsIMsgWindow **aMsgWindow)
if (!m_msgWindow)
{
// nsCOMPtr<nsIMsgMailSession> mailSession =
// do_GetService(kMsgMailSessionCID, &rv);
// do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
// if(NS_SUCCEEDED(rv))
// mailSession->GetTemporaryMsgStatusFeedback(getter_AddRefs(m_statusFeedback));

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

@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsIMsgMailSession.h"
#include "nsIMsgIdentity.h"
#include "nsMsgCompPrefs.h"
#include "nsMsgBaseCID.h"
#include "nsIPref.h"
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
nsMsgCompPrefs::nsMsgCompPrefs()
{
nsresult res;
m_wrapColumn = 72;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
if (NS_SUCCEEDED(res) && prefs)
{
res = prefs->GetIntPref("mail.wraplength", &m_wrapColumn);
}
}
nsMsgCompPrefs::~nsMsgCompPrefs()
{
}

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

@ -110,9 +110,7 @@
// supports two interfaces (nsISupports and nsIMsgCompose) so we want to define constants
// for these two interfaces
//
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
static NS_DEFINE_CID(kNntpServiceCID, NS_NNTPSERVICE_CID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
@ -255,7 +253,7 @@ NS_IMETHODIMP nsMsgComposeAndSend::GetDefaultPrompt(nsIPrompt ** aPrompt)
/* If we cannot find a prompter, try the mail3Pane window */
nsCOMPtr<nsIMsgWindow> msgWindow;
nsCOMPtr <nsIMsgMailSession> mailSession (do_GetService(kMsgMailSessionCID));
nsCOMPtr <nsIMsgMailSession> mailSession (do_GetService(NS_MSGMAILSESSION_CONTRACTID));
if (mailSession)
{
mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
@ -270,7 +268,7 @@ nsresult nsMsgComposeAndSend::GetNotificationCallbacks(nsIInterfaceRequestor** a
{
// TODO: stop using mail3pane window!
nsCOMPtr<nsIMsgWindow> msgWindow;
nsCOMPtr<nsIMsgMailSession> mailSession(do_GetService(kMsgMailSessionCID));
nsCOMPtr<nsIMsgMailSession> mailSession(do_GetService(NS_MSGMAILSESSION_CONTRACTID));
mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
if (msgWindow) {
nsCOMPtr<nsIDocShell> docShell;
@ -3336,7 +3334,7 @@ nsMsgComposeAndSend::DeliverFileAsNews()
nsCOMPtr<nsIPrompt> promptObject;
GetDefaultPrompt(getter_AddRefs(promptObject));
nsCOMPtr<nsINntpService> nntpService(do_GetService(kNntpServiceCID, &rv));
nsCOMPtr<nsINntpService> nntpService(do_GetService(NS_NNTPSERVICE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && nntpService)
{
@ -3358,7 +3356,7 @@ nsMsgComposeAndSend::DeliverFileAsNews()
mComposeBundle->GetStringByID(NS_MSG_POSTING_MESSAGE, getter_Copies(msg));
SetStatusMessage( msg );
nsCOMPtr <nsIMsgMailSession> mailSession = do_GetService(kMsgMailSessionCID, &rv);
nsCOMPtr <nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
if (!mailSession) return NS_ERROR_FAILURE;

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

@ -72,7 +72,6 @@
#include "nsMsgMimeCID.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
static NS_DEFINE_CID(kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID);
static NS_DEFINE_CID(kMsgSendCID, NS_MSGSEND_CID);

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

@ -104,14 +104,12 @@
#include "nsIMsgMdnGenerator.h"
#include <time.h>
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
static NS_DEFINE_CID(kImapProtocolCID, NS_IMAPPROTOCOL_CID);
static NS_DEFINE_CID(kCImapDB, NS_IMAPDB_CID);
static NS_DEFINE_CID(kCImapService, NS_IMAPSERVICE_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kParseMailMsgStateCID, NS_PARSEMAILMSGSTATE_CID);
static NS_DEFINE_CID(kCImapHostSessionList, NS_IIMAPHOSTSESSIONLIST_CID);
static NS_DEFINE_CID(kCopyMessageStreamListenerCID, NS_COPYMESSAGESTREAMLISTENER_CID);
@ -1129,7 +1127,7 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *msgWindow,
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (accountManager)
{
// if we are emptying trash on exit and we are an aol server then don't perform

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

@ -50,7 +50,6 @@
#include "nsSpecialSystemDirectory.h"
#include "nsIFileStream.h"
#include "nsIMsgCopyService.h"
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
NS_IMPL_ISUPPORTS2(nsImapOfflineSync, nsIUrlListener, nsIMsgCopyServiceListener)
@ -948,7 +947,7 @@ nsresult nsImapOfflineDownloader::ProcessNextOperation()
// Update the INBOX first so the updates on the remaining
// folders pickup the results of any filter moves.
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsISupportsArray> servers;

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

@ -73,7 +73,6 @@
#include "nsEscape.h"
static NS_DEFINE_CID(kCImapMockChannel, NS_IMAPMOCKCHANNEL_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kCImapHostSessionListCID, NS_IIMAPHOSTSESSIONLIST_CID);
nsImapUrl::nsImapUrl()

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

@ -53,9 +53,7 @@
static NS_DEFINE_CID( kMsgSendCID, NS_MSGSEND_CID);
static NS_DEFINE_CID( kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID);
static NS_DEFINE_CID( kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID( kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID( kMsgAccountMgrCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_CID( kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
@ -202,7 +200,7 @@ nsEudoraCompose::~nsEudoraCompose()
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to clear values");
if (NS_FAILED(rv)) return;
NS_WITH_PROXIED_SERVICE(nsIMsgAccountManager, accMgr, kMsgAccountMgrCID, NS_UI_THREAD_EVENTQ, &rv);
NS_WITH_PROXIED_SERVICE(nsIMsgAccountManager, accMgr, NS_MSGACCOUNTMANAGER_CONTRACTID, NS_UI_THREAD_EVENTQ, &rv);
NS_ASSERTION(NS_SUCCEEDED(rv) && accMgr,"failed to get account manager");
if (NS_FAILED(rv) || !accMgr) return;
@ -221,7 +219,7 @@ nsresult nsEudoraCompose::CreateIdentity( void)
return( NS_OK);
nsresult rv;
NS_WITH_PROXIED_SERVICE(nsIMsgAccountManager, accMgr, kMsgAccountMgrCID, NS_UI_THREAD_EVENTQ, &rv);
NS_WITH_PROXIED_SERVICE(nsIMsgAccountManager, accMgr, NS_MSGACCOUNTMANAGER_CONTRACTID, NS_UI_THREAD_EVENTQ, &rv);
if (NS_FAILED(rv)) return( rv);
rv = accMgr->CreateIdentity( &m_pIdentity);
nsString name(NS_LITERAL_STRING("Import Identity"));

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

@ -51,13 +51,9 @@
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
static NS_DEFINE_CID(kMsgAccountMgrCID, NS_MSGACCOUNTMANAGER_CID);
static const char * kWhitespace = "\b\t\r\n ";
nsEudoraMac::nsEudoraMac()
{
m_mailImportLocation = nsnull;
@ -602,7 +598,7 @@ PRBool nsEudoraMac::ImportSettings( nsIFileSpec *pIniFile, nsIMsgAccount **local
nsresult rv;
nsCOMPtr<nsIMsgAccountManager> accMgr =
do_GetService(kMsgAccountMgrCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
IMPORT_LOG0( "*** Failed to create a account manager!\n");
return( PR_FALSE);

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

@ -42,7 +42,6 @@
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
static NS_DEFINE_CID(kMsgAccountMgrCID, NS_MSGACCOUNTMANAGER_CID);
static const char * kWhitespace = "\b\t\r\n ";
@ -549,7 +548,7 @@ PRBool nsEudoraWin32::ImportSettings( nsIFileSpec *pIniFile, nsIMsgAccount **loc
nsresult rv;
nsCOMPtr<nsIMsgAccountManager> accMgr =
do_GetService(kMsgAccountMgrCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
IMPORT_LOG0( "*** Failed to create a account manager!\n");
return( PR_FALSE);

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

@ -65,8 +65,6 @@
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
static NS_DEFINE_CID(kMsgAccountMgrCID, NS_MSGACCOUNTMANAGER_CID);
class OESettings {
public:
@ -227,7 +225,7 @@ PRBool OESettings::DoImport( nsIMsgAccount **ppAccount)
nsresult rv;
nsCOMPtr<nsIMsgAccountManager> accMgr =
do_GetService(kMsgAccountMgrCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
IMPORT_LOG0( "*** Failed to create a account manager!\n");
return( PR_FALSE);

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

@ -53,9 +53,7 @@
static NS_DEFINE_CID( kMsgSendCID, NS_MSGSEND_CID);
static NS_DEFINE_CID( kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID);
static NS_DEFINE_CID( kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID( kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID( kMsgAccountMgrCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_CID( kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
@ -201,7 +199,7 @@ nsOutlookCompose::~nsOutlookCompose()
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to clear values");
if (NS_FAILED(rv)) return;
NS_WITH_PROXIED_SERVICE(nsIMsgAccountManager, accMgr, kMsgAccountMgrCID, NS_UI_THREAD_EVENTQ, &rv);
NS_WITH_PROXIED_SERVICE(nsIMsgAccountManager, accMgr, NS_MSGACCOUNTMANAGER_CONTRACTID, NS_UI_THREAD_EVENTQ, &rv);
NS_ASSERTION(NS_SUCCEEDED(rv) && accMgr,"failed to get account manager");
if (NS_FAILED(rv) || !accMgr) return;
@ -219,7 +217,7 @@ nsresult nsOutlookCompose::CreateIdentity( void)
return( NS_OK);
nsresult rv;
NS_WITH_PROXIED_SERVICE(nsIMsgAccountManager, accMgr, kMsgAccountMgrCID, NS_UI_THREAD_EVENTQ, &rv);
NS_WITH_PROXIED_SERVICE(nsIMsgAccountManager, accMgr, NS_MSGACCOUNTMANAGER_CONTRACTID, NS_UI_THREAD_EVENTQ, &rv);
if (NS_FAILED(rv)) return( rv);
rv = accMgr->CreateIdentity( &m_pIdentity);
nsString name;

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

@ -65,8 +65,6 @@
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
static NS_DEFINE_CID(kMsgAccountMgrCID, NS_MSGACCOUNTMANAGER_CID);
class OutlookSettings {
public:
@ -180,7 +178,7 @@ PRBool OutlookSettings::DoImport( nsIMsgAccount **ppAccount)
nsresult rv;
nsCOMPtr<nsIMsgAccountManager> accMgr =
do_GetService(kMsgAccountMgrCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
IMPORT_LOG0( "*** Failed to create a account manager!\n");
return( PR_FALSE);

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

@ -68,10 +68,8 @@
#include "ImportDebug.h"
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
static NS_DEFINE_CID(kAbDirectoryCID, NS_ABDIRECTORY_CID);
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kSupportsWStringCID, NS_SUPPORTS_STRING_CID);
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
@ -778,7 +776,7 @@ nsIAddrDatabase *GetAddressBook( const PRUnichar *name, PRBool makeNew)
// Note to Candice: This should return an nsIFileSpec, not a nsFileSpec
nsFileSpec * dbPath = nsnull;
NS_WITH_PROXIED_SERVICE(nsIAddrBookSession, abSession, kAddrBookSessionCID, NS_UI_THREAD_EVENTQ, &rv);
NS_WITH_PROXIED_SERVICE(nsIAddrBookSession, abSession, NS_ADDRBOOKSESSION_CONTRACTID, NS_UI_THREAD_EVENTQ, &rv);
if (NS_SUCCEEDED(rv))
abSession->GetUserProfileDirectory(&dbPath);
@ -790,7 +788,7 @@ nsIAddrDatabase *GetAddressBook( const PRUnichar *name, PRBool makeNew)
IMPORT_LOG0( "Getting the address database factory\n");
NS_WITH_PROXIED_SERVICE(nsIAddrDatabase, addrDBFactory, kAddressBookDBCID, NS_UI_THREAD_EVENTQ, &rv);
NS_WITH_PROXIED_SERVICE(nsIAddrDatabase, addrDBFactory, NS_ADDRDATABASE_CONTRACTID, NS_UI_THREAD_EVENTQ, &rv);
if (NS_SUCCEEDED(rv) && addrDBFactory) {
IMPORT_LOG0( "Opening the new address book\n");

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

@ -103,7 +103,6 @@ static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
static NS_DEFINE_CID(kCopyMessageStreamListenerCID, NS_COPYMESSAGESTREAMLISTENER_CID);
static NS_DEFINE_CID(kMsgCopyServiceCID, NS_MSGCOPYSERVICE_CID);
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
extern char* ReadPopData(const char *hostname, const char* username, nsIFileSpec* mailDirectory);
extern void SavePopData(char *data, nsIFileSpec* maildirectory);

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

@ -65,7 +65,6 @@ static NS_DEFINE_CID(kIStreamConverterServiceCID,
NS_STREAMCONVERTERSERVICE_CID);
static NS_DEFINE_CID(kCMailboxUrl, NS_MAILBOXURL_CID);
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
nsMailboxService::nsMailboxService()

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

@ -73,7 +73,6 @@
#define PREF_MAIL_ROOT_MOVEMAIL "mail.root.movemail"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
nsMovemailService::nsMovemailService()
{

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

@ -58,7 +58,6 @@
#define PREF_MAIL_ROOT_NONE "mail.root.none"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
nsNoneService::nsNoneService()
{

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

@ -57,7 +57,6 @@
#include "nsIMsgLocalMailFolder.h"
static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
NS_IMPL_ISUPPORTS_INHERITED2(nsPop3IncomingServer,
@ -142,7 +141,7 @@ NS_IMETHODIMP nsPop3IncomingServer::PerformBiff()
}
//Biff just needs to give status in one of the windows. so do it in topmost window.
nsCOMPtr<nsIMsgMailSession> mailSession = do_GetService(kCMsgMailSessionCID, &rv);
nsCOMPtr<nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgWindow> msgWindow;

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

@ -69,7 +69,6 @@
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kPop3UrlCID, NS_POP3URL_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
nsPop3Service::nsPop3Service()

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

@ -174,8 +174,6 @@ protected:
};
static NS_DEFINE_CID(kIStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID);
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kCMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_CID(kPrefServiceCID,NS_PREF_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
static NS_DEFINE_CID(kStreamListenerTeeCID, NS_STREAMLISTENERTEE_CID);
@ -4285,7 +4283,7 @@ PRInt32 nsNNTPProtocol::DoCancel()
// get the current identity from the news session....
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(kCMsgAccountManagerCID, &rv);
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && accountManager) {
nsCOMPtr<nsISupportsArray> identities;
rv = accountManager->GetAllIdentities(getter_AddRefs(identities));

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

@ -51,11 +51,9 @@
#include "nsIMsgAccountManager.h"
#include "nsMsgFolderFlags.h"
#include "nsIRequestObserver.h"
// This file contains the news article download state machine.
static NS_DEFINE_CID(kNntpServiceCID, NS_NNTPSERVICE_CID);
// if pIds is not null, download the articles whose id's are passed in. Otherwise,
// which articles to download is determined by nsNewsDownloader object,
// or subclasses thereof. News can download marked objects, for example.
@ -348,7 +346,6 @@ DownloadMatchingNewsArticlesToNewsDB::~DownloadMatchingNewsArticlesToNewsDB()
{
}
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
NS_IMPL_ISUPPORTS1(nsMsgDownloadAllNewsgroups, nsIUrlListener)

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

@ -100,7 +100,6 @@
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kCNewsDB, NS_NEWSDB_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
// ###tw This really ought to be the most

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

@ -92,7 +92,6 @@
static NS_DEFINE_CID(kCNewsDB, NS_NEWSDB_CID);
static NS_DEFINE_CID(kCPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
static NS_DEFINE_CID(kMessengerMigratorCID, NS_MESSENGERMIGRATOR_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kCacheServiceCID, NS_CACHESERVICE_CID);