зеркало из https://github.com/mozilla/pjs.git
Родитель
7f974309d9
Коммит
c6eef943a5
|
@ -23,66 +23,128 @@
|
|||
#include "nsIFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
//
|
||||
// nsAddressBook
|
||||
//
|
||||
#define NS_ADDRESSBOOK_PROGID \
|
||||
"component://netscape/addressbook"
|
||||
|
||||
#define NS_ADDRESSBOOK_CID \
|
||||
{ /* {D60B84F2-2A8C-11d3-9E07-00A0C92B5F0D} */ \
|
||||
0xd60b84f2, 0x2a8c, 0x11d3, \
|
||||
{ 0x9e, 0x7, 0x0, 0xa0, 0xc9, 0x2b, 0x5f, 0xd } \
|
||||
}
|
||||
|
||||
//
|
||||
// nsAbDirectoryDataSource
|
||||
//
|
||||
#define NS_ABDIRECTORYDATASOURCE_PROGID \
|
||||
NS_RDF_DATASOURCE_PROGID_PREFIX "addressdirectory"
|
||||
|
||||
#define NS_ABDIRECTORYDATASOURCE_CID \
|
||||
{ /* 0A79186D-F754-11d2-A2DA-001083003D0C */ \
|
||||
0xa79186d, 0xf754, 0x11d2, \
|
||||
{0xa2, 0xda, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
|
||||
}
|
||||
|
||||
#define NS_ABDIRECTORYRESOURCE_CID \
|
||||
//
|
||||
// nsAbDirectory
|
||||
//
|
||||
#define NS_ABDIRECTORY_PROGID \
|
||||
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "abdirectory"
|
||||
|
||||
#define NS_ABDIRECTORY_CID \
|
||||
{ /* {6C21831D-FCC2-11d2-A2E2-001083003D0C}*/ \
|
||||
0x6c21831d, 0xfcc2, 0x11d2, \
|
||||
{0xa2, 0xe2, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
|
||||
}
|
||||
|
||||
//
|
||||
// nsAbCardDataSource
|
||||
//
|
||||
#define NS_ABCARDDATASOURCE_PROGID \
|
||||
NS_RDF_DATASOURCE_PROGID_PREFIX "addresscard"
|
||||
|
||||
#define NS_ABCARDDATASOURCE_CID \
|
||||
{ /* 1920E486-0709-11d3-A2EC-001083003D0C */ \
|
||||
0x1920e486, 0x709, 0x11d3, \
|
||||
{0xa2, 0xec, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
|
||||
}
|
||||
|
||||
#define NS_ABCARDRESOURCE_CID \
|
||||
//
|
||||
// nsAbCard
|
||||
//
|
||||
#define NS_ABCARD_PROGID \
|
||||
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "abcard"
|
||||
|
||||
#define NS_ABCARD_CID \
|
||||
{ /* {1920E487-0709-11d3-A2EC-001083003D0C}*/ \
|
||||
0x1920e487, 0x709, 0x11d3, \
|
||||
{0xa2, 0xec, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
|
||||
}
|
||||
|
||||
#define NS_ADDRESSBOOKDB_CID \
|
||||
//
|
||||
// nsAddressBookDB
|
||||
//
|
||||
#define NS_ADDRDATABASE_PROGID \
|
||||
"component://netscape/addressbook/carddatabase"
|
||||
|
||||
#define NS_ADDRDATABASE_CID \
|
||||
{ /* 63187917-1D19-11d3-A302-001083003D0C */ \
|
||||
0x63187917, 0x1d19, 0x11d3, \
|
||||
{0xa3, 0x2, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
|
||||
}
|
||||
|
||||
//
|
||||
// nsAbCardProperty
|
||||
//
|
||||
#define NS_ABCARDPROPERTY_PROGID \
|
||||
"component://netscape/addressbook/cardproperty"
|
||||
#define NS_ABCARDPROPERTY_CID \
|
||||
{ /* 2B722171-2CEA-11d3-9E0B-00A0C92B5F0D */ \
|
||||
0x2b722171, 0x2cea, 0x11d3, \
|
||||
{0x9e, 0xb, 0x0, 0xa0, 0xc9, 0x2b, 0x5f, 0xd} \
|
||||
}
|
||||
|
||||
//
|
||||
// nsAddrBookSession
|
||||
//
|
||||
#define NS_ADDRBOOKSESSION_PROGID \
|
||||
"component://netscape/addressbook/services/session"
|
||||
|
||||
#define NS_ADDRBOOKSESSION_CID \
|
||||
{ /* C5339442-303F-11d3-9E13-00A0C92B5F0D */ \
|
||||
0xc5339442, 0x303f, 0x11d3, \
|
||||
{0x9e, 0x13, 0x0, 0xa0, 0xc9, 0x2b, 0x5f, 0xd} \
|
||||
}
|
||||
|
||||
//
|
||||
// nsAbDirProperty
|
||||
//
|
||||
#define NS_ABDIRPROPERTY_PROGID \
|
||||
"component://netscape/addressbook/directoryproperty"
|
||||
#define NS_ABDIRPROPERTY_CID \
|
||||
{ /* 6FD8EC67-3965-11d3-A316-001083003D0C */ \
|
||||
0x6fd8ec67, 0x3965, 0x11d3, \
|
||||
{0xa3, 0x16, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
|
||||
}
|
||||
|
||||
//
|
||||
// nsAbAutoCompleteSession
|
||||
//
|
||||
#define NS_ABAUTOCOMPLETESESSION_PROGID \
|
||||
"component://netscape/messenger/autocomplete&type=addrbook"
|
||||
#define NS_ABAUTOCOMPLETESESSION_CID \
|
||||
{ /* 138DE9BD-362B-11d3-988E-001083010E9B */ \
|
||||
0x138de9bd, 0x362b, 0x11d3, \
|
||||
{0x98, 0x8e, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b} \
|
||||
}
|
||||
|
||||
//
|
||||
// nsAbAddressCollecter
|
||||
//
|
||||
#define NS_ABADDRESSCOLLECTER_PROGID \
|
||||
"component://netscape/addressbook/services/addressCollecter"
|
||||
#define NS_ABADDRESSCOLLECTER_CID \
|
||||
{ /* fe04c8e6-501e-11d3-a527-0060b0fc04b7 */ \
|
||||
0xfe04c8e6, 0x501e, 0x11d3, \
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIModule.h"
|
||||
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "pratom.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
@ -40,387 +43,41 @@
|
|||
#include "nsAbAutoCompleteSession.h"
|
||||
#include "nsAbAddressCollecter.h"
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddressBook)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAbDirectoryDataSource,Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirectory)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAbCardDataSource,Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbCard)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbCardProperty)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddrDatabase)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirProperty)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddrBookSession)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbAutoCompleteSession)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbAddressCollecter)
|
||||
|
||||
struct components_t {
|
||||
nsCID cid;
|
||||
nsIGenericFactory::ConstructorProcPtr constructor;
|
||||
const char *progid;
|
||||
const char *description;
|
||||
};
|
||||
|
||||
static NS_DEFINE_CID(kAddressBookCID, NS_ADDRESSBOOK_CID);
|
||||
static NS_DEFINE_CID(kAbDirectoryDataSourceCID, NS_ABDIRECTORYDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kAbDirectoryCID, NS_ABDIRECTORYRESOURCE_CID);
|
||||
static NS_DEFINE_CID(kAbCardDataSourceCID, NS_ABCARDDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kAbCardCID, NS_ABCARDRESOURCE_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kAbCardPropertyCID, NS_ABCARDPROPERTY_CID);
|
||||
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
|
||||
static NS_DEFINE_CID(kAbDirPropertyCID, NS_ABDIRPROPERTY_CID);
|
||||
static NS_DEFINE_CID(kAbAutoCompleteSessionCID ,NS_ABAUTOCOMPLETESESSION_CID);
|
||||
|
||||
static NS_DEFINE_CID(kAbAddressCollecterCID, NS_ABADDRESSCOLLECTER_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
static PRInt32 g_InstanceCount = 0;
|
||||
static PRInt32 g_LockCount = 0;
|
||||
|
||||
class nsAbFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsAbFactory(const nsCID &aClass, const char* aClassName, const char* aProgID);
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult);
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~nsAbFactory();
|
||||
|
||||
nsCID mClassID;
|
||||
char* mClassName;
|
||||
char* mProgID;
|
||||
|
||||
// nsIServiceManager* mServiceManager;
|
||||
};
|
||||
|
||||
nsAbFactory::nsAbFactory(const nsCID &aClass, const char* aClassName, const char* aProgID)
|
||||
: mClassID(aClass), mClassName(nsCRT::strdup(aClassName)), mProgID(nsCRT::strdup(aProgID))
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
// store a copy of the
|
||||
// compMgrSupports->QueryInterface(nsIServiceManager::GetIID(),
|
||||
// (void **)&mServiceManager);
|
||||
}
|
||||
|
||||
nsAbFactory::~nsAbFactory()
|
||||
static components_t components[] =
|
||||
{
|
||||
// NS_IF_RELEASE(mServiceManager);
|
||||
PL_strfree(mClassName);
|
||||
PL_strfree(mProgID);
|
||||
}
|
||||
{ NS_ADDRESSBOOK_CID, &nsAddressBookConstructor, NS_ADDRESSBOOK_PROGID, },
|
||||
{ NS_ABDIRECTORYDATASOURCE_CID, &nsAbDirectoryDataSourceConstructor, NS_ABDIRECTORYDATASOURCE_PROGID, },
|
||||
{ NS_ABDIRECTORY_CID, &nsAbDirectoryConstructor, NS_ABDIRECTORY_PROGID, },
|
||||
{ NS_ABCARDDATASOURCE_CID, &nsAbCardDataSourceConstructor, NS_ABCARDDATASOURCE_PROGID, },
|
||||
{ NS_ABCARD_CID, &nsAbCardConstructor, NS_ABCARD_PROGID, },
|
||||
{ NS_ADDRDATABASE_CID, &nsAddrDatabaseConstructor, NS_ADDRDATABASE_PROGID, },
|
||||
{ NS_ABCARDPROPERTY_CID, &nsAbCardPropertyConstructor, NS_ABCARDPROPERTY_PROGID, },
|
||||
{ NS_ABDIRPROPERTY_CID, &nsAbDirPropertyConstructor, NS_ABDIRPROPERTY_PROGID, },
|
||||
{ NS_ADDRBOOKSESSION_CID, &nsAddrBookSessionConstructor, NS_ADDRBOOKSESSION_PROGID, },
|
||||
{ NS_ABAUTOCOMPLETESESSION_CID, &nsAbAutoCompleteSessionConstructor, NS_ABAUTOCOMPLETESESSION_PROGID, },
|
||||
{ NS_ABADDRESSCOLLECTER_CID, &nsAbAddressCollecterConstructor, NS_ABADDRESSCOLLECTER_PROGID, },
|
||||
|
||||
nsresult nsAbFactory::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.....
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsCOMTypeInfo<nsIFactory>::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
||||
if (*aResult == NULL)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsAbFactory)
|
||||
NS_IMPL_RELEASE(nsAbFactory)
|
||||
|
||||
nsresult nsAbFactory::CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult)
|
||||
{
|
||||
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!!!
|
||||
|
||||
if (mClassID.Equals(kAddressBookCID))
|
||||
{
|
||||
nsresult rv;
|
||||
nsAddressBook * addressBook = new nsAddressBook();
|
||||
if (addressBook)
|
||||
rv = addressBook->QueryInterface(aIID, aResult);
|
||||
else
|
||||
rv = NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (NS_FAILED(rv) && addressBook)
|
||||
delete addressBook;
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kAbDirectoryDataSourceCID))
|
||||
{
|
||||
return NS_NewAbDirectoryDataSource(aIID, aResult);
|
||||
}
|
||||
else if (mClassID.Equals(kAbDirectoryCID))
|
||||
{
|
||||
nsresult rv;
|
||||
nsAbDirectory * directory = new nsAbDirectory();
|
||||
if (directory)
|
||||
rv = directory->QueryInterface(aIID, aResult);
|
||||
else
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv) && directory)
|
||||
delete directory;
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kAbCardDataSourceCID))
|
||||
{
|
||||
return NS_NewAbCardDataSource(aIID, aResult);
|
||||
}
|
||||
else if (mClassID.Equals(kAbCardCID))
|
||||
{
|
||||
nsresult rv;
|
||||
nsAbCard * card = new nsAbCard();
|
||||
if (card)
|
||||
rv = card->QueryInterface(aIID, aResult);
|
||||
else
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv) && card)
|
||||
delete card;
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kAddressBookDBCID))
|
||||
{
|
||||
nsresult rv;
|
||||
nsAddrDatabase * abDatabase = new nsAddrDatabase();
|
||||
if (abDatabase)
|
||||
rv = abDatabase->QueryInterface(aIID, aResult);
|
||||
else
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv) && abDatabase)
|
||||
delete abDatabase;
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kAbCardPropertyCID))
|
||||
{
|
||||
nsresult rv;
|
||||
nsAbCardProperty * abCardProperty = new nsAbCardProperty();
|
||||
if (abCardProperty)
|
||||
rv = abCardProperty->QueryInterface(aIID, aResult);
|
||||
else
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv) && abCardProperty)
|
||||
delete abCardProperty;
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kAbDirPropertyCID))
|
||||
{
|
||||
nsresult rv;
|
||||
nsAbDirProperty * abDirProperty = new nsAbDirProperty();
|
||||
if (abDirProperty)
|
||||
rv = abDirProperty->QueryInterface(aIID, aResult);
|
||||
else
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv) && abDirProperty)
|
||||
delete abDirProperty;
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kAddrBookSessionCID))
|
||||
{
|
||||
nsresult rv;
|
||||
nsAddrBookSession * abSession = new nsAddrBookSession();
|
||||
if (abSession)
|
||||
rv = abSession->QueryInterface(aIID, aResult);
|
||||
else
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv) && abSession)
|
||||
delete abSession;
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kAbAutoCompleteSessionCID))
|
||||
{
|
||||
return NS_NewAbAutoCompleteSession(aIID, aResult);
|
||||
}
|
||||
else if (mClassID.Equals(kAbAddressCollecterCID))
|
||||
{
|
||||
nsresult rv;
|
||||
nsAbAddressCollecter * abAddressCollecter = new nsAbAddressCollecter;
|
||||
if (abAddressCollecter)
|
||||
rv = abAddressCollecter->QueryInterface(aIID, aResult);
|
||||
else
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv) && abAddressCollecter)
|
||||
delete abAddressCollecter;
|
||||
return rv;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult nsAbFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock)
|
||||
PR_AtomicIncrement(&g_LockCount);
|
||||
else
|
||||
PR_AtomicDecrement(&g_LockCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// return the proper factory to the caller.
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aFactory = new nsAbFactory(aClass, aClassName, aProgID);
|
||||
|
||||
if (aFactory)
|
||||
return (*aFactory)->QueryInterface(nsCOMTypeInfo<nsIFactory>::GetIID(), (void**)aFactory); // they want a Factory Interface so give it to them
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* aServMgr)
|
||||
{
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsresult finalResult = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kAddressBookCID,
|
||||
"Address Book DOM interaction object",
|
||||
"component://netscape/addressbook",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
// register our RDF datasources:
|
||||
rv = compMgr->RegisterComponent(kAbDirectoryDataSourceCID,
|
||||
"Mail/News Address Book Directory Data Source",
|
||||
NS_RDF_DATASOURCE_PROGID_PREFIX "addressdirectory",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kAbDirectoryCID,
|
||||
"Mail/News Address Book Directory Factory",
|
||||
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "abdirectory",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kAbCardDataSourceCID,
|
||||
"Mail/News Address Book Card Data Source",
|
||||
NS_RDF_DATASOURCE_PROGID_PREFIX "addresscard",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kAbCardCID,
|
||||
"Mail/News Address Book Card Factory",
|
||||
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "abcard",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kAddressBookDBCID,
|
||||
"Mail/News Address Book Card Database",
|
||||
"component://netscape/addressbook/carddatabase",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv))finalResult = rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kAbCardPropertyCID,
|
||||
"Mail/News Address Book Card Property",
|
||||
"component://netscape/addressbook/cardproperty",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kAbDirPropertyCID,
|
||||
"Mail/News Address Book Directory Property",
|
||||
"component://netscape/addressbook/directoryproperty",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kAddrBookSessionCID,
|
||||
"Address Book Session",
|
||||
"component://netscape/addressbook/services/session",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kAbAutoCompleteSessionCID,
|
||||
"Address Book Auto Completion Session",
|
||||
"component://netscape/messenger/autocomplete&type=addrbook",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kAbAddressCollecterCID,
|
||||
"Address Collecter Service",
|
||||
"component://netscape/addressbook/services/addressCollecter",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsresult finalResult = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAddressBookCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAbDirectoryDataSourceCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAbDirectoryCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAbCardDataSourceCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAbCardCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAddressBookDBCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAbCardPropertyCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAbDirPropertyCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAddrBookSessionCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAbAutoCompleteSessionCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kAbAddressCollecterCID, path);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
return finalResult;
|
||||
}
|
||||
NS_IMPL_MODULE(components)
|
||||
NS_IMPL_NSGETMODULE(nsModule)
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
static NS_DEFINE_CID(kAbCardPropertyCID, NS_ABCARDPROPERTY_CID);
|
||||
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
|
||||
static NS_DEFINE_CID(kMsgHeaderParserCID, NS_MSGHEADERPARSER_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "nsAddrDatabase.h"
|
||||
#include "nsIAddrBookSession.h"
|
||||
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
|
||||
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
|
||||
static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID);
|
||||
static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
static NS_DEFINE_CID(kAbCardCID, NS_ABCARDRESOURCE_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kAbCardCID, NS_ABCARD_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
|
||||
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
|
||||
|
||||
nsAbDirProperty::nsAbDirProperty(void)
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
extern const char *kDirectoryDataSourceRoot;
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kAbCardCID, NS_ABCARDRESOURCE_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kAbCardCID, NS_ABCARD_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "nsIAddrBookSession.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
|
||||
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
|
||||
|
||||
/* The definition is nsAddressBook.cpp */
|
||||
|
|
|
@ -46,10 +46,10 @@
|
|||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
|
||||
static NS_DEFINE_CID(kAbDirectoryCID, NS_ABDIRECTORYRESOURCE_CID);
|
||||
static NS_DEFINE_CID(kAbDirectoryCID, NS_ABDIRECTORY_CID);
|
||||
static NS_DEFINE_CID(kAbCardPropertyCID, NS_ABCARDPROPERTY_CID);
|
||||
|
||||
|
||||
|
|
|
@ -466,7 +466,7 @@ nsresult DIR_ShutDown() /* FEs should call this when the app is shutting down.
|
|||
#include "nsIFileLocator.h"
|
||||
#include "nsFileLocations.h"
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
|
||||
|
||||
nsresult DIR_ContainsServer(DIR_Server* pServer, PRBool *hasDir)
|
||||
{
|
||||
|
@ -1079,7 +1079,7 @@ PRBool DIR_SetServerPosition(nsVoidArray *wholeList, DIR_Server *server, PRInt32
|
|||
|
||||
PRInt32 i, count, num;
|
||||
PRBool resort = PR_FALSE;
|
||||
DIR_Server *s;
|
||||
DIR_Server *s=nsnull;
|
||||
|
||||
switch (position) {
|
||||
case DIR_POS_APPEND:
|
||||
|
@ -1423,7 +1423,7 @@ PRBool DIR_RegisterNotificationCallback(DIR_NOTIFICATION_FN fn, PRUint32 flags,
|
|||
|
||||
PRBool DIR_DeregisterNotificationCallback(DIR_NOTIFICATION_FN fn, void *inst_data)
|
||||
{
|
||||
DIR_Callback *cb, *cbPrev;
|
||||
DIR_Callback *cb, *cbPrev=nsnull;
|
||||
|
||||
for (cb = dir_CallbackList; cb && cb->fn != fn && cb->data != inst_data; cb = cb->next)
|
||||
cbPrev = cb;
|
||||
|
|
|
@ -46,7 +46,7 @@ typedef struct _nsAbRDFNotification {
|
|||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
static NS_DEFINE_CID(kAbDirectoryDataSourceCID, NS_ABDIRECTORYDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kAbDirectoryCID, NS_ABDIRECTORYRESOURCE_CID);
|
||||
static NS_DEFINE_CID(kAbDirectoryCID, NS_ABDIRECTORY_CID);
|
||||
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
|
||||
|
||||
nsIRDFResource* nsAbDirectoryDataSource::kNC_Child = nsnull;
|
||||
|
@ -77,7 +77,6 @@ nsAbDirectoryDataSource::nsAbDirectoryDataSource():
|
|||
mInitialized(PR_FALSE),
|
||||
mRDFService(nsnull)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsAbDirectoryDataSource::~nsAbDirectoryDataSource (void)
|
||||
|
@ -178,7 +177,6 @@ NS_IMETHODIMP nsAbDirectoryDataSource::GetTarget(nsIRDFResource* source,
|
|||
nsIRDFNode** target)
|
||||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
|
||||
// we only have positive assertions in the mail data source.
|
||||
if (! tv)
|
||||
return NS_RDF_NO_VALUE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче