1999-03-24 05:31:49 +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"
|
|
|
|
#include "pratom.h"
|
|
|
|
#include "nsIComponentManager.h"
|
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsCRT.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
1999-04-20 23:08:10 +04:00
|
|
|
#include "nsNewsFolder.h"
|
|
|
|
#include "nsMsgNewsCID.h"
|
1999-03-24 05:31:49 +03:00
|
|
|
|
|
|
|
/* Include all of the interfaces our factory can generate components for */
|
|
|
|
#include "nsNntpUrl.h"
|
1999-03-25 07:47:12 +03:00
|
|
|
#include "nsNntpService.h"
|
1999-04-21 06:55:48 +04:00
|
|
|
#include "nsNntpIncomingServer.h"
|
1999-04-25 00:46:07 +04:00
|
|
|
#include "nsNewsMessage.h"
|
1999-06-03 06:24:08 +04:00
|
|
|
#include "nsNNTPNewsgroup.h"
|
|
|
|
#include "nsNNTPNewsgroupPost.h"
|
|
|
|
#include "nsNNTPNewsgroupList.h"
|
|
|
|
#include "nsNNTPArticleList.h"
|
1999-06-03 22:09:54 +04:00
|
|
|
#include "nsNNTPHost.h"
|
1999-03-24 05:31:49 +03:00
|
|
|
|
|
|
|
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
|
|
|
static NS_DEFINE_CID(kNntpUrlCID, NS_NNTPURL_CID);
|
1999-03-25 07:47:12 +03:00
|
|
|
static NS_DEFINE_CID(kNntpServiceCID, NS_NNTPSERVICE_CID);
|
1999-04-20 23:08:10 +04:00
|
|
|
static NS_DEFINE_CID(kNewsFolderResourceCID, NS_NEWSFOLDERRESOURCE_CID);
|
|
|
|
static NS_DEFINE_CID(kNntpIncomingServerCID, NS_NNTPINCOMINGSERVER_CID);
|
1999-04-25 00:46:07 +04:00
|
|
|
static NS_DEFINE_CID(kNewsMessageResourceCID, NS_NEWSMESSAGERESOURCE_CID);
|
1999-06-03 06:24:08 +04:00
|
|
|
static NS_DEFINE_CID(kNNTPNewsgroupCID, NS_NNTPNEWSGROUP_CID);
|
|
|
|
static NS_DEFINE_CID(kNNTPNewsgroupPostCID, NS_NNTPNEWSGROUPPOST_CID);
|
|
|
|
static NS_DEFINE_CID(kNNTPNewsgroupListCID, NS_NNTPNEWSGROUPLIST_CID);
|
|
|
|
static NS_DEFINE_CID(kNNTPArticleListCID, NS_NNTPARTICLELIST_CID);
|
1999-06-03 22:09:54 +04:00
|
|
|
static NS_DEFINE_CID(kNNTPHostCID, NS_NNTPHOST_CID);
|
1999-03-24 05:31:49 +03:00
|
|
|
|
|
|
|
static PRInt32 g_InstanceCount = 0;
|
|
|
|
static PRInt32 g_LockCount = 0;
|
|
|
|
|
|
|
|
class nsMsgNewsFactory : public nsIFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// nsISupports methods
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
nsMsgNewsFactory(const nsCID &aClass,
|
1999-05-06 04:18:24 +04:00
|
|
|
const char* aClassName,
|
|
|
|
const char* aProgID);
|
1999-03-24 05:31:49 +03:00
|
|
|
|
|
|
|
// nsIFactory methods
|
|
|
|
NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult);
|
|
|
|
NS_IMETHOD LockFactory(PRBool aLock);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~nsMsgNewsFactory();
|
|
|
|
|
|
|
|
nsCID mClassID;
|
|
|
|
char* mClassName;
|
|
|
|
char* mProgID;
|
|
|
|
};
|
|
|
|
|
|
|
|
nsMsgNewsFactory::nsMsgNewsFactory(const nsCID &aClass,
|
|
|
|
const char* aClassName,
|
1999-05-06 04:18:24 +04:00
|
|
|
const char* aProgID)
|
1999-03-24 05:31:49 +03:00
|
|
|
: mClassID(aClass),
|
|
|
|
mClassName(nsCRT::strdup(aClassName)),
|
|
|
|
mProgID(nsCRT::strdup(aProgID))
|
|
|
|
{
|
|
|
|
NS_INIT_REFCNT();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsMsgNewsFactory::~nsMsgNewsFactory()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
|
|
|
|
1999-04-13 00:24:47 +04:00
|
|
|
PL_strfree(mClassName);
|
|
|
|
PL_strfree(mProgID);
|
1999-03-24 05:31:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsMsgNewsFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|
|
|
{
|
|
|
|
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-06-30 01:01:31 +04:00
|
|
|
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
1999-03-24 05:31:49 +03:00
|
|
|
*aResult = (void *)(nsISupports*)this;
|
|
|
|
else if (aIID.Equals(nsIFactory::GetIID()))
|
|
|
|
*aResult = (void *)(nsIFactory*)this;
|
|
|
|
|
|
|
|
if (*aResult == NULL)
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
|
|
|
|
AddRef(); // Increase reference count for caller
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(nsMsgNewsFactory)
|
|
|
|
NS_IMPL_RELEASE(nsMsgNewsFactory)
|
|
|
|
|
1999-05-06 04:18:24 +04:00
|
|
|
nsresult nsMsgNewsFactory::CreateInstance(nsISupports * /* aOuter */,
|
|
|
|
const nsIID &aIID,
|
|
|
|
void **aResult)
|
1999-03-24 05:31:49 +03:00
|
|
|
{
|
1999-04-20 23:08:10 +04:00
|
|
|
nsresult rv = NS_OK;
|
1999-05-06 04:18:24 +04:00
|
|
|
|
1999-03-24 05:31:49 +03:00
|
|
|
|
1999-04-20 23:08:10 +04:00
|
|
|
if (aResult == nsnull)
|
1999-03-24 05:31:49 +03:00
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
1999-04-20 23:08:10 +04:00
|
|
|
*aResult = nsnull;
|
1999-03-24 05:31:49 +03:00
|
|
|
|
|
|
|
// ClassID check happens here
|
|
|
|
// Whenever you add a new class that supports an interface, plug it in here!!!
|
1999-06-03 06:24:08 +04:00
|
|
|
|
1999-03-24 05:31:49 +03:00
|
|
|
if (mClassID.Equals(kNntpUrlCID))
|
1999-04-20 23:08:10 +04:00
|
|
|
{
|
1999-06-23 03:52:15 +04:00
|
|
|
nsNntpUrl *url = new nsNntpUrl();
|
1999-05-06 04:18:24 +04:00
|
|
|
if (url)
|
|
|
|
rv = url->QueryInterface(aIID, aResult);
|
|
|
|
else
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv) && url)
|
|
|
|
delete url;
|
1999-03-24 05:31:49 +03:00
|
|
|
}
|
1999-06-03 06:24:08 +04:00
|
|
|
else if (mClassID.Equals(kNntpServiceCID))
|
1999-03-25 07:47:12 +03:00
|
|
|
{
|
1999-05-06 04:18:24 +04:00
|
|
|
nsNntpService *service = new nsNntpService();
|
|
|
|
if (service)
|
|
|
|
rv = service->QueryInterface(aIID, aResult);
|
|
|
|
else
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv) && service)
|
|
|
|
delete service;
|
1999-06-03 06:24:08 +04:00
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kNNTPNewsgroupPostCID))
|
|
|
|
{
|
|
|
|
nsNNTPNewsgroupPost *newsgroupPost = new nsNNTPNewsgroupPost();
|
|
|
|
if (newsgroupPost)
|
|
|
|
rv = newsgroupPost->QueryInterface(aIID, aResult);
|
|
|
|
else
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv) && newsgroupPost)
|
|
|
|
delete newsgroupPost;
|
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kNNTPArticleListCID))
|
|
|
|
{
|
|
|
|
nsNNTPArticleList *articleList = new nsNNTPArticleList();
|
|
|
|
if (articleList)
|
|
|
|
rv = articleList->QueryInterface(aIID, aResult);
|
|
|
|
else
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv) && articleList)
|
|
|
|
delete articleList;
|
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kNNTPNewsgroupListCID))
|
|
|
|
{
|
|
|
|
nsNNTPNewsgroupList *newsgroupList = new nsNNTPNewsgroupList();
|
|
|
|
if (newsgroupList)
|
|
|
|
rv = newsgroupList->QueryInterface(aIID, aResult);
|
|
|
|
else
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv) && newsgroupList)
|
|
|
|
delete newsgroupList;
|
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kNNTPNewsgroupCID))
|
|
|
|
{
|
|
|
|
nsNNTPNewsgroup *newsgroup = new nsNNTPNewsgroup();
|
|
|
|
if (newsgroup)
|
|
|
|
rv = newsgroup->QueryInterface(aIID, aResult);
|
|
|
|
else
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv) && newsgroup)
|
|
|
|
delete newsgroup;
|
1999-03-25 07:47:12 +03:00
|
|
|
}
|
1999-04-20 23:08:10 +04:00
|
|
|
else if (mClassID.Equals(kNewsFolderResourceCID))
|
|
|
|
{
|
1999-05-06 04:18:24 +04:00
|
|
|
nsMsgNewsFolder *folder = new nsMsgNewsFolder();
|
|
|
|
if (folder)
|
|
|
|
rv = folder->QueryInterface(aIID, aResult);
|
|
|
|
else
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv) && folder)
|
|
|
|
delete folder;
|
1999-06-03 22:09:54 +04:00
|
|
|
}
|
|
|
|
else if (mClassID.Equals(kNNTPHostCID))
|
|
|
|
{
|
|
|
|
nsNNTPHost *host = new nsNNTPHost();
|
|
|
|
if (host)
|
|
|
|
rv = host->QueryInterface(aIID, aResult);
|
|
|
|
else
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv) && host)
|
|
|
|
delete host;
|
|
|
|
}
|
1999-04-21 22:58:29 +04:00
|
|
|
else if (mClassID.Equals(kNntpIncomingServerCID))
|
|
|
|
{
|
1999-06-03 22:09:54 +04:00
|
|
|
nsNntpIncomingServer *server = new nsNntpIncomingServer();
|
|
|
|
if (server)
|
|
|
|
rv = server->QueryInterface(aIID, aResult);
|
|
|
|
else
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv) && server)
|
|
|
|
delete server;
|
1999-04-21 22:58:29 +04:00
|
|
|
}
|
1999-04-25 00:46:07 +04:00
|
|
|
else if (mClassID.Equals(kNewsMessageResourceCID))
|
|
|
|
{
|
1999-05-06 04:18:24 +04:00
|
|
|
nsNewsMessage *message = new nsNewsMessage();
|
|
|
|
if (message)
|
|
|
|
rv = message->QueryInterface(aIID, aResult);
|
|
|
|
else
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv) && message)
|
|
|
|
delete message;
|
1999-04-25 00:46:07 +04:00
|
|
|
}
|
1999-04-21 22:58:29 +04:00
|
|
|
else
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
|
1999-04-20 23:08:10 +04:00
|
|
|
return rv;
|
1999-03-24 05:31:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsMsgNewsFactory::LockFactory(PRBool aLock)
|
|
|
|
{
|
|
|
|
if (aLock)
|
|
|
|
PR_AtomicIncrement(&g_LockCount);
|
|
|
|
else
|
|
|
|
PR_AtomicDecrement(&g_LockCount);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// return the proper factory to the caller.
|
1999-05-06 04:18:24 +04:00
|
|
|
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* /* aServMgr */,
|
1999-03-24 05:31:49 +03:00
|
|
|
const nsCID &aClass,
|
|
|
|
const char *aClassName,
|
|
|
|
const char *aProgID,
|
|
|
|
nsIFactory **aFactory)
|
|
|
|
{
|
|
|
|
if (nsnull == aFactory)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
1999-05-06 04:18:24 +04:00
|
|
|
*aFactory = new nsMsgNewsFactory(aClass, aClassName, aProgID);
|
1999-03-24 05:31:49 +03:00
|
|
|
if (aFactory)
|
|
|
|
return (*aFactory)->QueryInterface(nsIFactory::GetIID(),(void**)aFactory);
|
|
|
|
else
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
1999-05-06 04:18:24 +04:00
|
|
|
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* /* aServMgr */)
|
1999-03-24 05:31:49 +03:00
|
|
|
{
|
|
|
|
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
extern "C" NS_EXPORT nsresult
|
|
|
|
NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
|
|
|
{
|
1999-06-05 03:37:16 +04:00
|
|
|
nsresult rv = NS_OK;
|
1999-03-24 05:31:49 +03:00
|
|
|
|
1999-06-10 09:39:09 +04:00
|
|
|
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
1999-06-09 10:40:48 +04:00
|
|
|
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
1999-03-24 05:31:49 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 22:09:54 +04:00
|
|
|
|
|
|
|
rv = compMgr->RegisterComponent(kNntpUrlCID,
|
|
|
|
"NNTP Url",
|
|
|
|
"component://netscape/messenger/nntpurl",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-03-24 05:31:49 +03:00
|
|
|
|
1999-05-04 06:56:33 +04:00
|
|
|
rv = compMgr->RegisterComponent(kNntpServiceCID, "NNTP Service",
|
1999-04-21 22:58:29 +04:00
|
|
|
"component://netscape/messenger/nntpservice",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-03-25 07:47:12 +03:00
|
|
|
|
1999-05-04 06:56:33 +04:00
|
|
|
rv = compMgr->RegisterComponent(kNntpServiceCID, "NNTP News Service",
|
|
|
|
"component://netscape/messenger/messageservice;type=news",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-04-21 22:58:29 +04:00
|
|
|
|
1999-05-04 06:56:33 +04:00
|
|
|
rv = compMgr->RegisterComponent(kNntpServiceCID, "NNTP News Message Service",
|
|
|
|
"component://netscape/messenger/messageservice;type=news_message",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-05-04 06:56:33 +04:00
|
|
|
|
1999-04-21 22:58:29 +04:00
|
|
|
rv = compMgr->RegisterComponent(kNewsFolderResourceCID,
|
1999-04-20 23:08:10 +04:00
|
|
|
"News Folder Resource Factory",
|
|
|
|
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "news",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 06:24:08 +04:00
|
|
|
|
1999-04-25 00:46:07 +04:00
|
|
|
|
|
|
|
rv = compMgr->RegisterComponent(kNewsMessageResourceCID,
|
|
|
|
"News Resource Factory",
|
|
|
|
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "news_message",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-04-25 00:46:07 +04:00
|
|
|
|
1999-04-21 22:58:29 +04:00
|
|
|
rv = compMgr->RegisterComponent(kNntpIncomingServerCID,
|
|
|
|
"Nntp Incoming Server",
|
|
|
|
"component://netscape/messenger/server&type=nntp",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-04-20 23:08:10 +04:00
|
|
|
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 06:24:08 +04:00
|
|
|
|
|
|
|
rv = compMgr->RegisterComponent(kNNTPNewsgroupCID,
|
|
|
|
"NNTP Newsgroup",
|
|
|
|
"component://netscape/messeneger/nntpnewsgroup",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 06:24:08 +04:00
|
|
|
|
|
|
|
rv = compMgr->RegisterComponent(kNNTPNewsgroupPostCID,
|
|
|
|
"NNTP Newsgroup Post",
|
|
|
|
"component://netscape/messeneger/nntpnewsgrouppost",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 06:24:08 +04:00
|
|
|
|
|
|
|
rv = compMgr->RegisterComponent(kNNTPNewsgroupListCID,
|
|
|
|
"NNTP Newsgroup List",
|
|
|
|
"component://netscape/messeneger/nntpnewsgrouplist",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 06:24:08 +04:00
|
|
|
|
|
|
|
rv = compMgr->RegisterComponent(kNNTPArticleListCID,
|
|
|
|
"NNTP Article List",
|
|
|
|
"component://netscape/messeneger/nntparticlelist",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 06:24:08 +04:00
|
|
|
|
1999-06-03 22:09:54 +04:00
|
|
|
rv = compMgr->RegisterComponent(kNNTPHostCID,
|
|
|
|
"NNTP Host",
|
|
|
|
"component://netscape/messeneger/nntphost",
|
|
|
|
path, PR_TRUE, PR_TRUE);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 22:09:54 +04:00
|
|
|
|
1999-06-05 03:37:16 +04:00
|
|
|
return NS_OK;
|
1999-03-24 05:31:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" NS_EXPORT nsresult
|
|
|
|
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
|
|
|
{
|
1999-06-05 03:37:16 +04:00
|
|
|
nsresult rv = NS_OK;
|
1999-03-24 05:31:49 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
1999-06-05 03:37:16 +04:00
|
|
|
NS_WITH_SERVICE(nsIComponentManager,compMgr,kComponentManagerCID,&rv);
|
1999-03-24 05:31:49 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
rv = compMgr->UnregisterComponent(kNntpUrlCID, path);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-03-25 07:47:12 +03:00
|
|
|
|
|
|
|
rv = compMgr->UnregisterComponent(kNntpServiceCID, path);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-03-25 07:47:12 +03:00
|
|
|
|
1999-04-21 22:58:29 +04:00
|
|
|
rv = compMgr->UnregisterComponent(kNewsFolderResourceCID, path);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-04-20 23:08:10 +04:00
|
|
|
|
1999-04-21 22:58:29 +04:00
|
|
|
rv = compMgr->UnregisterComponent(kNntpIncomingServerCID, path);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-04-20 23:08:10 +04:00
|
|
|
|
1999-04-25 00:46:07 +04:00
|
|
|
rv = compMgr->UnregisterComponent(kNewsMessageResourceCID, path);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-04-25 00:46:07 +04:00
|
|
|
|
1999-06-03 06:24:08 +04:00
|
|
|
rv = compMgr->UnregisterComponent(kNNTPNewsgroupCID, path);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 06:24:08 +04:00
|
|
|
|
|
|
|
rv = compMgr->UnregisterComponent(kNNTPNewsgroupPostCID, path);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 06:24:08 +04:00
|
|
|
|
|
|
|
rv = compMgr->UnregisterComponent(kNNTPNewsgroupListCID, path);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 06:24:08 +04:00
|
|
|
|
1999-06-03 22:09:54 +04:00
|
|
|
rv = compMgr->UnregisterComponent(kNNTPArticleListCID, path);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 22:09:54 +04:00
|
|
|
|
|
|
|
rv = compMgr->UnregisterComponent(kNNTPHostCID, path);
|
1999-06-05 03:37:16 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-03 22:09:54 +04:00
|
|
|
|
1999-06-05 03:37:16 +04:00
|
|
|
return NS_OK;
|
1999-03-24 05:31:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|