mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-12 15:02:11 +00:00
Add ability to create a message.
This commit is contained in:
parent
37b198a443
commit
fd958ea8cd
@ -26,6 +26,7 @@
|
||||
#include "pratom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsImapMailFolder.h"
|
||||
#include "nsImapMessage.h"
|
||||
|
||||
// include files for components this factory creates...
|
||||
#include "nsImapUrl.h"
|
||||
@ -38,6 +39,8 @@ static NS_DEFINE_CID(kCImapHostSessionList, NS_IIMAPHOSTSESSIONLIST_CID);
|
||||
static NS_DEFINE_CID(kCImapIncomingServer, NS_IMAPINCOMINGSERVER_CID);
|
||||
static NS_DEFINE_CID(kCImapService, NS_IMAPSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCImapResource, NS_IMAPRESOURCE_CID);
|
||||
static NS_DEFINE_CID(kCImapMessageResource, NS_IMAPMESSAGERESOURCE_CID);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -138,11 +141,14 @@ nsresult nsImapFactory::CreateInstance(nsISupports *aOuter, const nsIID &aIID, v
|
||||
{
|
||||
inst = NS_STATIC_CAST(nsIImapService *, new nsImapService());
|
||||
}
|
||||
else if (mClassID.Equals(kCImapMessageResource))
|
||||
{
|
||||
inst = NS_STATIC_CAST(nsIMessage*, new nsImapMessage());
|
||||
}
|
||||
else if (mClassID.Equals(kCImapResource))
|
||||
{
|
||||
inst = NS_STATIC_CAST(nsIMsgImapMailFolder *, new nsImapMailFolder());
|
||||
}
|
||||
|
||||
if (inst == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -226,6 +232,7 @@ NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
|
||||
// rv = compMgr->RegisterComponent(kImapServiceCID, nsnull,
|
||||
// "component://netscape/messenger/messageservice;type=imap_message",
|
||||
// path, PR_TRUE, PR_TRUE);
|
||||
@ -269,6 +276,9 @@ NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
||||
rv = compMgr->UnregisterFactory(kCImapService, path);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kCImapMessageResource, path);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = compMgr->UnregisterFactory(kCImapResource, path);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
|
@ -31,6 +31,12 @@
|
||||
{0x88, 0x0d, 0x00, 0x40, 0x05, 0x26, 0x30, 0x78} \
|
||||
}
|
||||
|
||||
#define NS_NEWSMESSAGERESOURCE_CID \
|
||||
{/* 2dae7f80-f104-11d2-973b-00805f916fd3 */ \
|
||||
0x2dae7f80, 0xf104, 0x11d2, \
|
||||
{0x97, 0x3b, 0x00, 0x80, 0x5f, 0x91, 0x6f, 0xd3} }
|
||||
|
||||
|
||||
#define NS_NNTPINCOMINGSERVER_CID \
|
||||
{ /* 6ff28d0a-f776-11d2-87ca-004005263078 */ \
|
||||
0x6ff28d0a, \
|
||||
|
@ -33,12 +33,14 @@
|
||||
#include "nsNntpUrl.h"
|
||||
#include "nsNntpService.h"
|
||||
#include "nsNntpIncomingServer.h"
|
||||
#include "nsNewsMessage.h"
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kNntpUrlCID, NS_NNTPURL_CID);
|
||||
static NS_DEFINE_CID(kNntpServiceCID, NS_NNTPSERVICE_CID);
|
||||
static NS_DEFINE_CID(kNewsFolderResourceCID, NS_NEWSFOLDERRESOURCE_CID);
|
||||
static NS_DEFINE_CID(kNntpIncomingServerCID, NS_NNTPINCOMINGSERVER_CID);
|
||||
static NS_DEFINE_CID(kNewsMessageResourceCID, NS_NEWSMESSAGERESOURCE_CID);
|
||||
|
||||
static PRInt32 g_InstanceCount = 0;
|
||||
static PRInt32 g_LockCount = 0;
|
||||
@ -152,6 +154,10 @@ nsresult nsMsgNewsFactory::CreateInstance(nsISupports *aOuter,
|
||||
{
|
||||
return NS_NewNntpIncomingServer(aIID, aResult);
|
||||
}
|
||||
else if (mClassID.Equals(kNewsMessageResourceCID))
|
||||
{
|
||||
inst = NS_STATIC_CAST(nsIMessage*, new nsNewsMessage());
|
||||
}
|
||||
else
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
@ -233,6 +239,13 @@ NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
||||
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "news",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = compMgr->RegisterComponent(kNewsMessageResourceCID,
|
||||
"News Resource Factory",
|
||||
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "news_message",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
printf("news registering from %s\n",path);
|
||||
#endif
|
||||
@ -273,6 +286,9 @@ NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
||||
rv = compMgr->UnregisterComponent(kNntpIncomingServerCID, path);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kNewsMessageResourceCID, path);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
done:
|
||||
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
|
||||
return rv;
|
||||
|
Loading…
x
Reference in New Issue
Block a user