1998-12-22 00:13:57 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsIFactory.h"
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "msgCore.h"
|
|
|
|
#include "nsMsgBaseCID.h"
|
1999-02-13 01:28:26 +03:00
|
|
|
#include "pratom.h"
|
1999-03-09 12:52:30 +03:00
|
|
|
#include "nsIComponentManager.h"
|
|
|
|
#include "nsIServiceManager.h"
|
1999-02-26 15:24:22 +03:00
|
|
|
#include "rdf.h"
|
|
|
|
#include "nsCRT.h"
|
1999-03-09 15:53:21 +03:00
|
|
|
#include "nsCOMPtr.h"
|
1998-12-22 00:13:57 +03:00
|
|
|
|
1999-04-27 02:52:38 +04:00
|
|
|
#include "nsMessenger.h"
|
1999-03-06 04:29:31 +03:00
|
|
|
#include "nsMsgGroupRecord.h"
|
|
|
|
|
1999-03-09 22:58:17 +03:00
|
|
|
#include "nsMsgAppCore.h"
|
|
|
|
|
1998-12-22 00:13:57 +03:00
|
|
|
/* Include all of the interfaces our factory can generate components for */
|
|
|
|
|
1999-03-03 04:11:53 +03:00
|
|
|
#include "nsIUrlListenerManager.h"
|
|
|
|
#include "nsUrlListenerManager.h"
|
1999-03-09 04:39:05 +03:00
|
|
|
#include "nsMsgMailSession.h"
|
1999-04-07 02:47:12 +04:00
|
|
|
#include "nsMsgAccount.h"
|
|
|
|
#include "nsMsgAccountManager.h"
|
|
|
|
#include "nsMsgIdentity.h"
|
1999-04-06 03:32:46 +04:00
|
|
|
#include "nsMessageViewDataSource.h"
|
1999-04-20 05:11:11 +04:00
|
|
|
#include "nsMsgFolderDataSource.h"
|
|
|
|
#include "nsMsgMessageDataSource.h"
|
1999-03-09 04:39:05 +03:00
|
|
|
|
1999-04-27 01:29:44 +04:00
|
|
|
#include "nsMsgAccountManagerDS.h"
|
|
|
|
#include "nsMsgAccountDataSource.h"
|
|
|
|
#include "nsMsgServerDataSource.h"
|
|
|
|
#include "nsMsgIdentityDataSource.h"
|
|
|
|
|
1999-05-11 03:25:08 +04:00
|
|
|
#ifdef DEBUG_bienvenu
|
|
|
|
#include "nsMsgFilterService.h"
|
|
|
|
#endif
|
1999-03-09 12:52:30 +03:00
|
|
|
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
|
|
|
|
1999-03-09 04:39:05 +03:00
|
|
|
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
|
|
|
|
1999-03-03 04:11:53 +03:00
|
|
|
static NS_DEFINE_CID(kCUrlListenerManagerCID, NS_URLLISTENERMANAGER_CID);
|
|
|
|
|
1999-03-06 04:29:31 +03:00
|
|
|
static NS_DEFINE_CID(kCMessengerBootstrapCID, NS_MESSENGERBOOTSTRAP_CID);
|
1999-02-27 05:33:21 +03:00
|
|
|
|
1999-02-13 13:39:59 +03:00
|
|
|
static NS_DEFINE_CID(kCMsgFolderEventCID, NS_MSGFOLDEREVENT_CID);
|
1998-12-22 00:13:57 +03:00
|
|
|
|
1999-03-09 22:58:17 +03:00
|
|
|
static NS_DEFINE_CID(kCMsgAppCoreCID, NS_MSGAPPCORE_CID);
|
1999-03-06 04:29:31 +03:00
|
|
|
static NS_DEFINE_CID(kCMsgGroupRecordCID, NS_MSGGROUPRECORD_CID);
|
|
|
|
|
1999-04-20 05:11:11 +04:00
|
|
|
static NS_DEFINE_CID(kMailNewsFolderDataSourceCID, NS_MAILNEWSFOLDERDATASOURCE_CID);
|
|
|
|
static NS_DEFINE_CID(kMailNewsMessageDataSourceCID, NS_MAILNEWSMESSAGEDATASOURCE_CID);
|
1999-04-06 03:32:46 +04:00
|
|
|
static NS_DEFINE_CID(kCMessageViewDataSourceCID, NS_MESSAGEVIEWDATASOURCE_CID);
|
|
|
|
|
1999-04-27 01:29:44 +04:00
|
|
|
// 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);
|
|
|
|
|
|
|
|
// account manager RDF stuff
|
|
|
|
static NS_DEFINE_CID(kMsgAccountManagerDataSourceCID, NS_MSGACCOUNTMANAGERDATASOURCE_CID);
|
|
|
|
static NS_DEFINE_CID(kMsgAccountDataSourceCID, NS_MSGACCOUNTDATASOURCE_CID);
|
|
|
|
static NS_DEFINE_CID(kMsgIdentityDataSourceCID, NS_MSGIDENTITYDATASOURCE_CID);
|
|
|
|
static NS_DEFINE_CID(kMsgServerDataSourceCID, NS_MSGSERVERDATASOURCE_CID);
|
1999-04-07 02:47:12 +04:00
|
|
|
|
1999-05-11 03:25:08 +04:00
|
|
|
// search and filter stuff
|
|
|
|
static NS_DEFINE_CID(kMsgSearchSessionCID, NS_MSGSEARCHSESSION_CID);
|
|
|
|
static NS_DEFINE_CID(kMsgFilterServiceCID, NS_MSGFILTERSERVICE_CID);
|
1999-03-06 04:29:31 +03:00
|
|
|
|
1998-12-22 00:13:57 +03:00
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////
|
1999-02-13 01:28:26 +03:00
|
|
|
static PRInt32 g_InstanceCount = 0;
|
|
|
|
static PRInt32 g_LockCount = 0;
|
1998-12-22 00:13:57 +03:00
|
|
|
|
|
|
|
class nsMsgFactory : public nsIFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// nsISupports methods
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
1999-02-27 05:33:21 +03:00
|
|
|
nsMsgFactory(const nsCID &aClass,
|
|
|
|
const char* aClassName,
|
1999-05-05 01:39:54 +04:00
|
|
|
const char* aProgID);
|
1998-12-22 00:13:57 +03:00
|
|
|
|
1999-02-26 15:24:22 +03:00
|
|
|
// nsIFactory methods
|
|
|
|
NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult);
|
|
|
|
NS_IMETHOD LockFactory(PRBool aLock);
|
1998-12-22 00:13:57 +03:00
|
|
|
|
1999-02-26 15:24:22 +03:00
|
|
|
protected:
|
|
|
|
virtual ~nsMsgFactory();
|
1998-12-22 00:13:57 +03:00
|
|
|
|
1999-02-26 15:24:22 +03:00
|
|
|
nsCID mClassID;
|
|
|
|
char* mClassName;
|
|
|
|
char* mProgID;
|
1998-12-22 00:13:57 +03:00
|
|
|
};
|
|
|
|
|
1999-02-27 05:33:21 +03:00
|
|
|
nsMsgFactory::nsMsgFactory(const nsCID &aClass,
|
|
|
|
const char* aClassName,
|
1999-05-05 01:39:54 +04:00
|
|
|
const char* aProgID)
|
1999-02-27 05:33:21 +03:00
|
|
|
: mClassID(aClass),
|
|
|
|
mClassName(nsCRT::strdup(aClassName)),
|
|
|
|
mProgID(nsCRT::strdup(aProgID))
|
|
|
|
{
|
1998-12-22 00:13:57 +03:00
|
|
|
NS_INIT_REFCNT();
|
1999-02-27 05:33:21 +03:00
|
|
|
|
1998-12-22 00:13:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsMsgFactory::~nsMsgFactory()
|
1999-02-13 01:28:26 +03:00
|
|
|
{
|
1999-04-06 07:11:40 +04:00
|
|
|
|
1999-02-27 05:33:21 +03:00
|
|
|
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
|
|
|
|
1999-04-06 07:11:40 +04:00
|
|
|
PL_strfree(mClassName);
|
|
|
|
PL_strfree(mProgID);
|
1998-12-22 00:13:57 +03:00
|
|
|
}
|
|
|
|
|
1999-02-27 05:33:21 +03:00
|
|
|
nsresult
|
|
|
|
nsMsgFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
1998-12-22 00:13:57 +03:00
|
|
|
{
|
|
|
|
if (aResult == NULL)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
|
|
|
// Always NULL result, in case of failure
|
|
|
|
*aResult = NULL;
|
|
|
|
|
|
|
|
// we support two interfaces....nsISupports and nsFactory.....
|
1999-03-04 03:44:05 +03:00
|
|
|
if (aIID.Equals(::nsISupports::GetIID()))
|
1999-05-05 01:39:54 +04:00
|
|
|
*aResult = (void *)NS_STATIC_CAST(nsISupports*,this);
|
1999-03-04 03:44:05 +03:00
|
|
|
else if (aIID.Equals(nsIFactory::GetIID()))
|
1999-05-05 01:39:54 +04:00
|
|
|
*aResult = (void *)NS_STATIC_CAST(nsIFactory*,this);
|
1998-12-22 00:13:57 +03:00
|
|
|
|
|
|
|
if (*aResult == NULL)
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
|
1999-05-05 01:39:54 +04:00
|
|
|
NS_ADDREF_THIS(); // Increase reference count for caller
|
1998-12-22 00:13:57 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(nsMsgFactory)
|
|
|
|
NS_IMPL_RELEASE(nsMsgFactory)
|
|
|
|
|
1999-02-27 05:33:21 +03:00
|
|
|
nsresult
|
1999-05-05 01:39:54 +04:00
|
|
|
nsMsgFactory::CreateInstance(nsISupports * /* aOuter */,
|
1999-03-06 04:29:31 +03:00
|
|
|
const nsIID &aIID,
|
|
|
|
void **aResult)
|
1999-05-05 01:39:54 +04:00
|
|
|
{
|
|
|
|
nsresult rv = NS_ERROR_NO_INTERFACE;
|
1998-12-22 00:13:57 +03:00
|
|
|
if (aResult == NULL)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
|
|
|
*aResult = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
// ClassID check happens here
|
|
|
|
// Whenever you add a new class that supports an interface, plug it in here!!!
|
|
|
|
|
1999-04-16 23:02:22 +04:00
|
|
|
if (mClassID.Equals(kCMsgFolderEventCID))
|
1999-03-03 04:11:53 +03:00
|
|
|
{
|
|
|
|
NS_NOTREACHED("hello? what happens here?");
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_OK;
|
1999-02-13 01:28:26 +03:00
|
|
|
}
|
1999-03-03 04:11:53 +03:00
|
|
|
else if (mClassID.Equals(kCMessengerBootstrapCID))
|
|
|
|
{
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_NewMessengerBootstrap(aIID, aResult);
|
1999-03-03 04:11:53 +03:00
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kCUrlListenerManagerCID))
|
|
|
|
{
|
|
|
|
nsUrlListenerManager * listener = nsnull;
|
|
|
|
listener = new nsUrlListenerManager();
|
1999-03-10 06:49:39 +03:00
|
|
|
if (listener == nsnull)
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
else {
|
|
|
|
rv = listener->QueryInterface(aIID, aResult);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
delete listener;
|
|
|
|
}
|
1999-03-03 04:11:53 +03:00
|
|
|
}
|
1999-03-09 04:39:05 +03:00
|
|
|
else if (mClassID.Equals(kCMsgMailSessionCID))
|
|
|
|
{
|
|
|
|
nsMsgMailSession * session = new nsMsgMailSession();
|
1999-03-10 06:49:39 +03:00
|
|
|
if (session == nsnull)
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
else {
|
|
|
|
rv = session->QueryInterface(aIID, aResult);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
delete session;
|
|
|
|
}
|
1999-03-10 06:49:39 +03:00
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kCMsgAppCoreCID))
|
|
|
|
{
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_NewMsgAppCore(aIID, aResult);
|
1999-03-09 04:39:05 +03:00
|
|
|
}
|
1999-04-07 02:47:12 +04:00
|
|
|
|
1999-04-27 01:29:44 +04:00
|
|
|
else if (mClassID.Equals(kMsgAccountManagerCID))
|
1999-04-07 02:47:12 +04:00
|
|
|
{
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_NewMsgAccountManager(aIID, aResult);
|
1999-04-07 02:47:12 +04:00
|
|
|
}
|
|
|
|
|
1999-04-27 01:29:44 +04:00
|
|
|
else if (mClassID.Equals(kMsgAccountCID))
|
1999-04-07 02:47:12 +04:00
|
|
|
{
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_NewMsgAccount(aIID, aResult);
|
1999-04-07 02:47:12 +04:00
|
|
|
}
|
|
|
|
|
1999-04-27 01:29:44 +04:00
|
|
|
else if (mClassID.Equals(kMsgIdentityCID)) {
|
1999-04-07 02:47:12 +04:00
|
|
|
nsMsgIdentity* identity = new nsMsgIdentity();
|
1999-05-05 01:39:54 +04:00
|
|
|
|
|
|
|
if (identity == nsnull)
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
else {
|
|
|
|
rv = identity->QueryInterface(aIID, aResult);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
delete identity;
|
|
|
|
}
|
1999-04-07 02:47:12 +04:00
|
|
|
}
|
1999-04-20 05:11:11 +04:00
|
|
|
else if (mClassID.Equals(kMailNewsFolderDataSourceCID))
|
|
|
|
{
|
|
|
|
nsMsgFolderDataSource * folderDataSource = new nsMsgFolderDataSource();
|
1999-05-05 01:39:54 +04:00
|
|
|
if (folderDataSource == nsnull)
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
else {
|
|
|
|
rv = folderDataSource->QueryInterface(aIID, aResult);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
delete folderDataSource;
|
|
|
|
}
|
1999-04-20 05:11:11 +04:00
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kMailNewsMessageDataSourceCID))
|
|
|
|
{
|
|
|
|
nsMsgMessageDataSource * messageDataSource = new nsMsgMessageDataSource();
|
1999-05-05 01:39:54 +04:00
|
|
|
if (messageDataSource == nsnull)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
else {
|
|
|
|
rv = messageDataSource->QueryInterface(aIID, aResult);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
delete messageDataSource;
|
|
|
|
}
|
1999-04-20 05:11:11 +04:00
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kCMessageViewDataSourceCID))
|
1999-04-06 03:32:46 +04:00
|
|
|
{
|
1999-04-06 07:11:40 +04:00
|
|
|
nsMessageViewDataSource * msgView = new nsMessageViewDataSource();
|
1999-05-05 01:39:54 +04:00
|
|
|
if (msgView == nsnull)
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
else {
|
|
|
|
rv = msgView->QueryInterface(aIID, aResult);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
delete msgView;
|
|
|
|
}
|
1998-12-22 00:13:57 +03:00
|
|
|
}
|
1999-04-27 01:29:44 +04:00
|
|
|
|
|
|
|
// account manager RDF datasources
|
|
|
|
else if (mClassID.Equals(kMsgAccountManagerDataSourceCID)) {
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_NewMsgAccountManagerDataSource(aIID, aResult);
|
1999-04-27 01:29:44 +04:00
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kMsgAccountDataSourceCID)) {
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_NewMsgAccountDataSource(aIID, aResult);
|
1999-04-27 01:29:44 +04:00
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kMsgIdentityDataSourceCID)) {
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_NewMsgIdentityDataSource(aIID, aResult);
|
1999-04-27 01:29:44 +04:00
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kMsgServerDataSourceCID)) {
|
1999-05-05 01:39:54 +04:00
|
|
|
rv = NS_NewMsgServerDataSource(aIID, aResult);
|
1999-04-27 01:29:44 +04:00
|
|
|
}
|
1999-05-11 03:25:08 +04:00
|
|
|
#ifdef DEBUG_bienvenu
|
|
|
|
else if (mClassID.Equals(kMsgFilterServiceCID)) {
|
|
|
|
rv = NS_NewMsgFilterService(aIID, aResult);
|
|
|
|
}
|
|
|
|
#endif
|
1999-05-05 01:39:54 +04:00
|
|
|
return rv;
|
1998-12-22 00:13:57 +03:00
|
|
|
}
|
|
|
|
|
1999-02-27 05:33:21 +03:00
|
|
|
nsresult
|
|
|
|
nsMsgFactory::LockFactory(PRBool aLock)
|
1998-12-22 00:13:57 +03:00
|
|
|
{
|
1999-03-03 04:11:53 +03:00
|
|
|
if (aLock)
|
1999-02-13 01:28:26 +03:00
|
|
|
PR_AtomicIncrement(&g_LockCount);
|
1999-03-03 04:11:53 +03:00
|
|
|
else
|
|
|
|
PR_AtomicDecrement(&g_LockCount);
|
1999-02-13 01:28:26 +03:00
|
|
|
|
1999-03-03 04:11:53 +03:00
|
|
|
return NS_OK;
|
1998-12-22 00:13:57 +03:00
|
|
|
}
|
|
|
|
|
1999-02-26 15:24:22 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-12-22 00:13:57 +03:00
|
|
|
// return the proper factory to the caller.
|
1999-05-05 01:39:54 +04:00
|
|
|
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* /*aServMgr */,
|
1999-02-26 15:24:22 +03:00
|
|
|
const nsCID &aClass,
|
|
|
|
const char *aClassName,
|
|
|
|
const char *aProgID,
|
1999-01-27 00:42:39 +03:00
|
|
|
nsIFactory **aFactory)
|
1998-12-22 00:13:57 +03:00
|
|
|
{
|
|
|
|
if (nsnull == aFactory)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
1999-05-05 01:39:54 +04:00
|
|
|
*aFactory = new nsMsgFactory(aClass, aClassName, aProgID);
|
1999-02-26 15:24:22 +03:00
|
|
|
if (aFactory)
|
1999-03-04 03:44:05 +03:00
|
|
|
return (*aFactory)->QueryInterface(nsIFactory::GetIID(),
|
1999-02-27 05:33:21 +03:00
|
|
|
(void**)aFactory);
|
1999-02-26 15:24:22 +03:00
|
|
|
else
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
1998-12-22 00:13:57 +03:00
|
|
|
}
|
|
|
|
|
1999-05-05 01:39:54 +04:00
|
|
|
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* /* aServMgr */)
|
1999-02-13 01:28:26 +03:00
|
|
|
{
|
1999-03-03 04:11:53 +03:00
|
|
|
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
1999-02-13 01:28:26 +03:00
|
|
|
}
|
|
|
|
|
1999-02-26 15:24:22 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-02-13 01:28:26 +03:00
|
|
|
extern "C" NS_EXPORT nsresult
|
1999-03-09 12:52:30 +03:00
|
|
|
NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
1999-02-13 01:28:26 +03:00
|
|
|
{
|
1999-02-26 15:24:22 +03:00
|
|
|
nsresult rv;
|
1999-03-09 15:29:08 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
nsIComponentManager* compMgr;
|
|
|
|
rv = servMgr->GetService(kComponentManagerCID,
|
|
|
|
nsIComponentManager::GetIID(),
|
|
|
|
(nsISupports**)&compMgr);
|
1999-03-09 12:52:30 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-02-13 01:28:26 +03:00
|
|
|
|
1999-02-26 15:24:22 +03:00
|
|
|
// register the message folder factory
|
1999-03-09 12:52:30 +03:00
|
|
|
rv = compMgr->RegisterComponent(kCMsgFolderEventCID,
|
1999-03-06 04:29:31 +03:00
|
|
|
"Folder Event",
|
|
|
|
nsnull,
|
1999-02-26 15:24:22 +03:00
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-03-09 15:29:08 +03:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-03-03 04:11:53 +03:00
|
|
|
|
1999-03-09 12:52:30 +03:00
|
|
|
rv = compMgr->RegisterComponent(kCUrlListenerManagerCID,
|
1999-03-06 04:29:31 +03:00
|
|
|
"UrlListenerManager",
|
|
|
|
nsnull,
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-03-09 15:29:08 +03:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-03-06 04:29:31 +03:00
|
|
|
|
1999-03-09 12:52:30 +03:00
|
|
|
rv = compMgr->RegisterComponent(kCMessengerBootstrapCID,
|
1999-03-06 04:29:31 +03:00
|
|
|
"Netscape Messenger Bootstrapper",
|
1999-02-27 05:33:21 +03:00
|
|
|
"component://netscape/messenger",
|
|
|
|
path,
|
|
|
|
PR_TRUE, PR_TRUE);
|
1999-04-16 00:01:31 +04:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-03-09 22:58:17 +03:00
|
|
|
|
|
|
|
rv = compMgr->RegisterComponent(kCMsgAppCoreCID,
|
|
|
|
"Messenger AppCore",
|
|
|
|
"component://netscape/appcores/messenger",
|
|
|
|
path,
|
|
|
|
PR_TRUE, PR_TRUE);
|
1999-04-16 00:01:31 +04:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-04-07 02:47:12 +04:00
|
|
|
|
1999-04-27 01:29:44 +04:00
|
|
|
rv = compMgr->RegisterComponent(kMsgAccountManagerCID,
|
1999-04-07 02:47:12 +04:00
|
|
|
"Messenger Account Manager",
|
|
|
|
"component://netscape/messenger/account-manager",
|
|
|
|
path,
|
|
|
|
PR_TRUE, PR_TRUE);
|
1999-04-16 00:01:31 +04:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-04-07 02:47:12 +04:00
|
|
|
|
1999-04-27 01:29:44 +04:00
|
|
|
rv = compMgr->RegisterComponent(kMsgAccountCID,
|
1999-04-07 02:47:12 +04:00
|
|
|
"Messenger User Account",
|
|
|
|
"component://netscape/messenger/account",
|
|
|
|
path,
|
|
|
|
PR_TRUE, PR_TRUE);
|
1999-04-16 00:01:31 +04:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-04-07 02:47:12 +04:00
|
|
|
|
1999-04-27 01:29:44 +04:00
|
|
|
rv = compMgr->RegisterComponent(kMsgIdentityCID,
|
1999-04-07 02:47:12 +04:00
|
|
|
"Messenger User Identity",
|
|
|
|
"component://netscape/messenger/identity",
|
|
|
|
path,
|
|
|
|
PR_TRUE, PR_TRUE);
|
1999-03-09 15:29:08 +03:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-04-16 00:01:31 +04:00
|
|
|
|
1999-03-06 04:29:31 +03:00
|
|
|
#if 0
|
1999-03-09 12:52:30 +03:00
|
|
|
rv = compMgr->RegisterComponent(kCMsgGroupRecordCID,
|
1999-03-06 04:29:31 +03:00
|
|
|
nsnull,
|
|
|
|
nsnull,
|
|
|
|
path,
|
|
|
|
PR_TRUE, PR_TRUE);
|
1999-03-09 15:29:08 +03:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-03-06 04:29:31 +03:00
|
|
|
#endif
|
1999-03-09 12:52:30 +03:00
|
|
|
rv = compMgr->RegisterComponent(kCMsgMailSessionCID,
|
|
|
|
"Mail Session",
|
|
|
|
nsnull,
|
|
|
|
path,
|
|
|
|
PR_TRUE, PR_TRUE);
|
1999-03-09 15:29:08 +03:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-04-06 03:32:46 +04:00
|
|
|
|
1999-04-20 05:11:11 +04:00
|
|
|
// register our RDF datasources:
|
|
|
|
rv = compMgr->RegisterComponent(kMailNewsFolderDataSourceCID,
|
|
|
|
"Mail/News Folder Data Source",
|
|
|
|
NS_RDF_DATASOURCE_PROGID_PREFIX "mailnewsfolders",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
|
|
|
if (NS_FAILED(rv)) goto done;
|
|
|
|
|
|
|
|
// register our RDF datasources:
|
|
|
|
rv = compMgr->RegisterComponent(kMailNewsMessageDataSourceCID,
|
|
|
|
"Mail/News Message Data Source",
|
|
|
|
NS_RDF_DATASOURCE_PROGID_PREFIX "mailnewsmessages",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
|
|
|
if (NS_FAILED(rv)) goto done;
|
|
|
|
|
1999-04-16 00:01:31 +04:00
|
|
|
rv = compMgr->RegisterComponent(kCMessageViewDataSourceCID,
|
1999-04-06 03:32:46 +04:00
|
|
|
"Mail/News Message View Data Source",
|
|
|
|
NS_RDF_DATASOURCE_PROGID_PREFIX "mail-messageview",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
|
|
|
if (NS_FAILED(rv)) goto done;
|
|
|
|
|
1999-04-27 01:29:44 +04:00
|
|
|
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)) goto done;
|
|
|
|
rv = compMgr->RegisterComponent(kMsgAccountDataSourceCID,
|
|
|
|
"Mail/News Account Data Source",
|
|
|
|
NS_RDF_DATASOURCE_PROGID_PREFIX "msgaccounts",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
|
|
|
if (NS_FAILED(rv)) goto done;
|
|
|
|
rv = compMgr->RegisterComponent(kMsgIdentityDataSourceCID,
|
|
|
|
"Mail/News Identity Data Source",
|
|
|
|
NS_RDF_DATASOURCE_PROGID_PREFIX "msgidentities",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
|
|
|
if (NS_FAILED(rv)) goto done;
|
|
|
|
rv = compMgr->RegisterComponent(kMsgServerDataSourceCID,
|
|
|
|
"Mail/News Server Data Source",
|
|
|
|
NS_RDF_DATASOURCE_PROGID_PREFIX "msgservers",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-05-14 04:56:13 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG_bienvenu
|
|
|
|
printf("register filter service\n");
|
|
|
|
rv = compMgr->RegisterComponent(kMsgFilterServiceCID,
|
|
|
|
"Message Filter Service", nsnull,
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
|
|
|
if (NS_FAILED(rv)) goto done;
|
|
|
|
#endif
|
1999-04-27 01:29:44 +04:00
|
|
|
|
1999-03-09 12:52:30 +03:00
|
|
|
#ifdef NS_DEBUG
|
1999-03-06 04:29:31 +03:00
|
|
|
printf("mailnews registering from %s\n",path);
|
1999-03-09 12:52:30 +03:00
|
|
|
#endif
|
1999-03-09 15:29:08 +03:00
|
|
|
|
|
|
|
done:
|
|
|
|
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
|
1999-02-26 15:24:22 +03:00
|
|
|
return rv;
|
1999-02-13 01:28:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" NS_EXPORT nsresult
|
1999-03-09 12:52:30 +03:00
|
|
|
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
1999-02-13 01:28:26 +03:00
|
|
|
{
|
1999-02-26 15:24:22 +03:00
|
|
|
nsresult rv;
|
1999-03-09 12:52:30 +03:00
|
|
|
|
1999-03-09 15:29:08 +03:00
|
|
|
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
|
1999-03-09 12:52:30 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-03-09 15:29:08 +03:00
|
|
|
|
|
|
|
nsIComponentManager* compMgr;
|
|
|
|
rv = servMgr->GetService(kComponentManagerCID,
|
|
|
|
nsIComponentManager::GetIID(),
|
|
|
|
(nsISupports**)&compMgr);
|
1999-03-09 12:52:30 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-03-09 15:29:08 +03:00
|
|
|
|
|
|
|
rv = compMgr->UnregisterComponent(kCUrlListenerManagerCID, path);
|
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-03-09 12:52:30 +03:00
|
|
|
rv = compMgr->UnregisterComponent(kCMessengerBootstrapCID, path);
|
1999-03-09 15:29:08 +03:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-03-06 04:29:31 +03:00
|
|
|
#if 0
|
1999-03-09 12:52:30 +03:00
|
|
|
rv = compMgr->UnregisterComponent(kCMsgGroupRecordCID, path);
|
1999-03-09 15:29:08 +03:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-03-06 04:29:31 +03:00
|
|
|
#endif
|
1999-03-09 12:52:30 +03:00
|
|
|
rv = compMgr->UnregisterComponent(kCMsgFolderEventCID, path);
|
1999-03-09 15:29:08 +03:00
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-03-09 12:52:30 +03:00
|
|
|
rv = compMgr->UnregisterComponent(kCMsgMailSessionCID, path);
|
1999-04-06 03:32:46 +04:00
|
|
|
if(NS_FAILED(rv)) goto done;
|
1999-04-20 05:11:11 +04:00
|
|
|
rv = compMgr->UnregisterComponent(kMailNewsFolderDataSourceCID, path);
|
|
|
|
if (NS_FAILED(rv)) goto done;
|
|
|
|
rv = compMgr->UnregisterComponent(kMailNewsMessageDataSourceCID, path);
|
|
|
|
if (NS_FAILED(rv)) goto done;
|
1999-04-06 03:32:46 +04:00
|
|
|
rv = compMgr->UnregisterComponent(kCMessageViewDataSourceCID, path);
|
|
|
|
if(NS_FAILED(rv)) goto done;
|
1999-03-09 15:29:08 +03:00
|
|
|
|
1999-04-27 01:29:44 +04:00
|
|
|
// Account Manager RDF stuff
|
|
|
|
rv = compMgr->UnregisterComponent(kMsgAccountManagerDataSourceCID, path);
|
|
|
|
if(NS_FAILED(rv)) goto done;
|
|
|
|
rv = compMgr->UnregisterComponent(kMsgAccountDataSourceCID, path);
|
|
|
|
if(NS_FAILED(rv)) goto done;
|
|
|
|
rv = compMgr->UnregisterComponent(kMsgIdentityDataSourceCID, path);
|
|
|
|
if(NS_FAILED(rv)) goto done;
|
|
|
|
rv = compMgr->UnregisterComponent(kMsgServerDataSourceCID, path);
|
|
|
|
if(NS_FAILED(rv)) goto done;
|
1999-05-14 04:56:13 +04:00
|
|
|
#ifdef DEBUG_bienvenu
|
|
|
|
rv = compMgr->UnregisterComponent(kMsgFilterServiceCID, path);
|
|
|
|
if(NS_FAILED(rv)) goto done;
|
|
|
|
#endif
|
1999-04-27 01:29:44 +04:00
|
|
|
|
1999-03-09 15:29:08 +03:00
|
|
|
done:
|
|
|
|
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
|
1999-02-26 15:24:22 +03:00
|
|
|
return rv;
|
1999-02-13 01:28:26 +03:00
|
|
|
}
|
|
|
|
|
1999-02-26 15:24:22 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|