зеркало из https://github.com/mozilla/gecko-dev.git
convert base to be a generic factory, and add temporary ProgIDs for the filter delegate factory
This commit is contained in:
Родитель
24121e07d1
Коммит
ac757e0b9b
|
@ -297,7 +297,7 @@
|
||||||
#define NS_MSG_PRINTENGINE_CID \
|
#define NS_MSG_PRINTENGINE_CID \
|
||||||
{ /* 91FD6B19-E0BC-11d3-8F97-000064657374 */ \
|
{ /* 91FD6B19-E0BC-11d3-8F97-000064657374 */ \
|
||||||
0x91fd6b19, 0xe0bc, 0x11d3, \
|
0x91fd6b19, 0xe0bc, 0x11d3, \
|
||||||
{ 0x8f, 0x97, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } };
|
{ 0x8f, 0x97, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
|
||||||
|
|
||||||
//
|
//
|
||||||
// nsMsgServiceProviderService
|
// nsMsgServiceProviderService
|
||||||
|
@ -354,4 +354,15 @@
|
||||||
NS_MSGFILTERDELEGATEFACTORY_PROGID_PREFIX "imap"
|
NS_MSGFILTERDELEGATEFACTORY_PROGID_PREFIX "imap"
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// nsMsgFilterDataSource
|
||||||
|
//
|
||||||
|
#define NS_MSGFILTERDATASOURCE_PROGID \
|
||||||
|
NS_RDF_DATASOURCE_PROGID_PREFIX "msgfilters"
|
||||||
|
|
||||||
|
/* d97edfb5-bcbe-4a15-a4fb-fbf2f958b388 */
|
||||||
|
#define NS_MSGFILTERDATASOURCE_CID \
|
||||||
|
{0xd97edfb5, 0xbcbe, 0x4a15, \
|
||||||
|
{ 0xa4, 0xfb, 0xfb, 0xf2, 0xf9, 0x58, 0xb3, 0x88 }}
|
||||||
|
|
||||||
#endif // nsMessageBaseCID_h__
|
#endif // nsMessageBaseCID_h__
|
||||||
|
|
|
@ -68,6 +68,8 @@
|
||||||
#include "nsMsgStatusFeedback.h"
|
#include "nsMsgStatusFeedback.h"
|
||||||
|
|
||||||
#include "nsMsgFilterService.h"
|
#include "nsMsgFilterService.h"
|
||||||
|
#include "nsMsgFilterDataSource.h"
|
||||||
|
#include "nsMsgFilterDelegateFactory.h"
|
||||||
#include "nsMessageView.h"
|
#include "nsMessageView.h"
|
||||||
#include "nsMsgWindow.h"
|
#include "nsMsgWindow.h"
|
||||||
#include "nsMsgViewNavigationService.h"
|
#include "nsMsgViewNavigationService.h"
|
||||||
|
@ -77,69 +79,6 @@
|
||||||
|
|
||||||
#include "nsMsgPrintEngine.h"
|
#include "nsMsgPrintEngine.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCUrlListenerManagerCID, NS_URLLISTENERMANAGER_CID);
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCMessengerBootstrapCID, NS_MESSENGERBOOTSTRAP_CID);
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCMsgFolderEventCID, NS_MSGFOLDEREVENT_CID);
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCMessengerCID, NS_MESSENGER_CID);
|
|
||||||
static NS_DEFINE_CID(kCMsgGroupRecordCID, NS_MSGGROUPRECORD_CID);
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kMailNewsFolderDataSourceCID, NS_MAILNEWSFOLDERDATASOURCE_CID);
|
|
||||||
static NS_DEFINE_CID(kMailNewsMessageDataSourceCID, NS_MAILNEWSMESSAGEDATASOURCE_CID);
|
|
||||||
|
|
||||||
// account manager stuff
|
|
||||||
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
|
|
||||||
static NS_DEFINE_CID(kMsgAccountCID, NS_MSGACCOUNT_CID);
|
|
||||||
static NS_DEFINE_CID(kMsgIdentityCID, NS_MSGIDENTITY_CID);
|
|
||||||
static NS_DEFINE_CID(kMsgIncomingServerCID, NS_MSGINCOMINGSERVER_CID);
|
|
||||||
|
|
||||||
// account manager RDF stuff
|
|
||||||
static NS_DEFINE_CID(kMsgAccountManagerDataSourceCID, NS_MSGACCOUNTMANAGERDATASOURCE_CID);
|
|
||||||
|
|
||||||
// migrator stuff
|
|
||||||
static NS_DEFINE_CID(kMessengerMigratorCID, NS_MESSENGERMIGRATOR_CID);
|
|
||||||
// search and filter stuff
|
|
||||||
static NS_DEFINE_CID(kMsgSearchSessionCID, NS_MSGSEARCHSESSION_CID);
|
|
||||||
static NS_DEFINE_CID(kMsgFilterServiceCID, NS_MSGFILTERSERVICE_CID);
|
|
||||||
|
|
||||||
// Biff and notifications
|
|
||||||
static NS_DEFINE_CID(kMsgBiffManagerCID, NS_MSGBIFFMANAGER_CID);
|
|
||||||
static NS_DEFINE_CID(kMsgNotificationManagerCID, NS_MSGNOTIFICATIONMANAGER_CID);
|
|
||||||
|
|
||||||
// Copy
|
|
||||||
static NS_DEFINE_CID(kCopyMessageStreamListenerCID,
|
|
||||||
NS_COPYMESSAGESTREAMLISTENER_CID);
|
|
||||||
static NS_DEFINE_CID(kMsgCopyServiceCID, NS_MSGCOPYSERVICE_CID);
|
|
||||||
|
|
||||||
// Msg Folder Cache stuff
|
|
||||||
static NS_DEFINE_CID(kMsgFolderCacheCID, NS_MSGFOLDERCACHE_CID);
|
|
||||||
|
|
||||||
//Feedback stuff
|
|
||||||
static NS_DEFINE_CID(kMsgStatusFeedbackCID, NS_MSGSTATUSFEEDBACK_CID);
|
|
||||||
|
|
||||||
//MessageView
|
|
||||||
static NS_DEFINE_CID(kMessageViewCID, NS_MESSAGEVIEW_CID);
|
|
||||||
|
|
||||||
//MsgWindow
|
|
||||||
static NS_DEFINE_CID(kMsgWindowCID, NS_MSGWINDOW_CID);
|
|
||||||
|
|
||||||
//MsgViewNavigationService
|
|
||||||
static NS_DEFINE_CID(kMsgViewNavigationServiceCID, NS_MSGVIEWNAVIGATIONSERVICE_CID);
|
|
||||||
|
|
||||||
//MsgServiceProviderService
|
|
||||||
static NS_DEFINE_CID(kMsgServiceProviderServiceCID, NS_MSGSERVICEPROVIDERSERVICE_CID);
|
|
||||||
|
|
||||||
//SubscribeDataSource
|
|
||||||
static NS_DEFINE_CID(kSubscribeDataSourceCID, NS_SUBSCRIBEDATASOURCE_CID);
|
|
||||||
|
|
||||||
// Print Engine
|
|
||||||
static NS_DEFINE_CID(kMsgPrintEngineCID, NS_MSG_PRINTENGINE_CID);
|
|
||||||
|
|
||||||
// private factory declarations for each component we know how to produce
|
// private factory declarations for each component we know how to produce
|
||||||
|
|
||||||
|
@ -155,6 +94,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgFolderDataSource, Init)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgMessageDataSource, Init)
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgMessageDataSource, Init)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgAccountManagerDataSource)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgAccountManagerDataSource)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgFilterService)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgFilterService)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgFilterDataSource)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgFilterDelegateFactory)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgBiffManager, Init)
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgBiffManager, Init)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgNotificationManager, Init)
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgNotificationManager, Init)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCopyMessageStreamListener)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCopyMessageStreamListener)
|
||||||
|
@ -167,452 +108,131 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgViewNavigationService,Init)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgServiceProviderService, Init);
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgServiceProviderService, Init);
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSubscribeDataSource, Init);
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSubscribeDataSource, Init);
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgPrintEngine, Init)
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgPrintEngine, Init)
|
||||||
// Module implementation for the sample library
|
|
||||||
class nsMsgBaseModule : public nsIModule
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsMsgBaseModule();
|
|
||||||
virtual ~nsMsgBaseModule();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
NS_DECL_NSIMODULE
|
|
||||||
|
|
||||||
protected:
|
|
||||||
nsresult Initialize();
|
|
||||||
|
|
||||||
void Shutdown();
|
|
||||||
|
|
||||||
PRBool mInitialized;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIGenericFactory> mMessengerBootstrapFactory;
|
|
||||||
nsCOMPtr<nsIGenericFactory> mUrlListenerManagerFactory;
|
|
||||||
nsCOMPtr<nsIGenericFactory> mMsgMailSessionFactory;
|
|
||||||
nsCOMPtr<nsIGenericFactory> mMessengerFactory;
|
|
||||||
nsCOMPtr<nsIGenericFactory> mMsgAccountManagerFactory;
|
|
||||||
nsCOMPtr<nsIGenericFactory> mMessengerMigratorFactory;
|
|
||||||
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;
|
|
||||||
nsCOMPtr<nsIGenericFactory> mMsgWindowFactory;
|
|
||||||
nsCOMPtr<nsIGenericFactory> mMsgViewNavigationServiceFactory;
|
|
||||||
nsCOMPtr<nsIGenericFactory> mMsgServiceProviderServiceFactory;
|
|
||||||
nsCOMPtr<nsIGenericFactory> mSubscribeDataSourceFactory;
|
|
||||||
nsCOMPtr<nsIGenericFactory> mMsgPrintEngineFactory;
|
|
||||||
};
|
|
||||||
|
|
||||||
nsMsgBaseModule::nsMsgBaseModule()
|
|
||||||
: mInitialized(PR_FALSE)
|
|
||||||
{
|
|
||||||
NS_INIT_ISUPPORTS();
|
|
||||||
}
|
|
||||||
|
|
||||||
nsMsgBaseModule::~nsMsgBaseModule()
|
|
||||||
{
|
|
||||||
Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsMsgBaseModule, NS_GET_IID(nsIModule))
|
|
||||||
|
|
||||||
// Perform our one-time intialization for this module
|
|
||||||
nsresult nsMsgBaseModule::Initialize()
|
|
||||||
{
|
|
||||||
if (mInitialized)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
mInitialized = PR_TRUE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shutdown this module, releasing all of the module resources
|
|
||||||
void nsMsgBaseModule::Shutdown()
|
|
||||||
{
|
|
||||||
// Release the factory object
|
|
||||||
mMessengerBootstrapFactory = null_nsCOMPtr();
|
|
||||||
mUrlListenerManagerFactory = null_nsCOMPtr();
|
|
||||||
mMsgMailSessionFactory = null_nsCOMPtr();
|
|
||||||
mMessengerFactory = null_nsCOMPtr();
|
|
||||||
mMsgAccountManagerFactory = null_nsCOMPtr();
|
|
||||||
mMessengerMigratorFactory = 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();
|
|
||||||
mMsgWindowFactory = null_nsCOMPtr();
|
|
||||||
mMsgViewNavigationServiceFactory = null_nsCOMPtr();
|
|
||||||
mMsgServiceProviderServiceFactory = null_nsCOMPtr();
|
|
||||||
mSubscribeDataSourceFactory = null_nsCOMPtr();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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=NS_OK;
|
|
||||||
|
|
||||||
// Defensive programming: Initialize *r_classObj in case of error below
|
|
||||||
if (!r_classObj)
|
|
||||||
return NS_ERROR_INVALID_POINTER;
|
|
||||||
|
|
||||||
*r_classObj = NULL;
|
|
||||||
|
|
||||||
// Do one-time-only initialization if necessary
|
|
||||||
if (!mInitialized)
|
|
||||||
{
|
|
||||||
rv = Initialize();
|
|
||||||
if (NS_FAILED(rv)) // Initialization failed! yikes!
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
// Choose the appropriate factory, based on the desired instance
|
|
||||||
// class type (aClass).
|
|
||||||
nsCOMPtr<nsIGenericFactory> fact;
|
|
||||||
|
|
||||||
if (aClass.Equals(kCMessengerBootstrapCID))
|
|
||||||
{
|
|
||||||
if (!mMessengerBootstrapFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMessengerBootstrapFactory), &nsMessengerBootstrapConstructor);
|
|
||||||
fact = mMessengerBootstrapFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kCUrlListenerManagerCID))
|
|
||||||
{
|
|
||||||
if (!mUrlListenerManagerFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mUrlListenerManagerFactory), &nsUrlListenerManagerConstructor);
|
|
||||||
fact = mUrlListenerManagerFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kCMsgMailSessionCID))
|
|
||||||
{
|
|
||||||
if (!mMsgMailSessionFactory)
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (aClass.Equals(kMsgAccountManagerCID))
|
|
||||||
{
|
|
||||||
if (!mMsgAccountManagerFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgAccountManagerFactory), &nsMsgAccountManagerConstructor);
|
|
||||||
fact = mMsgAccountManagerFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kMessengerMigratorCID))
|
|
||||||
{
|
|
||||||
if (!mMessengerMigratorFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMessengerMigratorFactory), &nsMessengerMigratorConstructor);
|
|
||||||
fact = mMessengerMigratorFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kMsgAccountCID))
|
|
||||||
{
|
|
||||||
if (!mMsgAccountFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgAccountFactory), &nsMsgAccountConstructor);
|
|
||||||
fact = mMsgAccountFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kMsgIdentityCID))
|
|
||||||
{
|
|
||||||
if (!mMsgIdentityFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgIdentityFactory), &nsMsgIdentityConstructor);
|
|
||||||
fact = mMsgIdentityFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kMailNewsFolderDataSourceCID))
|
|
||||||
{
|
|
||||||
if (!mMsgFolderDataSourceFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgFolderDataSourceFactory), &nsMsgFolderDataSourceConstructor);
|
|
||||||
fact = mMsgFolderDataSourceFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kMailNewsMessageDataSourceCID))
|
|
||||||
{
|
|
||||||
if (!mMsgMessageDataSourceFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgMessageDataSourceFactory), &nsMsgMessageDataSourceConstructor);
|
|
||||||
fact = mMsgMessageDataSourceFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kMsgAccountManagerDataSourceCID))
|
|
||||||
{
|
|
||||||
if (!mMsgAccountManagerDataSourceFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgAccountManagerDataSourceFactory), &nsMsgAccountManagerDataSourceConstructor);
|
|
||||||
fact = mMsgAccountManagerDataSourceFactory;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kMsgWindowCID))
|
|
||||||
{
|
|
||||||
if (!mMsgWindowFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgWindowFactory), &nsMsgWindowConstructor);
|
|
||||||
fact = mMsgWindowFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kMsgViewNavigationServiceCID))
|
|
||||||
{
|
|
||||||
if (!mMsgViewNavigationServiceFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgViewNavigationServiceFactory), &nsMsgViewNavigationServiceConstructor);
|
|
||||||
fact = mMsgViewNavigationServiceFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (aClass.Equals(kMsgServiceProviderServiceCID))
|
|
||||||
{
|
|
||||||
if (!mMsgServiceProviderServiceFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgServiceProviderServiceFactory), &nsMsgServiceProviderServiceConstructor);
|
|
||||||
fact = mMsgServiceProviderServiceFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kSubscribeDataSourceCID))
|
|
||||||
{
|
|
||||||
if (!mSubscribeDataSourceFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mSubscribeDataSourceFactory), &nsSubscribeDataSourceConstructor);
|
|
||||||
fact = mSubscribeDataSourceFactory;
|
|
||||||
}
|
|
||||||
else if (aClass.Equals(kMsgPrintEngineCID))
|
|
||||||
{
|
|
||||||
if (!mMsgPrintEngineFactory)
|
|
||||||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgPrintEngineFactory), &nsMsgPrintEngineConstructor);
|
|
||||||
fact = mMsgPrintEngineFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (fact)
|
|
||||||
rv = fact->QueryInterface(aIID, r_classObj);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Components {
|
|
||||||
const char* mDescription;
|
|
||||||
const nsID* mCID;
|
|
||||||
const char* mProgID;
|
|
||||||
NSRegisterSelfProcPtr mRegisterSelfProc;
|
|
||||||
NSUnregisterSelfProcPtr mUnregisterSelfProc;
|
|
||||||
};
|
|
||||||
|
|
||||||
// The list of components we register
|
// The list of components we register
|
||||||
static Components gComponents[] = {
|
static nsModuleComponentInfo gComponents[] = {
|
||||||
{ "Netscape Messenger Bootstrapper", &kCMessengerBootstrapCID,
|
{ "Netscape Messenger Bootstrapper", NS_MESSENGERBOOTSTRAP_CID,
|
||||||
NS_MESSENGERBOOTSTRAP_PROGID },
|
NS_MESSENGERBOOTSTRAP_PROGID,
|
||||||
{ "Mail Startup Handler", &kCMessengerBootstrapCID,
|
nsMessengerBootstrapConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail Startup Handler", NS_MESSENGERBOOTSTRAP_CID,
|
||||||
NS_MAILSTARTUPHANDLER_PROGID,
|
NS_MAILSTARTUPHANDLER_PROGID,
|
||||||
|
nsMessengerBootstrapConstructor,
|
||||||
nsMessengerBootstrap::RegisterProc,
|
nsMessengerBootstrap::RegisterProc,
|
||||||
nsMessengerBootstrap::UnregisterProc },
|
nsMessengerBootstrap::UnregisterProc
|
||||||
{ "UrlListenerManager", &kCUrlListenerManagerCID,
|
},
|
||||||
NS_URLLISTENERMANAGER_PROGID },
|
{ "UrlListenerManager", NS_URLLISTENERMANAGER_CID,
|
||||||
{ "Mail Session", &kCMsgMailSessionCID,
|
NS_URLLISTENERMANAGER_PROGID,
|
||||||
NS_MSGMAILSESSION_PROGID },
|
nsUrlListenerManagerConstructor,
|
||||||
{ "Messenger DOM interaction object", &kCMessengerCID,
|
},
|
||||||
NS_MESSENGER_PROGID },
|
{ "Mail Session", NS_MSGMAILSESSION_CID,
|
||||||
{ "Messenger Account Manager", &kMsgAccountManagerCID,
|
NS_MSGMAILSESSION_PROGID,
|
||||||
NS_MSGACCOUNTMANAGER_PROGID },
|
nsMsgMailSessionConstructor,
|
||||||
{ "Messenger Migrator", &kMessengerMigratorCID,
|
},
|
||||||
NS_MESSENGERMIGRATOR_PROGID },
|
{ "Messenger DOM interaction object", NS_MESSENGER_CID,
|
||||||
{ "Messenger User Account", &kMsgAccountCID,
|
NS_MESSENGER_PROGID,
|
||||||
NS_MSGACCOUNT_PROGID },
|
nsMessengerConstructor,
|
||||||
{ "Messenger User Identity", &kMsgIdentityCID,
|
},
|
||||||
NS_MSGIDENTITY_PROGID },
|
{ "Messenger Account Manager", NS_MSGACCOUNTMANAGER_CID,
|
||||||
{ "Mail/News Folder Data Source", &kMailNewsFolderDataSourceCID,
|
NS_MSGACCOUNTMANAGER_PROGID,
|
||||||
NS_MAILNEWSFOLDERDATASOURCE_PROGID },
|
nsMsgAccountManagerConstructor,
|
||||||
{ "Mail/News Message Data Source", &kMailNewsMessageDataSourceCID,
|
},
|
||||||
NS_MAILNEWSMESSAGEDATASOURCE_PROGID},
|
{ "Messenger Migrator", NS_MESSENGERMIGRATOR_CID,
|
||||||
{ "Mail/News Account Manager Data Source", &kMsgAccountManagerDataSourceCID,
|
NS_MESSENGERMIGRATOR_PROGID,
|
||||||
NS_RDF_DATASOURCE_PROGID_PREFIX "msgaccountmanager"},
|
nsMessengerMigratorConstructor,
|
||||||
{ "Message Filter Service", &kMsgFilterServiceCID,
|
},
|
||||||
NS_MSGFILTERSERVICE_PROGID},
|
{ "Messenger User Account", NS_MSGACCOUNT_CID,
|
||||||
{ "Messenger Biff Manager", &kMsgBiffManagerCID,
|
NS_MSGACCOUNT_PROGID,
|
||||||
NS_MSGBIFFMANAGER_PROGID},
|
nsMsgAccountConstructor,
|
||||||
{ "Mail/News Notification Manager", &kMsgNotificationManagerCID,
|
},
|
||||||
NS_MSGNOTIFICATIONMANAGER_PROGID},
|
{ "Messenger User Identity", NS_MSGIDENTITY_CID,
|
||||||
{ "Mail/News CopyMessage Stream Listener", &kCopyMessageStreamListenerCID,
|
NS_MSGIDENTITY_PROGID,
|
||||||
NS_COPYMESSAGESTREAMLISTENER_PROGID},
|
nsMsgIdentityConstructor,
|
||||||
{ "Mail/News Message Copy Service", &kMsgCopyServiceCID,
|
},
|
||||||
NS_MSGCOPYSERVICE_PROGID},
|
{ "Mail/News Folder Data Source", NS_MAILNEWSFOLDERDATASOURCE_CID,
|
||||||
{ "Mail/News Folder Cache", &kMsgFolderCacheCID,
|
NS_MAILNEWSFOLDERDATASOURCE_PROGID,
|
||||||
NS_MSGFOLDERCACHE_PROGID},
|
nsMsgFolderDataSourceConstructor,
|
||||||
{ "Mail/News Status Feedback", &kMsgStatusFeedbackCID,
|
},
|
||||||
NS_MSGSTATUSFEEDBACK_PROGID},
|
{ "Mail/News Message Data Source", NS_MAILNEWSMESSAGEDATASOURCE_CID,
|
||||||
{ "Mail/News MessageView", &kMessageViewCID,
|
NS_MAILNEWSMESSAGEDATASOURCE_PROGID,
|
||||||
NS_MESSAGEVIEW_PROGID},
|
nsMsgMessageDataSourceConstructor,
|
||||||
{ "Mail/News MsgWindow", &kMsgWindowCID,
|
},
|
||||||
NS_MSGWINDOW_PROGID},
|
{ "Mail/News Account Manager Data Source", NS_MSGACCOUNTMANAGERDATASOURCE_CID,
|
||||||
{ "Mail/News Message Navigation Service", &kMsgViewNavigationServiceCID,
|
NS_RDF_DATASOURCE_PROGID_PREFIX "msgaccountmanager",
|
||||||
NS_MSGVIEWNAVIGATIONSERVICE_PROGID},
|
nsMsgAccountManagerDataSourceConstructor,
|
||||||
{ "Mail/News Print Engine", &kMsgPrintEngineCID,
|
},
|
||||||
NS_MSGPRINTENGINE_PROGID},
|
{ "Message Filter Service", NS_MSGFILTERSERVICE_CID,
|
||||||
{ "Mail/News Service Provider Service", &kMsgServiceProviderServiceCID,
|
NS_MSGFILTERSERVICE_PROGID,
|
||||||
NS_MSGSERVICEPROVIDERSERVICE_PROGID},
|
nsMsgFilterServiceConstructor,
|
||||||
{ "Mail/News Subscribe Data Source", &kSubscribeDataSourceCID,
|
},
|
||||||
NS_SUBSCRIBEDATASOURCE_PROGID}
|
{ "Message Filter Datasource", NS_MSGFILTERDATASOURCE_CID,
|
||||||
|
NS_MSGFILTERDATASOURCE_PROGID,
|
||||||
|
nsMsgFilterDataSourceConstructor,
|
||||||
|
},
|
||||||
|
// XXX temporarily do all the protocols here
|
||||||
|
{ "Message Filter Delegate Factory", NS_MSGFILTERDELEGATEFACTORY_CID,
|
||||||
|
NS_MSGFILTERDELEGATEFACTORY_IMAP_PROGID,
|
||||||
|
nsMsgFilterDelegateFactoryConstructor,
|
||||||
|
},
|
||||||
|
{ "Message Filter Delegate Factory", NS_MSGFILTERDELEGATEFACTORY_CID,
|
||||||
|
NS_MSGFILTERDELEGATEFACTORY_MAILBOX_PROGID,
|
||||||
|
nsMsgFilterDelegateFactoryConstructor,
|
||||||
|
},
|
||||||
|
{ "Message Filter Delegate Factory", NS_MSGFILTERDELEGATEFACTORY_CID,
|
||||||
|
NS_MSGFILTERDELEGATEFACTORY_NEWS_PROGID,
|
||||||
|
nsMsgFilterDelegateFactoryConstructor,
|
||||||
|
},
|
||||||
|
// XXX done temporary registration
|
||||||
|
|
||||||
|
{ "Messenger Biff Manager", NS_MSGBIFFMANAGER_CID,
|
||||||
|
NS_MSGBIFFMANAGER_PROGID,
|
||||||
|
nsMsgBiffManagerConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News Notification Manager", NS_MSGNOTIFICATIONMANAGER_CID,
|
||||||
|
NS_MSGNOTIFICATIONMANAGER_PROGID,
|
||||||
|
nsMsgNotificationManagerConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News CopyMessage Stream Listener", NS_COPYMESSAGESTREAMLISTENER_CID,
|
||||||
|
NS_COPYMESSAGESTREAMLISTENER_PROGID,
|
||||||
|
nsCopyMessageStreamListenerConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News Message Copy Service", NS_MSGCOPYSERVICE_CID,
|
||||||
|
NS_MSGCOPYSERVICE_PROGID,
|
||||||
|
nsMsgCopyServiceConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News Folder Cache", NS_MSGFOLDERCACHE_CID,
|
||||||
|
NS_MSGFOLDERCACHE_PROGID,
|
||||||
|
nsMsgFolderCacheConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News Status Feedback", NS_MSGSTATUSFEEDBACK_CID,
|
||||||
|
NS_MSGSTATUSFEEDBACK_PROGID,
|
||||||
|
nsMsgStatusFeedbackConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News MessageView", NS_MESSAGEVIEW_CID,
|
||||||
|
NS_MESSAGEVIEW_PROGID,
|
||||||
|
nsMessageViewConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News MsgWindow", NS_MSGWINDOW_CID,
|
||||||
|
NS_MSGWINDOW_PROGID,
|
||||||
|
nsMsgWindowConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News Message Navigation Service", NS_MSGVIEWNAVIGATIONSERVICE_CID,
|
||||||
|
NS_MSGVIEWNAVIGATIONSERVICE_PROGID,
|
||||||
|
nsMsgViewNavigationServiceConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News Print Engine", NS_MSG_PRINTENGINE_CID,
|
||||||
|
NS_MSGPRINTENGINE_PROGID,
|
||||||
|
nsMsgPrintEngineConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News Service Provider Service", NS_MSGSERVICEPROVIDERSERVICE_CID,
|
||||||
|
NS_MSGSERVICEPROVIDERSERVICE_PROGID,
|
||||||
|
nsMsgServiceProviderServiceConstructor,
|
||||||
|
},
|
||||||
|
{ "Mail/News Subscribe Data Source", NS_SUBSCRIBEDATASOURCE_CID,
|
||||||
|
NS_SUBSCRIBEDATASOURCE_PROGID,
|
||||||
|
nsSubscribeDataSourceConstructor,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_COMPONENTS (sizeof(gComponents) / sizeof(gComponents[0]))
|
NS_IMPL_NSGETMODULE("nsMsgBaseModule", gComponents)
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgBaseModule::RegisterSelf(nsIComponentManager *aCompMgr,
|
|
||||||
nsIFile* aPath,
|
|
||||||
const char* registryLocation,
|
|
||||||
const char* componentType)
|
|
||||||
{
|
|
||||||
nsresult rv = 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;
|
|
||||||
|
|
||||||
if (cp->mRegisterSelfProc) {
|
|
||||||
rv = cp->mRegisterSelfProc(aCompMgr,aPath,registryLocation,componentType);
|
|
||||||
if (NS_FAILED(rv)) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
cp++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add to MessengerBootstrap appshell component list. */
|
|
||||||
NS_WITH_SERVICE(nsIRegistry, registry, NS_REGISTRY_PROGID, &rv);
|
|
||||||
|
|
||||||
if ( NS_SUCCEEDED( rv ) ) {
|
|
||||||
registry->OpenWellKnownRegistry(nsIRegistry::ApplicationComponentRegistry);
|
|
||||||
char buffer[256];
|
|
||||||
char *cid = kCMessengerBootstrapCID.ToString();
|
|
||||||
PR_snprintf( buffer,
|
|
||||||
sizeof buffer,
|
|
||||||
"%s/%s",
|
|
||||||
NS_IAPPSHELLCOMPONENT_KEY,
|
|
||||||
cid ? cid : "unknown" );
|
|
||||||
nsCRT::free(cid);
|
|
||||||
nsRegistryKey key;
|
|
||||||
rv = registry->AddSubtree( nsIRegistry::Common,
|
|
||||||
buffer,
|
|
||||||
&key );
|
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgBaseModule::UnregisterSelf(nsIComponentManager* aCompMgr,
|
|
||||||
nsIFile* aPath,
|
|
||||||
const char* registryLocation)
|
|
||||||
{
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
|
|
||||||
Components* cp = gComponents;
|
|
||||||
Components* end = cp + NUM_COMPONENTS;
|
|
||||||
while (cp < end)
|
|
||||||
{
|
|
||||||
aCompMgr->UnregisterComponentSpec(*cp->mCID, aPath);
|
|
||||||
|
|
||||||
if (cp->mRegisterSelfProc) {
|
|
||||||
rv = cp->mUnregisterSelfProc(aCompMgr,aPath,registryLocation);
|
|
||||||
if (NS_FAILED(rv)) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cp++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
|
||||||
nsIFile* aPath,
|
|
||||||
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(NS_GET_IID(nsIModule), (void**)return_cobj);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
{
|
|
||||||
delete module;
|
|
||||||
module = nsnull;
|
|
||||||
}
|
|
||||||
gModule = module; // WARNING: Weak Reference
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче