зеркало из https://github.com/mozilla/gecko-dev.git
Switch over mailnews/base to use nsIModule.
This commit is contained in:
Родитель
07068ab854
Коммит
489e979124
|
@ -19,6 +19,8 @@
|
||||||
#include "nsIFactory.h"
|
#include "nsIFactory.h"
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
#include "msgCore.h"
|
#include "msgCore.h"
|
||||||
|
#include "nsIModule.h"
|
||||||
|
#include "nsIGenericFactory.h"
|
||||||
#include "nsMsgBaseCID.h"
|
#include "nsMsgBaseCID.h"
|
||||||
#include "pratom.h"
|
#include "pratom.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
|
@ -78,7 +80,6 @@ static NS_DEFINE_CID(kCMsgGroupRecordCID, NS_MSGGROUPRECORD_CID);
|
||||||
|
|
||||||
static NS_DEFINE_CID(kMailNewsFolderDataSourceCID, NS_MAILNEWSFOLDERDATASOURCE_CID);
|
static NS_DEFINE_CID(kMailNewsFolderDataSourceCID, NS_MAILNEWSFOLDERDATASOURCE_CID);
|
||||||
static NS_DEFINE_CID(kMailNewsMessageDataSourceCID, NS_MAILNEWSMESSAGEDATASOURCE_CID);
|
static NS_DEFINE_CID(kMailNewsMessageDataSourceCID, NS_MAILNEWSMESSAGEDATASOURCE_CID);
|
||||||
static NS_DEFINE_CID(kCMessageViewDataSourceCID, NS_MESSAGEVIEWDATASOURCE_CID);
|
|
||||||
|
|
||||||
// account manager stuff
|
// account manager stuff
|
||||||
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
|
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
|
||||||
|
@ -110,279 +111,325 @@ static NS_DEFINE_CID(kMsgStatusFeedbackCID, NS_MSGSTATUSFEEDBACK_CID);
|
||||||
|
|
||||||
//MessageView
|
//MessageView
|
||||||
static NS_DEFINE_CID(kMessageViewCID, NS_MESSAGEVIEW_CID);
|
static NS_DEFINE_CID(kMessageViewCID, NS_MESSAGEVIEW_CID);
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static PRInt32 g_InstanceCount = 0;
|
|
||||||
static PRInt32 g_LockCount = 0;
|
|
||||||
|
|
||||||
class nsMsgFactory : public nsIFactory
|
|
||||||
|
// private factory declarations for each component we know how to produce
|
||||||
|
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessengerBootstrap)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlListenerManager)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgMailSession, Init)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessenger)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgAccountManager)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgAccount)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgIdentity)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgFolderDataSource, Init)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgMessageDataSource, Init)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgAccountManagerDataSource)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgFilterService)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgBiffManager)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgNotificationManager, Init)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCopyMessageStreamListener)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgCopyService)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgFolderCache)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgStatusFeedback)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessageView,Init)
|
||||||
|
|
||||||
|
// Module implementation for the sample library
|
||||||
|
class nsMsgBaseModule : public nsIModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// nsISupports methods
|
nsMsgBaseModule();
|
||||||
NS_DECL_ISUPPORTS
|
virtual ~nsMsgBaseModule();
|
||||||
|
|
||||||
nsMsgFactory(const nsCID &aClass,
|
NS_DECL_ISUPPORTS
|
||||||
const char* aClassName,
|
|
||||||
const char* aProgID);
|
|
||||||
|
|
||||||
// nsIFactory methods
|
NS_DECL_NSIMODULE
|
||||||
NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult);
|
|
||||||
NS_IMETHOD LockFactory(PRBool aLock);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsMsgFactory();
|
nsresult Initialize();
|
||||||
|
|
||||||
nsCID mClassID;
|
void Shutdown();
|
||||||
char* mClassName;
|
|
||||||
char* mProgID;
|
PRBool mInitialized;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMessengerBootstrapFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mUrlListenerManagerFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgMailSessionFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMessengerFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgAccountManagerFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgAccountFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgIdentityFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgFolderDataSourceFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgMessageDataSourceFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgAccountManagerDataSourceFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgFilterServiceFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgBiffManagerFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgNotificationManagerFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mCopyMessageStreamListenerFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgCopyServiceFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgFolderCacheFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMsgStatusFeedbackFactory;
|
||||||
|
nsCOMPtr<nsIGenericFactory> mMessageViewFactory;
|
||||||
};
|
};
|
||||||
|
|
||||||
nsMsgFactory::nsMsgFactory(const nsCID &aClass,
|
nsMsgBaseModule::nsMsgBaseModule()
|
||||||
const char* aClassName,
|
: mInitialized(PR_FALSE)
|
||||||
const char* aProgID)
|
|
||||||
: mClassID(aClass),
|
|
||||||
mClassName(nsCRT::strdup(aClassName)),
|
|
||||||
mProgID(nsCRT::strdup(aProgID))
|
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_ISUPPORTS();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMsgFactory::~nsMsgFactory()
|
nsMsgBaseModule::~nsMsgBaseModule()
|
||||||
{
|
{
|
||||||
|
Shutdown();
|
||||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
|
||||||
|
|
||||||
PL_strfree(mClassName);
|
|
||||||
PL_strfree(mProgID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
NS_IMPL_ISUPPORTS(nsMsgBaseModule, NS_GET_IID(nsIModule))
|
||||||
nsMsgFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|
||||||
|
// Perform our one-time intialization for this module
|
||||||
|
nsresult nsMsgBaseModule::Initialize()
|
||||||
{
|
{
|
||||||
if (aResult == NULL)
|
if (mInitialized)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_OK;
|
||||||
|
|
||||||
// Always NULL result, in case of failure
|
mInitialized = PR_TRUE;
|
||||||
*aResult = NULL;
|
return NS_OK;
|
||||||
|
|
||||||
// we support two interfaces....nsISupports and nsFactory.....
|
|
||||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
|
||||||
*aResult = (void *)NS_STATIC_CAST(nsISupports*,this);
|
|
||||||
else if (aIID.Equals(nsCOMTypeInfo<nsIFactory>::GetIID()))
|
|
||||||
*aResult = (void *)NS_STATIC_CAST(nsIFactory*,this);
|
|
||||||
|
|
||||||
if (*aResult == NULL)
|
|
||||||
return NS_NOINTERFACE;
|
|
||||||
|
|
||||||
NS_ADDREF_THIS(); // Increase reference count for caller
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsMsgFactory)
|
// Shutdown this module, releasing all of the module resources
|
||||||
NS_IMPL_RELEASE(nsMsgFactory)
|
void nsMsgBaseModule::Shutdown()
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsMsgFactory::CreateInstance(nsISupports * aOuter,
|
|
||||||
const nsIID &aIID,
|
|
||||||
void **aResult)
|
|
||||||
{
|
{
|
||||||
nsresult rv = NS_ERROR_NO_INTERFACE;
|
// Release the factory object
|
||||||
if (aResult == NULL)
|
mMessengerBootstrapFactory = null_nsCOMPtr();
|
||||||
return NS_ERROR_NULL_POINTER;
|
mUrlListenerManagerFactory = null_nsCOMPtr();
|
||||||
|
mMsgMailSessionFactory = null_nsCOMPtr();
|
||||||
|
mMessengerFactory = null_nsCOMPtr();
|
||||||
|
mMsgAccountManagerFactory = null_nsCOMPtr();
|
||||||
|
mMsgAccountFactory = null_nsCOMPtr();
|
||||||
|
mMsgIdentityFactory = null_nsCOMPtr();
|
||||||
|
mMsgFolderDataSourceFactory = null_nsCOMPtr();
|
||||||
|
mMsgMessageDataSourceFactory = null_nsCOMPtr();
|
||||||
|
mMsgAccountManagerDataSourceFactory = null_nsCOMPtr();
|
||||||
|
mMsgFilterServiceFactory = null_nsCOMPtr();
|
||||||
|
mMsgBiffManagerFactory = null_nsCOMPtr();
|
||||||
|
mMsgNotificationManagerFactory = null_nsCOMPtr();
|
||||||
|
mCopyMessageStreamListenerFactory = null_nsCOMPtr();
|
||||||
|
mMsgCopyServiceFactory = null_nsCOMPtr();
|
||||||
|
mMsgFolderCacheFactory = null_nsCOMPtr();
|
||||||
|
mMsgStatusFeedbackFactory = null_nsCOMPtr();
|
||||||
|
mMessageViewFactory = null_nsCOMPtr();
|
||||||
|
}
|
||||||
|
|
||||||
*aResult = NULL;
|
// Create a factory object for creating instances of aClass.
|
||||||
|
NS_IMETHODIMP nsMsgBaseModule::GetClassObject(nsIComponentManager *aCompMgr,
|
||||||
|
const nsCID& aClass,
|
||||||
|
const nsIID& aIID,
|
||||||
|
void** r_classObj)
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
// Defensive programming: Initialize *r_classObj in case of error below
|
||||||
|
if (!r_classObj)
|
||||||
|
return NS_ERROR_INVALID_POINTER;
|
||||||
|
|
||||||
// ClassID check happens here
|
*r_classObj = NULL;
|
||||||
// Whenever you add a new class that supports an interface, plug it in here!!!
|
|
||||||
|
|
||||||
if (mClassID.Equals(kCMsgFolderEventCID))
|
// Do one-time-only initialization if necessary
|
||||||
{
|
if (!mInitialized)
|
||||||
NS_NOTREACHED("hello? what happens here?");
|
{
|
||||||
rv = NS_OK;
|
rv = Initialize();
|
||||||
}
|
if (NS_FAILED(rv)) // Initialization failed! yikes!
|
||||||
else if (mClassID.Equals(kCMessengerBootstrapCID))
|
return rv;
|
||||||
{
|
|
||||||
rv = NS_NewMessengerBootstrap(aIID, aResult);
|
|
||||||
}
|
|
||||||
else if (mClassID.Equals(kCUrlListenerManagerCID))
|
|
||||||
{
|
|
||||||
nsUrlListenerManager * listener = nsnull;
|
|
||||||
listener = new nsUrlListenerManager();
|
|
||||||
if (listener == nsnull)
|
|
||||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
else {
|
|
||||||
rv = listener->QueryInterface(aIID, aResult);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
delete listener;
|
|
||||||
}
|
}
|
||||||
}
|
// Choose the appropriate factory, based on the desired instance
|
||||||
else if (mClassID.Equals(kCMsgMailSessionCID))
|
// class type (aClass).
|
||||||
{
|
nsCOMPtr<nsIGenericFactory> fact;
|
||||||
rv = NS_NewMsgMailSession(aIID, aResult);
|
|
||||||
}
|
|
||||||
else if (mClassID.Equals(kCMessengerCID))
|
|
||||||
{
|
|
||||||
rv = NS_NewMessenger(aIID, aResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (mClassID.Equals(kMsgAccountManagerCID))
|
if (aClass.Equals(kCMessengerBootstrapCID))
|
||||||
{
|
{
|
||||||
rv = NS_NewMsgAccountManager(aIID, aResult);
|
if (!mMessengerBootstrapFactory)
|
||||||
}
|
rv = NS_NewGenericFactory(getter_AddRefs(mMessengerBootstrapFactory), &nsMessengerBootstrapConstructor);
|
||||||
|
fact = mMessengerBootstrapFactory;
|
||||||
else if (mClassID.Equals(kMsgAccountCID))
|
|
||||||
{
|
|
||||||
rv = NS_NewMsgAccount(aIID, aResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (mClassID.Equals(kMsgIdentityCID)) {
|
|
||||||
nsMsgIdentity* identity = new nsMsgIdentity();
|
|
||||||
|
|
||||||
if (identity == nsnull)
|
|
||||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
else {
|
|
||||||
rv = identity->QueryInterface(aIID, aResult);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
delete identity;
|
|
||||||
}
|
}
|
||||||
}
|
else if (aClass.Equals(kCUrlListenerManagerCID))
|
||||||
#if 0
|
{
|
||||||
else if (mClassID.Equals(kMsgIncomingServerCID)) {
|
if (!mUrlListenerManagerFactory)
|
||||||
nsMsgIncomingServer *server = new nsMsgIncomingServer();
|
rv = NS_NewGenericFactory(getter_AddRefs(mUrlListenerManagerFactory), &nsUrlListenerManagerConstructor);
|
||||||
if (!server)
|
fact = mUrlListenerManagerFactory;
|
||||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
}
|
||||||
else {
|
else if (aClass.Equals(kCMsgMailSessionCID))
|
||||||
rv = server->QueryInterface(aIID, aResult);
|
{
|
||||||
if (NS_FAILED(rv))
|
if (!mMsgMailSessionFactory)
|
||||||
delete server;
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgMailSessionFactory), &nsMsgMailSessionConstructor);
|
||||||
|
fact = mMsgMailSessionFactory;
|
||||||
|
}
|
||||||
|
else if (aClass.Equals(kCMessengerCID))
|
||||||
|
{
|
||||||
|
if (!mMessengerFactory)
|
||||||
|
rv = NS_NewGenericFactory(getter_AddRefs(mMessengerFactory), &nsMessengerConstructor);
|
||||||
|
fact = mMessengerFactory;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (mClassID.Equals(kMailNewsFolderDataSourceCID))
|
|
||||||
{
|
|
||||||
rv = NS_NewMsgFolderDataSource(aIID, aResult);
|
|
||||||
}
|
|
||||||
else if (mClassID.Equals(kMailNewsMessageDataSourceCID))
|
|
||||||
{
|
|
||||||
rv = NS_NewMsgMessageDataSource(aIID, aResult);
|
|
||||||
}
|
|
||||||
else if (mClassID.Equals(kCMessageViewDataSourceCID))
|
|
||||||
{
|
|
||||||
rv = NS_NewMessageViewDataSource(aIID, aResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
// account manager RDF datasources
|
else if (aClass.Equals(kMsgAccountManagerCID))
|
||||||
else if (mClassID.Equals(kMsgAccountManagerDataSourceCID)) {
|
{
|
||||||
rv = NS_NewMsgAccountManagerDataSource(aIID, aResult);
|
if (!mMsgAccountManagerFactory)
|
||||||
}
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgAccountManagerFactory), &nsMsgAccountManagerConstructor);
|
||||||
else if (mClassID.Equals(kMsgFilterServiceCID)) {
|
fact = mMsgAccountManagerFactory;
|
||||||
rv = NS_NewMsgFilterService(aIID, aResult);
|
}
|
||||||
}
|
else if (aClass.Equals(kMsgAccountCID))
|
||||||
else if (mClassID.Equals(kMsgBiffManagerCID)){
|
{
|
||||||
rv = NS_NewMsgBiffManager(aIID, aResult);
|
if (!mMsgAccountFactory)
|
||||||
}
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgAccountFactory), &nsMsgAccountConstructor);
|
||||||
else if (mClassID.Equals(kMsgNotificationManagerCID)){
|
fact = mMsgAccountFactory;
|
||||||
rv = NS_NewMsgNotificationManager(aIID, aResult);
|
}
|
||||||
}
|
else if (aClass.Equals(kMsgIdentityCID))
|
||||||
else if (mClassID.Equals(kCopyMessageStreamListenerCID)){
|
{
|
||||||
rv = NS_NewCopyMessageStreamListener(aIID, aResult);
|
if (!mMsgIdentityFactory)
|
||||||
}
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgIdentityFactory), &nsMsgIdentityConstructor);
|
||||||
else if (mClassID.Equals(kMsgCopyServiceCID)) {
|
fact = mMsgIdentityFactory;
|
||||||
rv = NS_NewMsgCopyService(aIID, aResult);
|
}
|
||||||
}
|
else if (aClass.Equals(kMailNewsFolderDataSourceCID))
|
||||||
else if (mClassID.Equals(kMsgFolderCacheCID)) {
|
{
|
||||||
nsMsgFolderCache * folderCache = nsnull;
|
if (!mMsgFolderDataSourceFactory)
|
||||||
folderCache = new nsMsgFolderCache ();
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgFolderDataSourceFactory), &nsMsgFolderDataSourceConstructor);
|
||||||
if (folderCache == nsnull)
|
fact = mMsgFolderDataSourceFactory;
|
||||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
}
|
||||||
else
|
else if (aClass.Equals(kMailNewsMessageDataSourceCID))
|
||||||
{
|
{
|
||||||
rv = folderCache->QueryInterface(aIID, aResult);
|
if (!mMsgMessageDataSourceFactory)
|
||||||
if (NS_FAILED(rv))
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgMessageDataSourceFactory), &nsMsgMessageDataSourceConstructor);
|
||||||
delete folderCache;
|
fact = mMsgMessageDataSourceFactory;
|
||||||
}
|
}
|
||||||
}
|
else if (aClass.Equals(kMsgAccountManagerDataSourceCID))
|
||||||
else if (mClassID.Equals(kMsgStatusFeedbackCID)) {
|
{
|
||||||
rv = NS_NewMsgStatusFeedback(aIID, aResult);
|
if (!mMsgAccountManagerDataSourceFactory)
|
||||||
}
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgAccountManagerDataSourceFactory), &nsMsgAccountManagerDataSourceConstructor);
|
||||||
else if (mClassID.Equals(kMessageViewCID)) {
|
fact = mMsgAccountManagerDataSourceFactory;
|
||||||
rv = NS_NewMessageView(aIID, aResult);
|
}
|
||||||
}
|
else if (aClass.Equals(kMsgFilterServiceCID))
|
||||||
|
{
|
||||||
|
if (!mMsgFilterServiceFactory)
|
||||||
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgFilterServiceFactory), &nsMsgFilterServiceConstructor);
|
||||||
|
fact = mMsgFilterServiceFactory;
|
||||||
|
}
|
||||||
|
else if (aClass.Equals(kMsgBiffManagerCID))
|
||||||
|
{
|
||||||
|
if (!mMsgBiffManagerFactory)
|
||||||
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgBiffManagerFactory), &nsMsgBiffManagerConstructor);
|
||||||
|
fact = mMsgBiffManagerFactory;
|
||||||
|
}
|
||||||
|
else if (aClass.Equals(kMsgNotificationManagerCID))
|
||||||
|
{
|
||||||
|
if (!mMsgNotificationManagerFactory)
|
||||||
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgNotificationManagerFactory), &nsMsgNotificationManagerConstructor);
|
||||||
|
fact = mMsgNotificationManagerFactory;
|
||||||
|
}
|
||||||
|
else if (aClass.Equals(kCopyMessageStreamListenerCID))
|
||||||
|
{
|
||||||
|
if (!mCopyMessageStreamListenerFactory)
|
||||||
|
rv = NS_NewGenericFactory(getter_AddRefs(mCopyMessageStreamListenerFactory), &nsCopyMessageStreamListenerConstructor);
|
||||||
|
fact = mCopyMessageStreamListenerFactory;
|
||||||
|
}
|
||||||
|
else if (aClass.Equals(kMsgCopyServiceCID))
|
||||||
|
{
|
||||||
|
if (!mMsgCopyServiceFactory)
|
||||||
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgCopyServiceFactory), &nsMsgCopyServiceConstructor);
|
||||||
|
fact = mMsgCopyServiceFactory;
|
||||||
|
}
|
||||||
|
else if (aClass.Equals(kMsgFolderCacheCID))
|
||||||
|
{
|
||||||
|
if (!mMsgFolderCacheFactory)
|
||||||
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgFolderCacheFactory), &nsMsgFolderCacheConstructor);
|
||||||
|
fact = mMsgFolderCacheFactory;
|
||||||
|
}
|
||||||
|
else if (aClass.Equals(kMsgStatusFeedbackCID))
|
||||||
|
{
|
||||||
|
if (!mMsgStatusFeedbackFactory)
|
||||||
|
rv = NS_NewGenericFactory(getter_AddRefs(mMsgStatusFeedbackFactory), &nsMsgStatusFeedbackConstructor);
|
||||||
|
fact = mMsgStatusFeedbackFactory;
|
||||||
|
}
|
||||||
|
else if (aClass.Equals(kMessageViewCID))
|
||||||
|
{
|
||||||
|
if (!mMessageViewFactory)
|
||||||
|
rv = NS_NewGenericFactory(getter_AddRefs(mMessageViewFactory), &nsMessageViewConstructor);
|
||||||
|
fact = mMessageViewFactory;
|
||||||
|
}
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
PR_AtomicIncrement(&g_InstanceCount);
|
if (fact)
|
||||||
return rv;
|
rv = fact->QueryInterface(aIID, r_classObj);
|
||||||
|
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
struct Components {
|
||||||
nsMsgFactory::LockFactory(PRBool aLock)
|
const char* mDescription;
|
||||||
|
const nsID* mCID;
|
||||||
|
const char* mProgID;
|
||||||
|
};
|
||||||
|
|
||||||
|
// The list of components we register
|
||||||
|
static Components gComponents[] = {
|
||||||
|
{ "Netscape Messenger Bootstrapper", &kCMessengerBootstrapCID,
|
||||||
|
NS_MESSENGERBOOTSTRAP_PROGID },
|
||||||
|
{ "UrlListenerManager", &kCUrlListenerManagerCID,
|
||||||
|
NS_URLLISTENERMANAGER_PROGID },
|
||||||
|
{ "Mail Session", &kCMsgMailSessionCID,
|
||||||
|
NS_MSGMAILSESSION_PROGID },
|
||||||
|
{ "Messenger DOM interaction object", &kCMessengerCID,
|
||||||
|
NS_MESSENGER_PROGID },
|
||||||
|
{ "Messenger Account Manager", &kMsgAccountManagerCID,
|
||||||
|
NS_MSGACCOUNTMANAGER_PROGID },
|
||||||
|
{ "Messenger User Account", &kMsgAccountCID,
|
||||||
|
NS_MSGACCOUNT_PROGID },
|
||||||
|
{ "Messenger User Identity", &kMsgIdentityCID,
|
||||||
|
NS_MSGIDENTITY_PROGID },
|
||||||
|
{ "Mail/News Folder Data Source", &kMailNewsFolderDataSourceCID,
|
||||||
|
NS_MAILNEWSFOLDERDATASOURCE_PROGID },
|
||||||
|
{ "Mail/News Message Data Source", &kMailNewsMessageDataSourceCID,
|
||||||
|
NS_MAILNEWSMESSAGEDATASOURCE_PROGID},
|
||||||
|
{ "Mail/News Account Manager Data Source", &kMsgAccountManagerDataSourceCID,
|
||||||
|
NS_RDF_DATASOURCE_PROGID_PREFIX "msgaccountmanager"},
|
||||||
|
{ "Message Filter Service", &kMsgFilterServiceCID,
|
||||||
|
NS_MSGFILTERSERVICE_PROGID},
|
||||||
|
{ "Messenger Biff Manager", &kMsgBiffManagerCID,
|
||||||
|
NS_MSGBIFFMANAGER_PROGID},
|
||||||
|
{ "Mail/News Notification Manager", &kMsgNotificationManagerCID,
|
||||||
|
NS_MSGNOTIFICATIONMANAGER_PROGID},
|
||||||
|
{ "Mail/News CopyMessage Stream Listener", &kCopyMessageStreamListenerCID,
|
||||||
|
NS_COPYMESSAGESTREAMLISTENER_PROGID},
|
||||||
|
{ "Mail/News Message Copy Service", &kMsgCopyServiceCID,
|
||||||
|
NS_MSGCOPYSERVICE_PROGID},
|
||||||
|
{ "Mail/News Folder Cache", &kMsgFolderCacheCID,
|
||||||
|
NS_MSGFOLDERCACHE_PROGID},
|
||||||
|
{ "Mail/News Status Feedback", &kMsgStatusFeedbackCID,
|
||||||
|
NS_MSGSTATUSFEEDBACK_PROGID},
|
||||||
|
{ "Mail/News MessageView", &kMessageViewCID,
|
||||||
|
NS_MESSAGEVIEW_PROGID}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#define NUM_COMPONENTS (sizeof(gComponents) / sizeof(gComponents[0]))
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsMsgBaseModule::RegisterSelf(nsIComponentManager *aCompMgr,
|
||||||
|
nsIFileSpec* aPath,
|
||||||
|
const char* registryLocation,
|
||||||
|
const char* componentType)
|
||||||
{
|
{
|
||||||
if (aLock)
|
nsresult rv = NS_OK;
|
||||||
PR_AtomicIncrement(&g_LockCount);
|
|
||||||
else
|
|
||||||
PR_AtomicDecrement(&g_LockCount);
|
|
||||||
|
|
||||||
return NS_OK;
|
Components* cp = gComponents;
|
||||||
}
|
Components* end = cp + NUM_COMPONENTS;
|
||||||
|
while (cp < end)
|
||||||
|
{
|
||||||
|
rv = aCompMgr->RegisterComponentSpec(*cp->mCID, cp->mDescription,
|
||||||
|
cp->mProgID, aPath, PR_TRUE,
|
||||||
|
PR_TRUE);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
break;
|
||||||
|
cp++;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
/* Add to MessengerBootstrap appshell component list. */
|
||||||
|
|
||||||
// return the proper factory to the caller.
|
|
||||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* /*aServMgr */,
|
|
||||||
const nsCID &aClass,
|
|
||||||
const char *aClassName,
|
|
||||||
const char *aProgID,
|
|
||||||
nsIFactory **aFactory)
|
|
||||||
{
|
|
||||||
if (nsnull == aFactory)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
*aFactory = new nsMsgFactory(aClass, aClassName, aProgID);
|
|
||||||
if (aFactory)
|
|
||||||
return (*aFactory)->QueryInterface(nsCOMTypeInfo<nsIFactory>::GetIID(),
|
|
||||||
(void**)aFactory);
|
|
||||||
else
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* /* aServMgr */)
|
|
||||||
{
|
|
||||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
extern "C" NS_EXPORT nsresult
|
|
||||||
NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
nsresult finalResult = NS_OK;
|
|
||||||
|
|
||||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
// register the message folder factory
|
|
||||||
rv = compMgr->RegisterComponent(kCMsgFolderEventCID,
|
|
||||||
"Folder Event",
|
|
||||||
nsnull,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
rv = compMgr->RegisterComponent(kCUrlListenerManagerCID,
|
|
||||||
"UrlListenerManager",
|
|
||||||
NS_URLLISTENERMANAGER_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kCMessengerBootstrapCID,
|
|
||||||
"Netscape Messenger Bootstrapper",
|
|
||||||
NS_MESSENGERBOOTSTRAP_PROGID,
|
|
||||||
path,
|
|
||||||
PR_TRUE, PR_TRUE);
|
|
||||||
if ( NS_SUCCEEDED( rv ) ) {
|
|
||||||
/* Add to appshell component list. */
|
|
||||||
NS_WITH_SERVICE(nsIRegistry, registry, NS_REGISTRY_PROGID, &rv);
|
NS_WITH_SERVICE(nsIRegistry, registry, NS_REGISTRY_PROGID, &rv);
|
||||||
|
|
||||||
if ( NS_SUCCEEDED( rv ) ) {
|
if ( NS_SUCCEEDED( rv ) ) {
|
||||||
|
@ -399,188 +446,60 @@ NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
||||||
rv = registry->AddSubtree( nsIRegistry::Common,
|
rv = registry->AddSubtree( nsIRegistry::Common,
|
||||||
buffer,
|
buffer,
|
||||||
&key );
|
&key );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kCMessengerCID,
|
return rv;
|
||||||
"Messenger DOM interaction object",
|
|
||||||
NS_MESSENGER_PROGID,
|
|
||||||
path,
|
|
||||||
PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kMsgAccountManagerCID,
|
|
||||||
"Messenger Account Manager",
|
|
||||||
NS_MSGACCOUNTMANAGER_PROGID,
|
|
||||||
path,
|
|
||||||
PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kMsgAccountCID,
|
|
||||||
"Messenger User Account",
|
|
||||||
NS_MSGACCOUNT_PROGID,
|
|
||||||
path,
|
|
||||||
PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kMsgIdentityCID,
|
|
||||||
"Messenger User Identity",
|
|
||||||
NS_MSGIDENTITY_PROGID,
|
|
||||||
path,
|
|
||||||
PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
#if 0
|
|
||||||
rv = compMgr->RegisterComponent(kMsgIncomingServerCID,
|
|
||||||
"Messenger Incoming Server",
|
|
||||||
NS_MSGINCOMINGSERVER_PROGID,
|
|
||||||
path,
|
|
||||||
PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
#endif
|
|
||||||
rv = compMgr->RegisterComponent(kCMsgMailSessionCID,
|
|
||||||
"Mail Session",
|
|
||||||
NS_MSGMAILSESSION_PROGID,
|
|
||||||
path,
|
|
||||||
PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
// register our RDF datasources:
|
|
||||||
rv = compMgr->RegisterComponent(kMailNewsFolderDataSourceCID,
|
|
||||||
"Mail/News Folder Data Source",
|
|
||||||
NS_MAILNEWSFOLDERDATASOURCE_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
// register our RDF datasources:
|
|
||||||
rv = compMgr->RegisterComponent(kMailNewsMessageDataSourceCID,
|
|
||||||
"Mail/News Message Data Source",
|
|
||||||
NS_MAILNEWSMESSAGEDATASOURCE_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kCMessageViewDataSourceCID,
|
|
||||||
"Mail/News Message View Data Source",
|
|
||||||
NS_MESSAGEVIEWDATASOURCE_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kMsgAccountManagerDataSourceCID,
|
|
||||||
"Mail/News Account Manager Data Source",
|
|
||||||
NS_RDF_DATASOURCE_PROGID_PREFIX "msgaccountmanager",
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kMsgFilterServiceCID,
|
|
||||||
"Message Filter Service",
|
|
||||||
NS_MSGFILTERSERVICE_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kMsgBiffManagerCID,
|
|
||||||
"Messenger Biff Manager",
|
|
||||||
NS_MSGBIFFMANAGER_PROGID,
|
|
||||||
path,
|
|
||||||
PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kMsgNotificationManagerCID,
|
|
||||||
"Mail/News Notification Manager",
|
|
||||||
NS_MSGNOTIFICATIONMANAGER_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kCopyMessageStreamListenerCID,
|
|
||||||
"Mail/News CopyMessage Stream Listener",
|
|
||||||
NS_COPYMESSAGESTREAMLISTENER_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kMsgCopyServiceCID,
|
|
||||||
"Mail/News Message Copy Service",
|
|
||||||
NS_MSGCOPYSERVICE_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kMsgFolderCacheCID,
|
|
||||||
"Mail/News Folder Cache",
|
|
||||||
NS_MSGFOLDERCACHE_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kMsgStatusFeedbackCID,
|
|
||||||
"Mail/News Status Feedback",
|
|
||||||
NS_MSGSTATUSFEEDBACK_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
rv = compMgr->RegisterComponent(kMessageViewCID,
|
|
||||||
"Mail/News MessageView",
|
|
||||||
NS_MESSAGEVIEW_PROGID,
|
|
||||||
path, PR_TRUE, PR_TRUE);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
return finalResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" NS_EXPORT nsresult
|
NS_IMETHODIMP nsMsgBaseModule::UnregisterSelf(nsIComponentManager* aCompMgr,
|
||||||
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
nsIFileSpec* aPath,
|
||||||
|
const char* registryLocation)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
Components* cp = gComponents;
|
||||||
nsresult finalResult = NS_OK;
|
Components* end = cp + NUM_COMPONENTS;
|
||||||
|
while (cp < end)
|
||||||
|
{
|
||||||
|
aCompMgr->UnregisterComponentSpec(*cp->mCID, aPath);
|
||||||
|
cp++;
|
||||||
|
}
|
||||||
|
|
||||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
return NS_OK;
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
rv = compMgr->UnregisterComponent(kCUrlListenerManagerCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->UnregisterComponent(kCMessengerBootstrapCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->UnregisterComponent(kCMsgFolderEventCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->UnregisterComponent(kCMsgMailSessionCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
rv = compMgr->UnregisterComponent(kMailNewsFolderDataSourceCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
rv = compMgr->UnregisterComponent(kMailNewsMessageDataSourceCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
rv = compMgr->UnregisterComponent(kCMessageViewDataSourceCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
// Account Manager RDF stuff
|
|
||||||
rv = compMgr->UnregisterComponent(kMsgAccountManagerDataSourceCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
rv = compMgr->UnregisterComponent(kMsgFilterServiceCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
//Biff
|
|
||||||
rv = compMgr->UnregisterComponent(kMsgBiffManagerCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
rv = compMgr->UnregisterComponent(kMsgNotificationManagerCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->UnregisterComponent(kCopyMessageStreamListenerCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->UnregisterComponent(kMsgCopyServiceCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->UnregisterComponent(kMsgFolderCacheCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->UnregisterComponent(kMsgStatusFeedbackCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
rv = compMgr->UnregisterComponent(kMessageViewCID, path);
|
|
||||||
if (NS_FAILED(rv)) finalResult = rv;
|
|
||||||
|
|
||||||
return finalResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
NS_IMETHODIMP nsMsgBaseModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
|
||||||
|
{
|
||||||
|
if (!okToUnload)
|
||||||
|
return NS_ERROR_INVALID_POINTER;
|
||||||
|
|
||||||
|
*okToUnload = PR_FALSE;
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
static nsMsgBaseModule *gModule = NULL;
|
||||||
|
|
||||||
|
extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr,
|
||||||
|
nsIFileSpec* location,
|
||||||
|
nsIModule** return_cobj)
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
NS_ASSERTION(return_cobj, "Null argument");
|
||||||
|
NS_ASSERTION(gModule == NULL, "nsMsgBaseModule: Module already created.");
|
||||||
|
|
||||||
|
// Create an initialize the imap module instance
|
||||||
|
nsMsgBaseModule *module = new nsMsgBaseModule();
|
||||||
|
if (!module)
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
// Increase refcnt and store away nsIModule interface to m in return_cobj
|
||||||
|
rv = module->QueryInterface(nsIModule::GetIID(), (void**)return_cobj);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
{
|
||||||
|
delete module;
|
||||||
|
module = nsnull;
|
||||||
|
}
|
||||||
|
gModule = module; // WARNING: Weak Reference
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
|
@ -28,18 +28,6 @@
|
||||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewCopyMessageStreamListener(const nsIID& iid, void **result)
|
|
||||||
{
|
|
||||||
nsCopyMessageStreamListener *listener = new nsCopyMessageStreamListener();
|
|
||||||
if(!listener)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
return listener->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
/* the following macros actually implement addref, release and query interface for our component. */
|
/* the following macros actually implement addref, release and query interface for our component. */
|
||||||
NS_IMPL_ADDREF(nsCopyMessageStreamListener)
|
NS_IMPL_ADDREF(nsCopyMessageStreamListener)
|
||||||
|
|
|
@ -44,11 +44,6 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewCopyMessageStreamListener(const nsIID& iid, void **result);
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,25 +18,7 @@
|
||||||
|
|
||||||
#include "nsMessageView.h"
|
#include "nsMessageView.h"
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMessageView(const nsIID& iid, void **result)
|
|
||||||
{
|
|
||||||
nsMessageView *messageView = new nsMessageView();
|
|
||||||
if(!messageView)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
nsresult rv = messageView->Init();
|
|
||||||
if(NS_FAILED(rv))
|
|
||||||
{
|
|
||||||
delete messageView;
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
return messageView->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsMessageView, nsCOMTypeInfo<nsIMessageView>::GetIID())
|
NS_IMPL_ISUPPORTS(nsMessageView, nsCOMTypeInfo<nsIMessageView>::GetIID())
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,6 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMessageView(const nsIID& iid, void **result);
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,14 +18,11 @@
|
||||||
|
|
||||||
#include "prsystem.h"
|
#include "prsystem.h"
|
||||||
|
|
||||||
#include "nsIMessenger.h"
|
|
||||||
#include "nsMessenger.h"
|
#include "nsMessenger.h"
|
||||||
|
|
||||||
/* rhp - for access to webshell */
|
/* rhp - for access to webshell */
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsIDOMWindow.h"
|
#include "nsIDOMWindow.h"
|
||||||
#include "nsIBrowserWindow.h"
|
#include "nsIBrowserWindow.h"
|
||||||
#include "nsIWebShell.h"
|
|
||||||
#include "nsIWebShellWindow.h"
|
#include "nsIWebShellWindow.h"
|
||||||
#include "nsIScriptGlobalObject.h"
|
#include "nsIScriptGlobalObject.h"
|
||||||
#include "nsAppShellCIDs.h"
|
#include "nsAppShellCIDs.h"
|
||||||
|
@ -36,7 +33,6 @@
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDocumentViewer.h"
|
#include "nsIDocumentViewer.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMXULDocument.h"
|
||||||
#include "nsIDocumentLoaderObserver.h"
|
|
||||||
|
|
||||||
#include "nsIMsgMailSession.h"
|
#include "nsIMsgMailSession.h"
|
||||||
#include "nsIMsgIncomingServer.h"
|
#include "nsIMsgIncomingServer.h"
|
||||||
|
@ -44,7 +40,6 @@
|
||||||
#include "nsINoIncomingServer.h"
|
#include "nsINoIncomingServer.h"
|
||||||
#include "nsIMsgMessageService.h"
|
#include "nsIMsgMessageService.h"
|
||||||
#include "nsIFileSpecWithUI.h"
|
#include "nsIFileSpecWithUI.h"
|
||||||
#include "nsFileSpec.h"
|
|
||||||
#include "nsFileStream.h"
|
#include "nsFileStream.h"
|
||||||
|
|
||||||
#include "nsIMessage.h"
|
#include "nsIMessage.h"
|
||||||
|
@ -72,7 +67,6 @@
|
||||||
|
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsTransactionManagerCID.h"
|
#include "nsTransactionManagerCID.h"
|
||||||
#include "nsITransactionManager.h"
|
|
||||||
|
|
||||||
#include "nsIMsgSendLater.h"
|
#include "nsIMsgSendLater.h"
|
||||||
#include "nsMsgCompCID.h"
|
#include "nsMsgCompCID.h"
|
||||||
|
@ -149,38 +143,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class nsMessenger : public nsIMessenger
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
nsMessenger();
|
|
||||||
virtual ~nsMessenger();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
NS_DECL_NSIMESSENGER
|
|
||||||
|
|
||||||
protected:
|
|
||||||
nsresult DoDelete(nsIRDFCompositeDataSource* db, nsISupportsArray *srcArray, nsISupportsArray *deletedArray);
|
|
||||||
nsresult DoCommand(nsIRDFCompositeDataSource *db, char * command, nsISupportsArray *srcArray,
|
|
||||||
nsISupportsArray *arguments);
|
|
||||||
nsresult DoMarkMessagesRead(nsIRDFCompositeDataSource *database, nsISupportsArray *resourceArray, PRBool markRead);
|
|
||||||
nsresult DoMarkMessagesFlagged(nsIRDFCompositeDataSource *database, nsISupportsArray *resourceArray, PRBool markFlagged);
|
|
||||||
private:
|
|
||||||
|
|
||||||
nsString mId;
|
|
||||||
void *mScriptObject;
|
|
||||||
nsCOMPtr<nsITransactionManager> mTxnMgr;
|
|
||||||
|
|
||||||
/* rhp - need this to drive message display */
|
|
||||||
nsIDOMWindow *mWindow;
|
|
||||||
nsIWebShell *mWebShell;
|
|
||||||
|
|
||||||
nsCOMPtr <nsIDocumentLoaderObserver> m_docLoaderObserver;
|
|
||||||
// mscott: temporary variable used to support running urls through the 'Demo' menu....
|
|
||||||
nsFileSpec m_folderPath;
|
|
||||||
void InitializeFolderRoot();
|
|
||||||
};
|
|
||||||
|
|
||||||
static nsresult ConvertDOMListToResourceArray(nsIDOMNodeList *nodeList, nsISupportsArray **resourceArray)
|
static nsresult ConvertDOMListToResourceArray(nsIDOMNodeList *nodeList, nsISupportsArray **resourceArray)
|
||||||
{
|
{
|
||||||
|
@ -305,19 +267,6 @@ nsMessenger::GetNewMessages(nsIRDFCompositeDataSource *db, nsIDOMXULElement *fol
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
|
||||||
nsresult
|
|
||||||
NS_NewMessenger(const nsIID &aIID, void **aResult)
|
|
||||||
{
|
|
||||||
if (!aResult) return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
nsMessenger *appcore = new nsMessenger();
|
|
||||||
if (appcore)
|
|
||||||
return appcore->QueryInterface(aIID, (void **)aResult);
|
|
||||||
else
|
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMessenger::SetWindow(nsIDOMWindow *aWin, nsIMsgStatusFeedback *aStatusFeedback)
|
nsMessenger::SetWindow(nsIDOMWindow *aWin, nsIMsgStatusFeedback *aStatusFeedback)
|
||||||
|
|
|
@ -21,17 +21,50 @@
|
||||||
|
|
||||||
#include "nsCom.h"
|
#include "nsCom.h"
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
|
#include "nsIMessenger.h"
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsITransactionManager.h"
|
||||||
|
#include "nsIDocumentLoaderObserver.h"
|
||||||
|
#include "nsFileSpec.h"
|
||||||
|
#include "nsIWebShell.h"
|
||||||
|
|
||||||
|
class nsMessenger : public nsIMessenger
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
nsMessenger();
|
||||||
|
virtual ~nsMessenger();
|
||||||
|
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
NS_DECL_NSIMESSENGER
|
||||||
|
|
||||||
|
protected:
|
||||||
|
nsresult DoDelete(nsIRDFCompositeDataSource* db, nsISupportsArray *srcArray, nsISupportsArray *deletedArray);
|
||||||
|
nsresult DoCommand(nsIRDFCompositeDataSource *db, char * command, nsISupportsArray *srcArray,
|
||||||
|
nsISupportsArray *arguments);
|
||||||
|
nsresult DoMarkMessagesRead(nsIRDFCompositeDataSource *database, nsISupportsArray *resourceArray, PRBool markRead);
|
||||||
|
nsresult DoMarkMessagesFlagged(nsIRDFCompositeDataSource *database, nsISupportsArray *resourceArray, PRBool markFlagged);
|
||||||
|
private:
|
||||||
|
|
||||||
|
nsString mId;
|
||||||
|
void *mScriptObject;
|
||||||
|
nsCOMPtr<nsITransactionManager> mTxnMgr;
|
||||||
|
|
||||||
|
/* rhp - need this to drive message display */
|
||||||
|
nsIDOMWindow *mWindow;
|
||||||
|
nsIWebShell *mWebShell;
|
||||||
|
|
||||||
|
nsCOMPtr <nsIDocumentLoaderObserver> m_docLoaderObserver;
|
||||||
|
// mscott: temporary variable used to support running urls through the 'Demo' menu....
|
||||||
|
nsFileSpec m_folderPath;
|
||||||
|
void InitializeFolderRoot();
|
||||||
|
};
|
||||||
|
|
||||||
#define NS_MESSENGER_CID \
|
#define NS_MESSENGER_CID \
|
||||||
{ /* 3f181950-c14d-11d2-b7f2-00805f05ffa5 */ \
|
{ /* 3f181950-c14d-11d2-b7f2-00805f05ffa5 */ \
|
||||||
0x3f181950, 0xc14d, 0x11d2, \
|
0x3f181950, 0xc14d, 0x11d2, \
|
||||||
{0xb7, 0xf2, 0x0, 0x80, 0x5f, 0x05, 0xff, 0xa5}}
|
{0xb7, 0xf2, 0x0, 0x80, 0x5f, 0x05, 0xff, 0xa5}}
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMessenger(const nsIID &aIID, void **);
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,22 +17,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsMessengerBootstrap.h"
|
#include "nsMessengerBootstrap.h"
|
||||||
#include "nsIAppShellComponent.h"
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
||||||
#include "nsDOMCID.h"
|
#include "nsDOMCID.h"
|
||||||
|
|
||||||
class nsMessengerBootstrap : public nsIAppShellComponent {
|
|
||||||
|
|
||||||
public:
|
|
||||||
nsMessengerBootstrap();
|
|
||||||
virtual ~nsMessengerBootstrap();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
NS_DECL_NSIAPPSHELLCOMPONENT
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsMessengerBootstrap, nsCOMTypeInfo<nsIAppShellComponent>::GetIID())
|
NS_IMPL_ISUPPORTS(nsMessengerBootstrap, nsCOMTypeInfo<nsIAppShellComponent>::GetIID())
|
||||||
|
|
||||||
|
@ -74,17 +63,4 @@ nsMessengerBootstrap::Shutdown()
|
||||||
return finalrv;
|
return finalrv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMessengerBootstrap(const nsIID &aIID, void ** msgboot)
|
|
||||||
{
|
|
||||||
if (!msgboot) return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
nsMessengerBootstrap *bootstrap =
|
|
||||||
new nsMessengerBootstrap();
|
|
||||||
|
|
||||||
if (!bootstrap) return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
|
|
||||||
return bootstrap->QueryInterface(aIID, msgboot);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIAppShellService.h"
|
#include "nsIAppShellService.h"
|
||||||
|
#include "nsIAppShellComponent.h"
|
||||||
|
|
||||||
#define NS_MESSENGERBOOTSTRAP_CID \
|
#define NS_MESSENGERBOOTSTRAP_CID \
|
||||||
{ /* 4a85a5d0-cddd-11d2-b7f6-00805f05ffa5 */ \
|
{ /* 4a85a5d0-cddd-11d2-b7f6-00805f05ffa5 */ \
|
||||||
|
@ -30,10 +31,17 @@
|
||||||
{0xb7, 0xf6, 0x00, 0x80, 0x5f, 0x05, 0xff, 0xa5}}
|
{0xb7, 0xf6, 0x00, 0x80, 0x5f, 0x05, 0xff, 0xa5}}
|
||||||
|
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
class nsMessengerBootstrap : public nsIAppShellComponent {
|
||||||
|
|
||||||
nsresult NS_NewMessengerBootstrap(const nsIID &aIID, void ** inst);
|
public:
|
||||||
|
nsMessengerBootstrap();
|
||||||
|
virtual ~nsMessengerBootstrap();
|
||||||
|
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
NS_DECL_NSIAPPSHELLCOMPONENT
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,33 +39,6 @@ static NS_DEFINE_CID(kMsgIdentityCID, NS_MSGIDENTITY_CID);
|
||||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||||
|
|
||||||
|
|
||||||
class nsMsgAccount : public nsIMsgAccount,
|
|
||||||
public nsIShutdownListener
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
nsMsgAccount();
|
|
||||||
virtual ~nsMsgAccount();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
NS_DECL_NSIMSGACCOUNT
|
|
||||||
// nsIShutdownListener
|
|
||||||
|
|
||||||
NS_IMETHOD OnShutdown(const nsCID& aClass, nsISupports *service);
|
|
||||||
|
|
||||||
private:
|
|
||||||
char *m_accountKey;
|
|
||||||
nsIPref *m_prefs;
|
|
||||||
nsCOMPtr<nsIMsgIncomingServer> m_incomingServer;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgIdentity> m_defaultIdentity;
|
|
||||||
nsCOMPtr<nsISupportsArray> m_identities;
|
|
||||||
|
|
||||||
nsresult getPrefService();
|
|
||||||
nsresult createIncomingServer();
|
|
||||||
nsresult createIdentities();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -424,15 +397,4 @@ nsMsgAccount::OnShutdown(const nsCID& aClass, nsISupports *service)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgAccount(const nsIID& iid, void **result)
|
|
||||||
{
|
|
||||||
if (!result) return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
nsMsgAccount *account = new nsMsgAccount;
|
|
||||||
if (!account) return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
return account->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,31 @@
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsIMsgAccount.h"
|
#include "nsIMsgAccount.h"
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
class nsMsgAccount : public nsIMsgAccount,
|
||||||
|
public nsIShutdownListener
|
||||||
|
{
|
||||||
|
|
||||||
nsresult
|
public:
|
||||||
NS_NewMsgAccount(const nsIID& iid, void **result);
|
nsMsgAccount();
|
||||||
|
virtual ~nsMsgAccount();
|
||||||
|
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
NS_DECL_NSIMSGACCOUNT
|
||||||
|
// nsIShutdownListener
|
||||||
|
|
||||||
|
NS_IMETHOD OnShutdown(const nsCID& aClass, nsISupports *service);
|
||||||
|
|
||||||
|
private:
|
||||||
|
char *m_accountKey;
|
||||||
|
nsIPref *m_prefs;
|
||||||
|
nsCOMPtr<nsIMsgIncomingServer> m_incomingServer;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIMsgIdentity> m_defaultIdentity;
|
||||||
|
nsCOMPtr<nsISupportsArray> m_identities;
|
||||||
|
|
||||||
|
nsresult getPrefService();
|
||||||
|
nsresult createIncomingServer();
|
||||||
|
nsresult createIdentities();
|
||||||
|
};
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
|
@ -16,16 +16,12 @@
|
||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsIMsgAccountManager.h"
|
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsISupportsArray.h"
|
#include "nsISupportsArray.h"
|
||||||
#include "nsMsgAccountManager.h"
|
#include "nsMsgAccountManager.h"
|
||||||
#include "nsHashtable.h"
|
|
||||||
#include "nsMsgBaseCID.h"
|
#include "nsMsgBaseCID.h"
|
||||||
#include "nsMsgCompCID.h"
|
#include "nsMsgCompCID.h"
|
||||||
#include "nsIPref.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
@ -47,7 +43,6 @@
|
||||||
#include "nsFileLocations.h"
|
#include "nsFileLocations.h"
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#include "nsISmtpService.h"
|
#include "nsISmtpService.h"
|
||||||
#include "nsISmtpServer.h"
|
|
||||||
|
|
||||||
// this should eventually be moved to the pop3 server for upgrading
|
// this should eventually be moved to the pop3 server for upgrading
|
||||||
#include "nsIPop3IncomingServer.h"
|
#include "nsIPop3IncomingServer.h"
|
||||||
|
@ -303,139 +298,6 @@ typedef struct _findAccountByKeyEntry {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class nsMsgAccountManager : public nsIMsgAccountManager,
|
|
||||||
public nsIShutdownListener
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
nsMsgAccountManager();
|
|
||||||
virtual ~nsMsgAccountManager();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
/* nsIShutdownListener methods */
|
|
||||||
|
|
||||||
NS_IMETHOD OnShutdown(const nsCID& aClass, nsISupports *service);
|
|
||||||
|
|
||||||
/* nsIMsgAccountManager methods */
|
|
||||||
|
|
||||||
NS_DECL_NSIMSGACCOUNTMANAGER
|
|
||||||
|
|
||||||
//Add/remove an account to/from the Biff Manager if it has Biff turned on.
|
|
||||||
nsresult AddServerToBiff(nsIMsgIncomingServer *account);
|
|
||||||
nsresult RemoveServerFromBiff(nsIMsgIncomingServer *account);
|
|
||||||
private:
|
|
||||||
|
|
||||||
PRBool m_accountsLoaded;
|
|
||||||
PRBool m_alreadySetNntpDefaultLocalPath;
|
|
||||||
PRBool m_alreadySetImapDefaultLocalPath;
|
|
||||||
|
|
||||||
nsISupportsArray *m_accounts;
|
|
||||||
nsHashtable m_identities;
|
|
||||||
nsHashtable m_incomingServers;
|
|
||||||
nsCOMPtr<nsIMsgAccount> m_defaultAccount;
|
|
||||||
|
|
||||||
nsCAutoString accountKeyList;
|
|
||||||
|
|
||||||
/* internal creation routines - updates m_identities and m_incomingServers */
|
|
||||||
nsresult createKeyedAccount(const char* key,
|
|
||||||
nsIMsgAccount **_retval);
|
|
||||||
nsresult createKeyedServer(const char*key,
|
|
||||||
const char* type,
|
|
||||||
nsIMsgIncomingServer **_retval);
|
|
||||||
|
|
||||||
nsresult createKeyedIdentity(const char* key,
|
|
||||||
nsIMsgIdentity **_retval);
|
|
||||||
|
|
||||||
// hash table enumerators
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
static PRBool hashElementToArray(nsHashKey *aKey, void *aData,
|
|
||||||
void *closure);
|
|
||||||
|
|
||||||
// called by EnumerateRemove to release all elements
|
|
||||||
static PRBool hashElementRelease(nsHashKey *aKey, void *aData,
|
|
||||||
void *closure);
|
|
||||||
|
|
||||||
// remove all of the servers from the Biff Manager
|
|
||||||
static PRBool removeServerFromBiff(nsHashKey *aKey, void *aData,
|
|
||||||
void *closure);
|
|
||||||
|
|
||||||
//
|
|
||||||
// account enumerators
|
|
||||||
// ("element" is always an account)
|
|
||||||
//
|
|
||||||
|
|
||||||
// append the account keys to the given string
|
|
||||||
static PRBool getAccountList(nsISupports *aKey, void *aData);
|
|
||||||
|
|
||||||
// find the identities that correspond to the given server
|
|
||||||
static PRBool findIdentitiesForServer(nsISupports *element, void *aData);
|
|
||||||
|
|
||||||
// find the servers that correspond to the given identity
|
|
||||||
static PRBool findServersForIdentity (nsISupports *element, void *aData);
|
|
||||||
|
|
||||||
static PRBool findServerIndexByServer(nsISupports *element, void *aData);
|
|
||||||
// find the account with the given key
|
|
||||||
static PRBool findAccountByKey (nsISupports *element, void *aData);
|
|
||||||
|
|
||||||
static PRBool findAccountByServerKey (nsISupports *element, void *aData);
|
|
||||||
|
|
||||||
// load up the servers into the given nsISupportsArray
|
|
||||||
static PRBool getServersToArray(nsISupports *element, void *aData);
|
|
||||||
|
|
||||||
// load up the identities into the given nsISupportsArray
|
|
||||||
static PRBool getIdentitiesToArray(nsISupports *element, void *aData);
|
|
||||||
|
|
||||||
// add identities if they don't alreadby exist in the given nsISupportsArray
|
|
||||||
static PRBool addIdentityIfUnique(nsISupports *element, void *aData);
|
|
||||||
|
|
||||||
//
|
|
||||||
// server enumerators
|
|
||||||
// ("element" is always a server)
|
|
||||||
//
|
|
||||||
|
|
||||||
// find the server given by {username, hostname, type}
|
|
||||||
static PRBool findServer(nsISupports *aElement, void *data);
|
|
||||||
|
|
||||||
// write out the server's cache through the given folder cache
|
|
||||||
static PRBool writeFolderCache(nsHashKey *aKey, void *aData, void *closure);
|
|
||||||
static PRBool closeCachedConnections(nsHashKey *aKey, void *aData, void *closure);
|
|
||||||
|
|
||||||
// methods for migration / upgrading
|
|
||||||
nsresult MigrateIdentity(nsIMsgIdentity *identity);
|
|
||||||
nsresult MigrateSmtpServer(nsISmtpServer *server);
|
|
||||||
nsresult CopyIdentity(nsIMsgIdentity *srcIdentity, nsIMsgIdentity *destIdentity);
|
|
||||||
nsresult SetNewsCcAndFccValues(nsIMsgIdentity *identity);
|
|
||||||
nsresult SetMailCcAndFccValues(nsIMsgIdentity *identity);
|
|
||||||
|
|
||||||
nsresult MigrateImapAccounts(nsIMsgIdentity *identity);
|
|
||||||
nsresult MigrateImapAccount(nsIMsgIdentity *identity, const char *hostname);
|
|
||||||
|
|
||||||
nsresult MigrateOldImapPrefs(nsIMsgIncomingServer *server, const char *hostname);
|
|
||||||
|
|
||||||
nsresult MigratePopAccount(nsIMsgIdentity *identity);
|
|
||||||
|
|
||||||
nsresult CreateLocalMailAccount(nsIMsgIdentity *identity);
|
|
||||||
nsresult MigrateLocalMailAccount(nsIMsgIdentity *identity);
|
|
||||||
nsresult MigrateOldPopPrefs(nsIMsgIncomingServer *server, const char *hostname);
|
|
||||||
|
|
||||||
nsresult MigrateNewsAccounts(nsIMsgIdentity *identity);
|
|
||||||
nsresult MigrateNewsAccount(nsIMsgIdentity *identity, const char *hostname, nsFileSpec &newsrcfile, nsFileSpec &newsHostsDir);
|
|
||||||
nsresult MigrateOldNntpPrefs(nsIMsgIncomingServer *server, const char *hostname, nsFileSpec &newsrcfile);
|
|
||||||
|
|
||||||
nsresult ProceedWithMigration(PRInt32 oldMailType);
|
|
||||||
|
|
||||||
static char *getUniqueKey(const char* prefix, nsHashtable *hashTable);
|
|
||||||
static char *getUniqueAccountKey(const char* prefix,
|
|
||||||
nsISupportsArray *accounts);
|
|
||||||
|
|
||||||
nsresult Convert4XUri(const char *old_uri, const char *default_folder_name, char **new_uri);
|
|
||||||
|
|
||||||
nsresult getPrefService();
|
|
||||||
nsIPref *m_prefs;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsMsgAccountManager)
|
NS_IMPL_ADDREF(nsMsgAccountManager)
|
||||||
|
@ -2779,13 +2641,3 @@ nsMsgAccountManager::findServersForIdentity(nsISupports *element, void *aData)
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgAccountManager(const nsIID& iid, void **result)
|
|
||||||
{
|
|
||||||
nsMsgAccountManager* manager;
|
|
||||||
if (!result) return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
manager = new nsMsgAccountManager();
|
|
||||||
|
|
||||||
return manager->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
|
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsIMsgAccountManager.h"
|
#include "nsIMsgAccountManager.h"
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsHashtable.h"
|
||||||
|
#include "nsISmtpServer.h"
|
||||||
|
#include "nsIPref.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* some platforms (like Windows and Mac) use a map file, because of
|
* some platforms (like Windows and Mac) use a map file, because of
|
||||||
|
@ -47,10 +51,137 @@
|
||||||
|
|
||||||
#endif /* XP_UNIX || XP_BEOS */
|
#endif /* XP_UNIX || XP_BEOS */
|
||||||
|
|
||||||
|
class nsMsgAccountManager : public nsIMsgAccountManager,
|
||||||
|
public nsIShutdownListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
nsMsgAccountManager();
|
||||||
|
virtual ~nsMsgAccountManager();
|
||||||
|
|
||||||
nsresult
|
NS_DECL_ISUPPORTS
|
||||||
NS_NewMsgAccountManager(const nsIID& iid, void **result);
|
|
||||||
|
/* nsIShutdownListener methods */
|
||||||
|
|
||||||
|
NS_IMETHOD OnShutdown(const nsCID& aClass, nsISupports *service);
|
||||||
|
|
||||||
|
/* nsIMsgAccountManager methods */
|
||||||
|
|
||||||
|
NS_DECL_NSIMSGACCOUNTMANAGER
|
||||||
|
|
||||||
|
//Add/remove an account to/from the Biff Manager if it has Biff turned on.
|
||||||
|
nsresult AddServerToBiff(nsIMsgIncomingServer *account);
|
||||||
|
nsresult RemoveServerFromBiff(nsIMsgIncomingServer *account);
|
||||||
|
private:
|
||||||
|
|
||||||
|
PRBool m_accountsLoaded;
|
||||||
|
PRBool m_alreadySetNntpDefaultLocalPath;
|
||||||
|
PRBool m_alreadySetImapDefaultLocalPath;
|
||||||
|
|
||||||
|
nsISupportsArray *m_accounts;
|
||||||
|
nsHashtable m_identities;
|
||||||
|
nsHashtable m_incomingServers;
|
||||||
|
nsCOMPtr<nsIMsgAccount> m_defaultAccount;
|
||||||
|
|
||||||
|
nsCAutoString accountKeyList;
|
||||||
|
|
||||||
|
/* internal creation routines - updates m_identities and m_incomingServers */
|
||||||
|
nsresult createKeyedAccount(const char* key,
|
||||||
|
nsIMsgAccount **_retval);
|
||||||
|
nsresult createKeyedServer(const char*key,
|
||||||
|
const char* type,
|
||||||
|
nsIMsgIncomingServer **_retval);
|
||||||
|
|
||||||
|
nsresult createKeyedIdentity(const char* key,
|
||||||
|
nsIMsgIdentity **_retval);
|
||||||
|
|
||||||
|
// hash table enumerators
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
static PRBool hashElementToArray(nsHashKey *aKey, void *aData,
|
||||||
|
void *closure);
|
||||||
|
|
||||||
|
// called by EnumerateRemove to release all elements
|
||||||
|
static PRBool hashElementRelease(nsHashKey *aKey, void *aData,
|
||||||
|
void *closure);
|
||||||
|
|
||||||
|
// remove all of the servers from the Biff Manager
|
||||||
|
static PRBool removeServerFromBiff(nsHashKey *aKey, void *aData,
|
||||||
|
void *closure);
|
||||||
|
|
||||||
|
//
|
||||||
|
// account enumerators
|
||||||
|
// ("element" is always an account)
|
||||||
|
//
|
||||||
|
|
||||||
|
// append the account keys to the given string
|
||||||
|
static PRBool getAccountList(nsISupports *aKey, void *aData);
|
||||||
|
|
||||||
|
// find the identities that correspond to the given server
|
||||||
|
static PRBool findIdentitiesForServer(nsISupports *element, void *aData);
|
||||||
|
|
||||||
|
// find the servers that correspond to the given identity
|
||||||
|
static PRBool findServersForIdentity (nsISupports *element, void *aData);
|
||||||
|
|
||||||
|
static PRBool findServerIndexByServer(nsISupports *element, void *aData);
|
||||||
|
// find the account with the given key
|
||||||
|
static PRBool findAccountByKey (nsISupports *element, void *aData);
|
||||||
|
|
||||||
|
static PRBool findAccountByServerKey (nsISupports *element, void *aData);
|
||||||
|
|
||||||
|
// load up the servers into the given nsISupportsArray
|
||||||
|
static PRBool getServersToArray(nsISupports *element, void *aData);
|
||||||
|
|
||||||
|
// load up the identities into the given nsISupportsArray
|
||||||
|
static PRBool getIdentitiesToArray(nsISupports *element, void *aData);
|
||||||
|
|
||||||
|
// add identities if they don't alreadby exist in the given nsISupportsArray
|
||||||
|
static PRBool addIdentityIfUnique(nsISupports *element, void *aData);
|
||||||
|
|
||||||
|
//
|
||||||
|
// server enumerators
|
||||||
|
// ("element" is always a server)
|
||||||
|
//
|
||||||
|
|
||||||
|
// find the server given by {username, hostname, type}
|
||||||
|
static PRBool findServer(nsISupports *aElement, void *data);
|
||||||
|
|
||||||
|
// write out the server's cache through the given folder cache
|
||||||
|
static PRBool writeFolderCache(nsHashKey *aKey, void *aData, void *closure);
|
||||||
|
static PRBool closeCachedConnections(nsHashKey *aKey, void *aData, void *closure);
|
||||||
|
|
||||||
|
// methods for migration / upgrading
|
||||||
|
nsresult MigrateIdentity(nsIMsgIdentity *identity);
|
||||||
|
nsresult MigrateSmtpServer(nsISmtpServer *server);
|
||||||
|
nsresult CopyIdentity(nsIMsgIdentity *srcIdentity, nsIMsgIdentity *destIdentity);
|
||||||
|
nsresult SetNewsCcAndFccValues(nsIMsgIdentity *identity);
|
||||||
|
nsresult SetMailCcAndFccValues(nsIMsgIdentity *identity);
|
||||||
|
|
||||||
|
nsresult MigrateImapAccounts(nsIMsgIdentity *identity);
|
||||||
|
nsresult MigrateImapAccount(nsIMsgIdentity *identity, const char *hostname);
|
||||||
|
|
||||||
|
nsresult MigrateOldImapPrefs(nsIMsgIncomingServer *server, const char *hostname);
|
||||||
|
|
||||||
|
nsresult MigratePopAccount(nsIMsgIdentity *identity);
|
||||||
|
|
||||||
|
nsresult CreateLocalMailAccount(nsIMsgIdentity *identity);
|
||||||
|
nsresult MigrateLocalMailAccount(nsIMsgIdentity *identity);
|
||||||
|
nsresult MigrateOldPopPrefs(nsIMsgIncomingServer *server, const char *hostname);
|
||||||
|
|
||||||
|
nsresult MigrateNewsAccounts(nsIMsgIdentity *identity);
|
||||||
|
nsresult MigrateNewsAccount(nsIMsgIdentity *identity, const char *hostname, nsFileSpec &newsrcfile, nsFileSpec &newsHostsDir);
|
||||||
|
nsresult MigrateOldNntpPrefs(nsIMsgIncomingServer *server, const char *hostname, nsFileSpec &newsrcfile);
|
||||||
|
|
||||||
|
nsresult ProceedWithMigration(PRInt32 oldMailType);
|
||||||
|
|
||||||
|
static char *getUniqueKey(const char* prefix, nsHashtable *hashTable);
|
||||||
|
static char *getUniqueAccountKey(const char* prefix,
|
||||||
|
nsISupportsArray *accounts);
|
||||||
|
|
||||||
|
nsresult Convert4XUri(const char *old_uri, const char *default_folder_name, char **new_uri);
|
||||||
|
|
||||||
|
nsresult getPrefService();
|
||||||
|
nsIPref *m_prefs;
|
||||||
|
};
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
|
@ -21,9 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsMsgAccountManagerDS.h"
|
#include "nsMsgAccountManagerDS.h"
|
||||||
#include "nsMsgRDFDataSource.h"
|
|
||||||
|
|
||||||
#include "nsIMsgAccountManager.h"
|
|
||||||
|
|
||||||
#include "rdf.h"
|
#include "rdf.h"
|
||||||
#include "nsRDFCID.h"
|
#include "nsRDFCID.h"
|
||||||
|
@ -32,7 +30,6 @@
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIMsgMailSession.h"
|
#include "nsIMsgMailSession.h"
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
|
|
||||||
#include "nsMsgRDFUtils.h"
|
#include "nsMsgRDFUtils.h"
|
||||||
|
@ -54,63 +51,6 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||||
|
|
||||||
#define NC_RDF_ACCOUNTROOT "msgaccounts:/"
|
#define NC_RDF_ACCOUNTROOT "msgaccounts:/"
|
||||||
|
|
||||||
class nsMsgAccountManagerDataSource : public nsMsgRDFDataSource
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
nsMsgAccountManagerDataSource();
|
|
||||||
virtual ~nsMsgAccountManagerDataSource();
|
|
||||||
virtual nsresult Init();
|
|
||||||
|
|
||||||
// service manager shutdown method
|
|
||||||
|
|
||||||
// RDF datasource methods
|
|
||||||
|
|
||||||
/* nsIRDFNode GetTarget (in nsIRDFResource aSource, in nsIRDFResource property, in boolean aTruthValue); */
|
|
||||||
NS_IMETHOD GetTarget(nsIRDFResource *source,
|
|
||||||
nsIRDFResource *property,
|
|
||||||
PRBool aTruthValue,
|
|
||||||
nsIRDFNode **_retval);
|
|
||||||
|
|
||||||
/* nsISimpleEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource property, in boolean aTruthValue); */
|
|
||||||
NS_IMETHOD GetTargets(nsIRDFResource *source,
|
|
||||||
nsIRDFResource *property,
|
|
||||||
PRBool aTruthValue,
|
|
||||||
nsISimpleEnumerator **_retval);
|
|
||||||
/* nsISimpleEnumerator ArcLabelsOut (in nsIRDFResource aSource); */
|
|
||||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource *source, nsISimpleEnumerator **_retval);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
static nsIRDFResource* kNC_Name;
|
|
||||||
static nsIRDFResource* kNC_NameSort;
|
|
||||||
static nsIRDFResource* kNC_PageTag;
|
|
||||||
static nsIRDFResource* kNC_Child;
|
|
||||||
static nsIRDFResource* kNC_AccountRoot;
|
|
||||||
|
|
||||||
static nsIRDFResource* kNC_Account;
|
|
||||||
static nsIRDFResource* kNC_Server;
|
|
||||||
static nsIRDFResource* kNC_Identity;
|
|
||||||
static nsIRDFResource* kNC_Settings;
|
|
||||||
|
|
||||||
static nsIRDFResource* kNC_PageTitleMain;
|
|
||||||
static nsIRDFResource* kNC_PageTitleServer;
|
|
||||||
static nsIRDFResource* kNC_PageTitleCopies;
|
|
||||||
static nsIRDFResource* kNC_PageTitleAdvanced;
|
|
||||||
static nsIRDFResource* kNC_PageTitleSMTP;
|
|
||||||
|
|
||||||
static nsrefcnt gAccountManagerResourceRefCnt;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// enumeration function to convert each server (element)
|
|
||||||
// to an nsIRDFResource and append it to the array (in data)
|
|
||||||
static PRBool createServerResources(nsISupports *element, void *data);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgAccountManager> mAccountManager;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _serverCreationParams {
|
typedef struct _serverCreationParams {
|
||||||
nsISupportsArray *serverArray;
|
nsISupportsArray *serverArray;
|
||||||
nsIRDFService *rdfService;
|
nsIRDFService *rdfService;
|
||||||
|
@ -503,10 +443,4 @@ nsMsgAccountManagerDataSource::ArcLabelsOut(nsIRDFResource *source,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgAccountManagerDataSource(const nsIID& iid, void ** result)
|
|
||||||
{
|
|
||||||
nsMsgAccountManagerDataSource *amds = new nsMsgAccountManagerDataSource();
|
|
||||||
if (!amds) return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
return amds->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
|
@ -22,18 +22,72 @@
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
#include "nsIID.h"
|
#include "nsIID.h"
|
||||||
|
#include "nsMsgRDFDataSource.h"
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsIMsgAccountManager.h"
|
||||||
|
|
||||||
/* {3f989ca4-f77a-11d2-969d-006008948010} */
|
/* {3f989ca4-f77a-11d2-969d-006008948010} */
|
||||||
#define NS_MSGACCOUNTMANAGERDATASOURCE_CID \
|
#define NS_MSGACCOUNTMANAGERDATASOURCE_CID \
|
||||||
{0x3f989ca4, 0xf77a, 0x11d2, \
|
{0x3f989ca4, 0xf77a, 0x11d2, \
|
||||||
{0x96, 0x9d, 0x00, 0x60, 0x08, 0x94, 0x80, 0x10}}
|
{0x96, 0x9d, 0x00, 0x60, 0x08, 0x94, 0x80, 0x10}}
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
class nsMsgAccountManagerDataSource : public nsMsgRDFDataSource
|
||||||
|
{
|
||||||
|
|
||||||
nsresult
|
public:
|
||||||
NS_NewMsgAccountManagerDataSource(const nsIID& iid, void ** result);
|
|
||||||
|
nsMsgAccountManagerDataSource();
|
||||||
|
virtual ~nsMsgAccountManagerDataSource();
|
||||||
|
virtual nsresult Init();
|
||||||
|
|
||||||
|
// service manager shutdown method
|
||||||
|
|
||||||
|
// RDF datasource methods
|
||||||
|
|
||||||
|
/* nsIRDFNode GetTarget (in nsIRDFResource aSource, in nsIRDFResource property, in boolean aTruthValue); */
|
||||||
|
NS_IMETHOD GetTarget(nsIRDFResource *source,
|
||||||
|
nsIRDFResource *property,
|
||||||
|
PRBool aTruthValue,
|
||||||
|
nsIRDFNode **_retval);
|
||||||
|
|
||||||
|
/* nsISimpleEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource property, in boolean aTruthValue); */
|
||||||
|
NS_IMETHOD GetTargets(nsIRDFResource *source,
|
||||||
|
nsIRDFResource *property,
|
||||||
|
PRBool aTruthValue,
|
||||||
|
nsISimpleEnumerator **_retval);
|
||||||
|
/* nsISimpleEnumerator ArcLabelsOut (in nsIRDFResource aSource); */
|
||||||
|
NS_IMETHOD ArcLabelsOut(nsIRDFResource *source, nsISimpleEnumerator **_retval);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
static nsIRDFResource* kNC_Name;
|
||||||
|
static nsIRDFResource* kNC_NameSort;
|
||||||
|
static nsIRDFResource* kNC_PageTag;
|
||||||
|
static nsIRDFResource* kNC_Child;
|
||||||
|
static nsIRDFResource* kNC_AccountRoot;
|
||||||
|
|
||||||
|
static nsIRDFResource* kNC_Account;
|
||||||
|
static nsIRDFResource* kNC_Server;
|
||||||
|
static nsIRDFResource* kNC_Identity;
|
||||||
|
static nsIRDFResource* kNC_Settings;
|
||||||
|
|
||||||
|
static nsIRDFResource* kNC_PageTitleMain;
|
||||||
|
static nsIRDFResource* kNC_PageTitleServer;
|
||||||
|
static nsIRDFResource* kNC_PageTitleCopies;
|
||||||
|
static nsIRDFResource* kNC_PageTitleAdvanced;
|
||||||
|
static nsIRDFResource* kNC_PageTitleSMTP;
|
||||||
|
|
||||||
|
static nsrefcnt gAccountManagerResourceRefCnt;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// enumeration function to convert each server (element)
|
||||||
|
// to an nsIRDFResource and append it to the array (in data)
|
||||||
|
static PRBool createServerResources(nsISupports *element, void *data);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIMsgAccountManager> mAccountManager;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,18 +19,7 @@
|
||||||
#include "nsMsgBiffManager.h"
|
#include "nsMsgBiffManager.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgBiffManager(const nsIID& iid, void **result)
|
|
||||||
{
|
|
||||||
nsMsgBiffManager *biffManager = new nsMsgBiffManager();
|
|
||||||
if(!biffManager)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
return biffManager->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsMsgBiffManager)
|
NS_IMPL_ADDREF(nsMsgBiffManager)
|
||||||
NS_IMPL_RELEASE(nsMsgBiffManager)
|
NS_IMPL_RELEASE(nsMsgBiffManager)
|
||||||
|
|
|
@ -57,12 +57,7 @@ protected:
|
||||||
nsVoidArray *mBiffArray;
|
nsVoidArray *mBiffArray;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgBiffManager(const nsIID& iid, void **result);
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -17,98 +17,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsMsgCopyService.h"
|
#include "nsMsgCopyService.h"
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsMsgKeyArray.h"
|
#include "nsMsgKeyArray.h"
|
||||||
#include "nspr.h"
|
#include "nspr.h"
|
||||||
#include "nsIMessage.h"
|
|
||||||
#include "nsIMsgFolder.h"
|
|
||||||
|
|
||||||
typedef enum _nsCopyRequestType
|
|
||||||
{
|
|
||||||
nsCopyMessagesType = 0x0,
|
|
||||||
nsCopyFileMessageType = 0x1
|
|
||||||
} nsCopyRequestType;
|
|
||||||
|
|
||||||
class nsCopyRequest;
|
|
||||||
|
|
||||||
class nsCopySource
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsCopySource();
|
|
||||||
nsCopySource(nsIMsgFolder* srcFolder);
|
|
||||||
~nsCopySource();
|
|
||||||
void AddMessage(nsIMessage* aMsg);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgFolder> m_msgFolder;
|
|
||||||
nsCOMPtr<nsISupportsArray> m_messageArray;
|
|
||||||
PRBool m_processed;
|
|
||||||
};
|
|
||||||
|
|
||||||
class nsCopyRequest
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsCopyRequest();
|
|
||||||
~nsCopyRequest();
|
|
||||||
|
|
||||||
nsresult Init(nsCopyRequestType type, nsISupports* aSupport,
|
|
||||||
nsIMsgFolder* dstFolder,
|
|
||||||
PRBool bVal, nsIMsgCopyServiceListener* listener,
|
|
||||||
nsITransactionManager* txnMgr);
|
|
||||||
nsCopySource* AddNewCopySource(nsIMsgFolder* srcFolder);
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> m_srcSupport; // ui source folder or file spec
|
|
||||||
nsCOMPtr<nsIMsgFolder> m_dstFolder;
|
|
||||||
nsCOMPtr<nsITransactionManager> m_txnMgr;
|
|
||||||
nsCOMPtr<nsIMsgCopyServiceListener> m_listener;
|
|
||||||
nsCopyRequestType m_requestType;
|
|
||||||
PRBool m_isMoveOrDraftOrTemplate;
|
|
||||||
PRBool m_processed;
|
|
||||||
nsVoidArray m_copySourceArray; // array of nsCopySource
|
|
||||||
};
|
|
||||||
|
|
||||||
class nsMsgCopyService : public nsIMsgCopyService
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsMsgCopyService();
|
|
||||||
virtual ~nsMsgCopyService();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
// nsIMsgCopyService interface
|
|
||||||
NS_IMETHOD CopyMessages(nsIMsgFolder* srcFolder, /* UI src foler */
|
|
||||||
nsISupportsArray* messages,
|
|
||||||
nsIMsgFolder* dstFolder,
|
|
||||||
PRBool isMove,
|
|
||||||
nsIMsgCopyServiceListener* listener,
|
|
||||||
nsITransactionManager* txnMgr);
|
|
||||||
|
|
||||||
NS_IMETHOD CopyFileMessage(nsIFileSpec* fileSpec,
|
|
||||||
nsIMsgFolder* dstFolder,
|
|
||||||
nsIMessage* msgToReplace,
|
|
||||||
PRBool isDraftOrTemplate,
|
|
||||||
nsIMsgCopyServiceListener* listener,
|
|
||||||
nsITransactionManager* txnMgr);
|
|
||||||
|
|
||||||
NS_IMETHOD NotifyCompletion(nsISupports* aSupport, /* store src folder */
|
|
||||||
nsIMsgFolder* dstFolder,
|
|
||||||
nsresult result);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
nsresult ClearRequest(nsCopyRequest* aRequest, nsresult rv);
|
|
||||||
nsresult DoCopy(nsCopyRequest* aRequest);
|
|
||||||
nsresult DoNextCopy();
|
|
||||||
nsCopyRequest* FindRequest(nsISupports* aSupport, nsIMsgFolder* dstFolder);
|
|
||||||
|
|
||||||
nsVoidArray m_copyRequests;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ******************** nsCopySource ******************
|
// ******************** nsCopySource ******************
|
||||||
//
|
//
|
||||||
|
|
||||||
|
MOZ_DECL_CTOR_COUNTER(nsCopySource);
|
||||||
|
|
||||||
nsCopySource::nsCopySource() : m_processed(PR_FALSE)
|
nsCopySource::nsCopySource() : m_processed(PR_FALSE)
|
||||||
{
|
{
|
||||||
|
MOZ_COUNT_CTOR(nsCopySource);
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
rv = NS_NewISupportsArray(getter_AddRefs(m_messageArray));
|
rv = NS_NewISupportsArray(getter_AddRefs(m_messageArray));
|
||||||
}
|
}
|
||||||
|
@ -116,6 +39,7 @@ nsCopySource::nsCopySource() : m_processed(PR_FALSE)
|
||||||
nsCopySource::nsCopySource(nsIMsgFolder* srcFolder) :
|
nsCopySource::nsCopySource(nsIMsgFolder* srcFolder) :
|
||||||
m_processed(PR_FALSE)
|
m_processed(PR_FALSE)
|
||||||
{
|
{
|
||||||
|
MOZ_COUNT_CTOR(nsCopySource);
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
rv = NS_NewISupportsArray(getter_AddRefs(m_messageArray));
|
rv = NS_NewISupportsArray(getter_AddRefs(m_messageArray));
|
||||||
m_msgFolder = do_QueryInterface(srcFolder, &rv);
|
m_msgFolder = do_QueryInterface(srcFolder, &rv);
|
||||||
|
@ -123,6 +47,7 @@ nsCopySource::nsCopySource(nsIMsgFolder* srcFolder) :
|
||||||
|
|
||||||
nsCopySource::~nsCopySource()
|
nsCopySource::~nsCopySource()
|
||||||
{
|
{
|
||||||
|
MOZ_COUNT_DTOR(nsCopySource);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsCopySource::AddMessage(nsIMessage* aMsg)
|
void nsCopySource::AddMessage(nsIMessage* aMsg)
|
||||||
|
@ -134,16 +59,22 @@ void nsCopySource::AddMessage(nsIMessage* aMsg)
|
||||||
|
|
||||||
// ************ nsCopyRequest *****************
|
// ************ nsCopyRequest *****************
|
||||||
//
|
//
|
||||||
|
|
||||||
|
MOZ_DECL_CTOR_COUNTER(nsCopyRequest);
|
||||||
|
|
||||||
nsCopyRequest::nsCopyRequest() :
|
nsCopyRequest::nsCopyRequest() :
|
||||||
m_requestType(nsCopyMessagesType),
|
m_requestType(nsCopyMessagesType),
|
||||||
m_isMoveOrDraftOrTemplate(PR_FALSE),
|
m_isMoveOrDraftOrTemplate(PR_FALSE),
|
||||||
m_processed(PR_FALSE)
|
m_processed(PR_FALSE)
|
||||||
{
|
{
|
||||||
|
MOZ_COUNT_CTOR(nsCopyRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCopyRequest::~nsCopyRequest()
|
nsCopyRequest::~nsCopyRequest()
|
||||||
{
|
{
|
||||||
PRInt32 j;
|
MOZ_COUNT_DTOR(nsCopyRequest);
|
||||||
|
|
||||||
|
PRInt32 j;
|
||||||
nsCopySource* ncs;
|
nsCopySource* ncs;
|
||||||
|
|
||||||
j = m_copySourceArray.Count();
|
j = m_copySourceArray.Count();
|
||||||
|
@ -187,6 +118,7 @@ nsCopyRequest::AddNewCopySource(nsIMsgFolder* srcFolder)
|
||||||
// ************* nsMsgCopyService ****************
|
// ************* nsMsgCopyService ****************
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
nsMsgCopyService::nsMsgCopyService()
|
nsMsgCopyService::nsMsgCopyService()
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
@ -194,6 +126,7 @@ nsMsgCopyService::nsMsgCopyService()
|
||||||
|
|
||||||
nsMsgCopyService::~nsMsgCopyService()
|
nsMsgCopyService::~nsMsgCopyService()
|
||||||
{
|
{
|
||||||
|
|
||||||
PRInt32 i;
|
PRInt32 i;
|
||||||
nsCopyRequest* copyRequest;
|
nsCopyRequest* copyRequest;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,91 @@
|
||||||
|
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsIMsgCopyService.h"
|
#include "nsIMsgCopyService.h"
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsIMsgFolder.h"
|
||||||
|
#include "nsIMessage.h"
|
||||||
|
|
||||||
|
typedef enum _nsCopyRequestType
|
||||||
|
{
|
||||||
|
nsCopyMessagesType = 0x0,
|
||||||
|
nsCopyFileMessageType = 0x1
|
||||||
|
} nsCopyRequestType;
|
||||||
|
|
||||||
|
class nsCopyRequest;
|
||||||
|
|
||||||
|
class nsCopySource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nsCopySource();
|
||||||
|
nsCopySource(nsIMsgFolder* srcFolder);
|
||||||
|
~nsCopySource();
|
||||||
|
void AddMessage(nsIMessage* aMsg);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIMsgFolder> m_msgFolder;
|
||||||
|
nsCOMPtr<nsISupportsArray> m_messageArray;
|
||||||
|
PRBool m_processed;
|
||||||
|
};
|
||||||
|
|
||||||
|
class nsCopyRequest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nsCopyRequest();
|
||||||
|
~nsCopyRequest();
|
||||||
|
|
||||||
|
nsresult Init(nsCopyRequestType type, nsISupports* aSupport,
|
||||||
|
nsIMsgFolder* dstFolder,
|
||||||
|
PRBool bVal, nsIMsgCopyServiceListener* listener,
|
||||||
|
nsITransactionManager* txnMgr);
|
||||||
|
nsCopySource* AddNewCopySource(nsIMsgFolder* srcFolder);
|
||||||
|
|
||||||
|
nsCOMPtr<nsISupports> m_srcSupport; // ui source folder or file spec
|
||||||
|
nsCOMPtr<nsIMsgFolder> m_dstFolder;
|
||||||
|
nsCOMPtr<nsITransactionManager> m_txnMgr;
|
||||||
|
nsCOMPtr<nsIMsgCopyServiceListener> m_listener;
|
||||||
|
nsCopyRequestType m_requestType;
|
||||||
|
PRBool m_isMoveOrDraftOrTemplate;
|
||||||
|
PRBool m_processed;
|
||||||
|
nsVoidArray m_copySourceArray; // array of nsCopySource
|
||||||
|
};
|
||||||
|
|
||||||
|
class nsMsgCopyService : public nsIMsgCopyService
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nsMsgCopyService();
|
||||||
|
virtual ~nsMsgCopyService();
|
||||||
|
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
// nsIMsgCopyService interface
|
||||||
|
NS_IMETHOD CopyMessages(nsIMsgFolder* srcFolder, /* UI src foler */
|
||||||
|
nsISupportsArray* messages,
|
||||||
|
nsIMsgFolder* dstFolder,
|
||||||
|
PRBool isMove,
|
||||||
|
nsIMsgCopyServiceListener* listener,
|
||||||
|
nsITransactionManager* txnMgr);
|
||||||
|
|
||||||
|
NS_IMETHOD CopyFileMessage(nsIFileSpec* fileSpec,
|
||||||
|
nsIMsgFolder* dstFolder,
|
||||||
|
nsIMessage* msgToReplace,
|
||||||
|
PRBool isDraftOrTemplate,
|
||||||
|
nsIMsgCopyServiceListener* listener,
|
||||||
|
nsITransactionManager* txnMgr);
|
||||||
|
|
||||||
|
NS_IMETHOD NotifyCompletion(nsISupports* aSupport, /* store src folder */
|
||||||
|
nsIMsgFolder* dstFolder,
|
||||||
|
nsresult result);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
nsresult ClearRequest(nsCopyRequest* aRequest, nsresult rv);
|
||||||
|
nsresult DoCopy(nsCopyRequest* aRequest);
|
||||||
|
nsresult DoNextCopy();
|
||||||
|
nsCopyRequest* FindRequest(nsISupports* aSupport, nsIMsgFolder* dstFolder);
|
||||||
|
|
||||||
|
nsVoidArray m_copyRequests;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
NS_BEGIN_EXTERN_C
|
||||||
|
|
||||||
|
|
|
@ -1267,23 +1267,4 @@ nsresult nsMsgFolderDataSource::GetFolderSortOrder(nsIMsgFolder *folder, PRInt32
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgFolderDataSource(const nsIID& iid, void **result)
|
|
||||||
{
|
|
||||||
NS_PRECONDITION(result != nsnull, "null ptr");
|
|
||||||
if (! result)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
nsMsgFolderDataSource* datasource = new nsMsgFolderDataSource();
|
|
||||||
if (! datasource)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
nsresult rv;
|
|
||||||
rv = datasource->Init();
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
delete datasource;
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
return datasource->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
|
@ -182,5 +182,4 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PR_EXTERN(nsresult)
|
|
||||||
NS_NewMsgFolderDataSource(const nsIID& iid, void **result);
|
|
||||||
|
|
|
@ -297,20 +297,5 @@ NS_IMETHODIMP nsMsgMailSession::NotifyFolderLoaded(nsIFolder *folder)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgMailSession(const nsIID& iid, void **result)
|
|
||||||
{
|
|
||||||
if (!result) return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
nsMsgMailSession *mailSession = new nsMsgMailSession;
|
|
||||||
if (!mailSession) return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
nsresult rv = mailSession->Init();
|
|
||||||
if(NS_FAILED(rv))
|
|
||||||
{
|
|
||||||
delete mailSession;
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
return mailSession->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -57,11 +57,5 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgMailSession(const nsIID& iid, void **result);
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
#endif /* nsMsgMailSession_h__ */
|
#endif /* nsMsgMailSession_h__ */
|
||||||
|
|
|
@ -1182,25 +1182,6 @@ nsresult nsMsgMessageDataSource::GetMessagesAndFirstFolder(nsISupportsArray *mes
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgMessageDataSource(const nsIID& iid, void **result)
|
|
||||||
{
|
|
||||||
NS_PRECONDITION(result != nsnull, "null ptr");
|
|
||||||
if (! result)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
nsMsgMessageDataSource* datasource = new nsMsgMessageDataSource();
|
|
||||||
if (! datasource)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
nsresult rv;
|
|
||||||
rv = datasource->Init();
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
delete datasource;
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
return datasource->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -204,5 +204,4 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PR_EXTERN(nsresult)
|
|
||||||
NS_NewMsgMessageDataSource(const nsIID& iid, void **result);
|
|
||||||
|
|
|
@ -53,24 +53,7 @@ nsIRDFResource* nsMsgNotificationManager::kNC_NewMessages = nsnull;
|
||||||
|
|
||||||
#define NC_RDF_NEWMESSAGES "http://home.netscape.com/NC-rdf#MsgNewMessages"
|
#define NC_RDF_NEWMESSAGES "http://home.netscape.com/NC-rdf#MsgNewMessages"
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgNotificationManager(const nsIID& iid, void **result)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
nsMsgNotificationManager *notificationManager = new nsMsgNotificationManager();
|
|
||||||
if(!notificationManager)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
rv = notificationManager->Init();
|
|
||||||
|
|
||||||
if(!NS_SUCCEEDED(rv))
|
|
||||||
return rv;
|
|
||||||
return notificationManager->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
nsMsgNotificationManager::nsMsgNotificationManager()
|
nsMsgNotificationManager::nsMsgNotificationManager()
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,11 +57,6 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgNotificationManager(const nsIID& iid, void **result);
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,18 +25,7 @@
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMXULDocument.h"
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgStatusFeedback(const nsIID& iid, void **result)
|
|
||||||
{
|
|
||||||
nsMsgStatusFeedback *statusFeedback = new nsMsgStatusFeedback();
|
|
||||||
if(!statusFeedback)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
return statusFeedback->QueryInterface(iid, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
nsMsgStatusFeedback::nsMsgStatusFeedback()
|
nsMsgStatusFeedback::nsMsgStatusFeedback()
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,12 +57,7 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewMsgStatusFeedback(const nsIID& iid, void **result);
|
|
||||||
|
|
||||||
NS_END_EXTERN_C
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _nsMsgStatusFeedback_h
|
#endif // _nsMsgStatusFeedback_h
|
||||||
|
|
Загрузка…
Ссылка в новой задаче