From 5d9639ccc0cc923b7cdc326f57eb4cf11267b763 Mon Sep 17 00:00:00 2001 From: "putterman%netscape.com" Date: Sat, 24 Apr 1999 20:44:40 +0000 Subject: [PATCH] Added ability to create a message. --- mailnews/local/build/nsMsgLocalCID.h | 6 ++++++ mailnews/local/build/nsMsgLocalFactory.cpp | 24 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/mailnews/local/build/nsMsgLocalCID.h b/mailnews/local/build/nsMsgLocalCID.h index 524047d2c703..68cfed89baf7 100644 --- a/mailnews/local/build/nsMsgLocalCID.h +++ b/mailnews/local/build/nsMsgLocalCID.h @@ -36,4 +36,10 @@ 0xd2876e51, 0xe62c, 0x11d2, \ {0xb7, 0xfc, 0x0, 0x80, 0x5f, 0x5, 0xff, 0xa5 }} + +#define NS_MAILBOXMESSAGERESOURCE_CID \ +{ /* b0908e06-dc06-11d2-8a46-0060b0fc04d2*/ \ +0xb0908e06,0xdc06, 0x11d2, \ +{0x8a, 0x46, 0x00, 0x60, 0xb0, 0xfc, 0x4, 0xd2} } + #endif // nsMsgLocalCID_h__ diff --git a/mailnews/local/build/nsMsgLocalFactory.cpp b/mailnews/local/build/nsMsgLocalFactory.cpp index 28ce83091de5..920b3579e824 100644 --- a/mailnews/local/build/nsMsgLocalFactory.cpp +++ b/mailnews/local/build/nsMsgLocalFactory.cpp @@ -32,12 +32,14 @@ #include "nsPop3Service.h" #include "nsPop3IncomingServer.h" #include "nsCOMPtr.h" +#include "nsLocalMessage.h" static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); static NS_DEFINE_CID(kMailboxUrlCID, NS_MAILBOXURL_CID); static NS_DEFINE_CID(kMailboxParserCID, NS_MAILBOXPARSER_CID); static NS_DEFINE_CID(kMailboxServiceCID, NS_MAILBOXSERVICE_CID); static NS_DEFINE_CID(kLocalMailFolderResourceCID, NS_LOCALMAILFOLDERRESOURCE_CID); +static NS_DEFINE_CID(kMailboxMessageResourceCID, NS_MAILBOXMESSAGERESOURCE_CID); static NS_DEFINE_CID(kPop3ServiceCID, NS_POP3SERVICE_CID); static NS_DEFINE_CID(kPop3UrlCID, NS_POP3URL_CID); static NS_DEFINE_CID(kPop3IncomingServerCID, NS_POP3INCOMINGSERVER_CID); @@ -183,7 +185,18 @@ nsresult nsMsgLocalFactory::CreateInstance(nsISupports *aOuter, const nsIID &aII if (NS_FAILED(rv) && localFolder) delete localFolder; - } + } + else if (mClassID.Equals(kMailboxMessageResourceCID)) + { + nsLocalMessage * localMessage = new nsLocalMessage(); + if (localMessage) + rv = localMessage->QueryInterface(aIID, aResult); + else + rv = NS_ERROR_OUT_OF_MEMORY; + + if (NS_FAILED(rv) && localMessage) + delete localMessage; + } else if (mClassID.Equals(kPop3IncomingServerCID)) rv = NS_NewPop3IncomingServer(nsISupports::GetIID(), aResult); else @@ -281,6 +294,12 @@ NSRegisterSelf(nsISupports* aServMgr, const char* path) path, PR_TRUE, PR_TRUE); if (NS_FAILED(rv)) goto done; + rv = compMgr->RegisterComponent(kMailboxMessageResourceCID, + "Local Message Resource Factory", + NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "mailbox_message", + path, PR_TRUE, PR_TRUE); + if (NS_FAILED(rv)) goto done; + rv = compMgr->RegisterComponent(kPop3IncomingServerCID, "Pop3 Incoming Server", "component://netscape/messenger/server&type=pop3", @@ -325,6 +344,9 @@ NSUnregisterSelf(nsISupports* aServMgr, const char* path) rv = compMgr->UnregisterComponent(kLocalMailFolderResourceCID, path); if (NS_FAILED(rv)) goto done; + rv = compMgr->UnregisterComponent(kMailboxMessageResourceCID, path); + if (NS_FAILED(rv)) goto done; + rv = compMgr->UnregisterComponent(kPop3IncomingServerCID, path); if (NS_FAILED(rv)) goto done;