Make command-line handlers work in nonstatic mail builds b=329021 r=Standard8

This commit is contained in:
neil%parkwaycc.co.uk 2008-01-21 23:47:56 +00:00
Родитель d2a905e4c0
Коммит dc4536cee9
4 изменённых файлов: 124 добавлений и 5 удалений

Просмотреть файл

@ -42,6 +42,7 @@
#include "nsAbBaseCID.h" #include "nsAbBaseCID.h"
#include "pratom.h" #include "pratom.h"
#include "nsICategoryManager.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "rdf.h" #include "rdf.h"
@ -155,6 +156,33 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbView)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgVCardService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgVCardService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDIFService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDIFService)
static NS_METHOD
RegisterCommandLineHandler(nsIComponentManager* compMgr, nsIFile* path,
const char *location, const char *type,
const nsModuleComponentInfo *info)
{
nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
NS_ENSURE_TRUE(catMan, NS_ERROR_FAILURE);
return catMan->AddCategoryEntry("command-line-handler", "m-addressbook",
NS_ABMANAGERSTARTUPHANDLER_CONTRACTID,
PR_TRUE, PR_TRUE, nsnull);
}
static NS_METHOD
UnregisterCommandLineHandler(nsIComponentManager* compMgr, nsIFile* path,
const char *location,
const nsModuleComponentInfo *info)
{
nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
NS_ENSURE_TRUE(catMan, NS_ERROR_FAILURE);
catMan->DeleteCategoryEntry("command-line-handler", "m-addressbook",
PR_TRUE);
return NS_OK;
}
static const nsModuleComponentInfo components[] = static const nsModuleComponentInfo components[] =
{ {
{ "Address Book Manager", { "Address Book Manager",
@ -165,7 +193,9 @@ static const nsModuleComponentInfo components[] =
{ "Address Book Manager Startup Handler", { "Address Book Manager Startup Handler",
NS_ABMANAGER_CID, NS_ABMANAGER_CID,
NS_ABMANAGERSTARTUPHANDLER_CONTRACTID, NS_ABMANAGERSTARTUPHANDLER_CONTRACTID,
nsAbManagerConstructor }, nsAbManagerConstructor,
RegisterCommandLineHandler,
UnregisterCommandLineHandler },
{ "Address Book Directory Datasource", { "Address Book Directory Datasource",
NS_ABDIRECTORYDATASOURCE_CID, NS_ABDIRECTORYDATASOURCE_CID,

Просмотреть файл

@ -45,8 +45,8 @@
#include "nsIGenericFactory.h" #include "nsIGenericFactory.h"
#include "nsMsgBaseCID.h" #include "nsMsgBaseCID.h"
#include "pratom.h" #include "pratom.h"
#include "nsIComponentManager.h"
#include "nsICategoryManager.h" #include "nsICategoryManager.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "rdf.h" #include "rdf.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
@ -222,6 +222,33 @@ UnregisterMailnewsContentPolicy(nsIComponentManager *aCompMgr, nsIFile *aPath,
PR_TRUE); PR_TRUE);
} }
static NS_METHOD
RegisterCommandLineHandler(nsIComponentManager* compMgr, nsIFile* path,
const char *location, const char *type,
const nsModuleComponentInfo *info)
{
nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
NS_ENSURE_TRUE(catMan, NS_ERROR_FAILURE);
return catMan->AddCategoryEntry("command-line-handler", "m-mail",
NS_MAILSTARTUPHANDLER_CONTRACTID,
PR_TRUE, PR_TRUE, nsnull);
}
static NS_METHOD
UnregisterCommandLineHandler(nsIComponentManager* compMgr, nsIFile* path,
const char *location,
const nsModuleComponentInfo *info)
{
nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
NS_ENSURE_TRUE(catMan, NS_ERROR_FAILURE);
catMan->DeleteCategoryEntry("command-line-handler", "m-mail",
PR_TRUE);
return NS_OK;
}
// The list of components we register // The list of components we register
static const nsModuleComponentInfo gComponents[] = { static const nsModuleComponentInfo gComponents[] = {
@ -235,7 +262,9 @@ static const nsModuleComponentInfo gComponents[] = {
}, },
{ "Mail Startup Handler", NS_MESSENGERBOOTSTRAP_CID, { "Mail Startup Handler", NS_MESSENGERBOOTSTRAP_CID,
NS_MAILSTARTUPHANDLER_CONTRACTID, NS_MAILSTARTUPHANDLER_CONTRACTID,
nsMessengerBootstrapConstructor nsMessengerBootstrapConstructor,
RegisterCommandLineHandler,
UnregisterCommandLineHandler,
}, },
{ "UrlListenerManager", NS_URLLISTENERMANAGER_CID, { "UrlListenerManager", NS_URLLISTENERMANAGER_CID,
NS_URLLISTENERMANAGER_CONTRACTID, NS_URLLISTENERMANAGER_CONTRACTID,

Просмотреть файл

@ -41,6 +41,7 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIFactory.h" #include "nsIFactory.h"
#include "nsICategoryManager.h"
#include "nsIGenericFactory.h" #include "nsIGenericFactory.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsIModule.h" #include "nsIModule.h"
@ -90,6 +91,33 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsSmtpDelegateFactory)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsURLFetcher) NS_GENERIC_FACTORY_CONSTRUCTOR(nsURLFetcher)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgCompUtils) NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgCompUtils)
static NS_METHOD
RegisterCommandLineHandler(nsIComponentManager* compMgr, nsIFile* path,
const char *location, const char *type,
const nsModuleComponentInfo *info)
{
nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
NS_ENSURE_TRUE(catMan, NS_ERROR_FAILURE);
return catMan->AddCategoryEntry("command-line-handler", "m-compose",
NS_MSGCOMPOSESTARTUPHANDLER_CONTRACTID,
PR_TRUE, PR_TRUE, nsnull);
}
static NS_METHOD
UnregisterCommandLineHandler(nsIComponentManager* compMgr, nsIFile* path,
const char *location,
const nsModuleComponentInfo *info)
{
nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
NS_ENSURE_TRUE(catMan, NS_ERROR_FAILURE);
catMan->DeleteCategoryEntry("command-line-handler", "m-compose",
PR_TRUE);
return NS_OK;
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// //
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -107,7 +135,9 @@ static const nsModuleComponentInfo components[] =
{ "Msg Compose Startup Handler", { "Msg Compose Startup Handler",
NS_MSGCOMPOSESERVICE_CID, NS_MSGCOMPOSESERVICE_CID,
NS_MSGCOMPOSESTARTUPHANDLER_CONTRACTID, NS_MSGCOMPOSESTARTUPHANDLER_CONTRACTID,
nsMsgComposeServiceConstructor }, nsMsgComposeServiceConstructor,
RegisterCommandLineHandler,
UnregisterCommandLineHandler },
{ "mailto content handler", { "mailto content handler",
NS_MSGCOMPOSECONTENTHANDLER_CID, NS_MSGCOMPOSECONTENTHANDLER_CID,
NS_MSGCOMPOSECONTENTHANDLER_CONTRACTID, NS_MSGCOMPOSECONTENTHANDLER_CONTRACTID,

Просмотреть файл

@ -42,6 +42,7 @@
#include "msgCore.h" #include "msgCore.h"
#include "pratom.h" #include "pratom.h"
#include "nsICategoryManager.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
@ -68,6 +69,33 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsNNTPNewsgroupList)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgNewsFolder) NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgNewsFolder)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNewsDownloadDialogArgs) NS_GENERIC_FACTORY_CONSTRUCTOR(nsNewsDownloadDialogArgs)
static NS_METHOD
RegisterCommandLineHandler(nsIComponentManager* compMgr, nsIFile* path,
const char *location, const char *type,
const nsModuleComponentInfo *info)
{
nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
NS_ENSURE_TRUE(catMan, NS_ERROR_FAILURE);
return catMan->AddCategoryEntry("command-line-handler", "m-news",
NS_NEWSSTARTUPHANDLER_CONTRACTID,
PR_TRUE, PR_TRUE, nsnull);
}
static NS_METHOD
UnregisterCommandLineHandler(nsIComponentManager* compMgr, nsIFile* path,
const char *location,
const nsModuleComponentInfo *info)
{
nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
NS_ENSURE_TRUE(catMan, NS_ERROR_FAILURE);
catMan->DeleteCategoryEntry("command-line-handler", "m-news",
PR_TRUE);
return NS_OK;
}
static const nsModuleComponentInfo components[] = static const nsModuleComponentInfo components[] =
{ {
{ "NNTP URL", { "NNTP URL",
@ -81,7 +109,9 @@ static const nsModuleComponentInfo components[] =
{ "News Startup Handler", { "News Startup Handler",
NS_NNTPSERVICE_CID, NS_NNTPSERVICE_CID,
NS_NEWSSTARTUPHANDLER_CONTRACTID, NS_NEWSSTARTUPHANDLER_CONTRACTID,
nsNntpServiceConstructor }, nsNntpServiceConstructor,
RegisterCommandLineHandler,
UnregisterCommandLineHandler },
{ "NNTP Protocol Info", { "NNTP Protocol Info",
NS_NNTPSERVICE_CID, NS_NNTPSERVICE_CID,
NS_NNTPPROTOCOLINFO_CONTRACTID, NS_NNTPPROTOCOLINFO_CONTRACTID,