Bug 1614265 - Remove old nsAbManager implementation. r=mkmelin
Differential Revision: https://phabricator.services.mozilla.com/D62394 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
781a1e03d5
Коммит
8434c4f284
|
@ -940,14 +940,6 @@ AddrBookDirectoryInner.prototype = {
|
|||
copyMailList(srcList) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
createNewDirectory(dirName, uri, type, prefName) {
|
||||
// Deliberately not implemented, this isn't the root directory.
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
createDirectoryByURI(displayName, uri) {
|
||||
// Deliberately not implemented, this isn't the root directory.
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
getIntValue(name, defaultValue) {
|
||||
return this._prefBranch.getIntPref(name, defaultValue);
|
||||
},
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["AddrBookFactory"];
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"FileUtils",
|
||||
"resource://gre/modules/FileUtils.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"MailServices",
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"closeConnectionTo",
|
||||
"resource:///modules/AddrBookDirectory.jsm"
|
||||
);
|
||||
|
||||
/**
|
||||
* Address book factory. This looks like it should be a useful for keeping
|
||||
* reference to all JS directories, but in reality it's not used for most
|
||||
* methods of accessing a directory, and nsAbManager has a cache anyway.
|
||||
*
|
||||
* @implements {nsIAbDirFactory}
|
||||
*/
|
||||
function AddrBookFactory() {}
|
||||
AddrBookFactory.prototype = {
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIAbDirFactory]),
|
||||
classID: Components.ID("{567c1f22-bae5-4bc9-9951-885678dc14a5}"),
|
||||
|
||||
/* nsIAbDirFactory */
|
||||
|
||||
getDirectories(dirName, uri, prefName) {
|
||||
let directory = MailServices.ab.getDirectory(uri);
|
||||
directory.dirPrefId = prefName;
|
||||
|
||||
return {
|
||||
_position: 0,
|
||||
hasMoreElements() {
|
||||
return this._position == 0;
|
||||
},
|
||||
getNext() {
|
||||
if (this.hasMoreElements()) {
|
||||
this._position++;
|
||||
return directory;
|
||||
}
|
||||
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),
|
||||
*[Symbol.iterator]() {
|
||||
while (this.hasMoreElements()) {
|
||||
yield this.getNext();
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
async deleteDirectory(directory) {
|
||||
let file = FileUtils.getFile("ProfD", [directory.fileName]);
|
||||
if (file.exists()) {
|
||||
await closeConnectionTo(file);
|
||||
file.remove(false);
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,10 +1,5 @@
|
|||
Classes = [
|
||||
{
|
||||
'cid': '{567c1f22-bae5-4bc9-9951-885678dc14a5}',
|
||||
'contract_ids': ['@mozilla.org/addressbook/directory-factory;1?name=jsaddrbook'],
|
||||
'jsm': 'resource:///modules/AddrBookFactory.jsm',
|
||||
'constructor': 'AddrBookFactory',
|
||||
}, {
|
||||
'cid': '{e96ee804-0bd3-472f-81a6-8a9d65277ad3}',
|
||||
'contract_ids': ['@mozilla.org/addressbook/directory;1?type=jsaddrbook'],
|
||||
'jsm': 'resource:///modules/AddrBookDirectory.jsm',
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
EXTRA_JS_MODULES += [
|
||||
'AddrBookCard.jsm',
|
||||
'AddrBookDirectory.jsm',
|
||||
'AddrBookFactory.jsm',
|
||||
'AddrBookMailingList.jsm',
|
||||
'AddrBookManager.jsm',
|
||||
'AddrBookUtils.jsm',
|
||||
|
|
|
@ -11,8 +11,6 @@ XPIDL_SOURCES += [
|
|||
'nsIAbDirectory.idl',
|
||||
'nsIAbDirectoryQuery.idl',
|
||||
'nsIAbDirectoryQueryProxy.idl',
|
||||
'nsIAbDirFactory.idl',
|
||||
'nsIAbDirFactoryService.idl',
|
||||
'nsIAbDirSearchListener.idl',
|
||||
'nsIAbLDAPAttributeMap.idl',
|
||||
'nsIAbLDIFService.idl',
|
||||
|
|
|
@ -27,16 +27,6 @@
|
|||
//
|
||||
#define NS_ABMANAGER_CONTRACTID "@mozilla.org/abmanager;1"
|
||||
|
||||
#define NS_ABMANAGERSTARTUPHANDLER_CONTRACTID \
|
||||
"@mozilla.org/commandlinehandler/general-startup;1?type=addressbook"
|
||||
|
||||
#define NS_ABMANAGER_CID \
|
||||
{ \
|
||||
0xad81b321, 0x8a8a, 0x42ca, { \
|
||||
0xa5, 0x08, 0xfe, 0x65, 0x9d, 0x8e, 0x45, 0x86 \
|
||||
} \
|
||||
}
|
||||
|
||||
//
|
||||
// nsAbContentHandler
|
||||
//
|
||||
|
@ -47,19 +37,6 @@
|
|||
} \
|
||||
}
|
||||
|
||||
//
|
||||
// nsAbBSDirectory - the root address book
|
||||
//
|
||||
#define NS_ABDIRECTORY_CONTRACTID \
|
||||
NS_AB_DIRECTORY_TYPE_CONTRACTID_PREFIX "moz-abdirectory"
|
||||
|
||||
#define NS_ABDIRECTORY_CID \
|
||||
{ \
|
||||
0x012D3C24, 0x1DD2, 0x11B2, { \
|
||||
0xBA, 0x79, 0xB4, 0xAD, 0x35, 0x9F, 0xC4, 0x61 \
|
||||
} \
|
||||
}
|
||||
|
||||
//
|
||||
// JS/SQLite address book
|
||||
//
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISimpleEnumerator.idl"
|
||||
|
||||
interface nsIAbDirectory;
|
||||
|
||||
[scriptable, uuid(ad61b4fc-d8d8-40b2-b924-4c10f28a8a17)]
|
||||
interface nsIAbDirFactory : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get a top level address book directory and sub directories, given some
|
||||
* properties.
|
||||
*
|
||||
* @param aDirName Name of the address book
|
||||
*
|
||||
* @param aURI URI of the address book
|
||||
*
|
||||
* @param aPrefName Pref name for the preferences of the address book
|
||||
*
|
||||
* @return Enumeration of nsIAbDirectory interfaces
|
||||
*/
|
||||
nsISimpleEnumerator getDirectories(in AString aDirName, in ACString aURI,
|
||||
in ACString aPrefName);
|
||||
|
||||
/**
|
||||
* Delete a top level address book directory
|
||||
*
|
||||
*/
|
||||
void deleteDirectory(in nsIAbDirectory directory);
|
||||
};
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIAbDirFactory;
|
||||
|
||||
[scriptable, uuid(154a951b-a310-400c-b98f-d769cc5d575f)]
|
||||
interface nsIAbDirFactoryService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Obtain a directory factory component given a uri representing an address
|
||||
* book. The scheme is extracted from the uri and contract id is generated
|
||||
* of the form:
|
||||
* @mozilla.org/addressbook/directory-factory;1?name=<scheme>
|
||||
*
|
||||
* This id is used to instantiate a registered component which implemented
|
||||
* the nsIAbDirFactory interface.
|
||||
*
|
||||
* @param aURI The uri which contains the scheme that defines what directory
|
||||
* factory instance is returned
|
||||
*/
|
||||
nsIAbDirFactory getDirFactory(in ACString aURI);
|
||||
};
|
||||
|
|
@ -316,25 +316,6 @@ interface nsIAbDirectory : nsISupports {
|
|||
// Copies mail list properties from the srcList
|
||||
void copyMailList(in nsIAbDirectory srcList);
|
||||
|
||||
/**
|
||||
* Only creates a top level address book
|
||||
* which is stored in the preferences
|
||||
*
|
||||
* Need to change to factory based approach
|
||||
* to create new address books
|
||||
*
|
||||
* This method should become redundant or
|
||||
* be only associated with card folders
|
||||
*
|
||||
* The parameters are the same as for
|
||||
* nsIAbManager::newAddressBook
|
||||
*/
|
||||
ACString createNewDirectory(in AString aDirName, in ACString aURI,
|
||||
in unsigned long aType, in ACString aPrefName);
|
||||
|
||||
/* create a directory by passing the display name and address book uri */
|
||||
void createDirectoryByURI(in AString displayName, in ACString aURI);
|
||||
|
||||
/**
|
||||
* The id of the directory used in prefs e.g. "ldap_2.servers.pab"
|
||||
* Setting this will cause directoryPrefs to be updated.
|
||||
|
|
|
@ -12,21 +12,17 @@ EXPORTS += [
|
|||
SOURCES += [
|
||||
'nsAbAddressCollector.cpp',
|
||||
'nsAbBooleanExpression.cpp',
|
||||
'nsAbBSDirectory.cpp',
|
||||
'nsAbCardProperty.cpp',
|
||||
'nsAbContentHandler.cpp',
|
||||
'nsAbDirectoryQuery.cpp',
|
||||
'nsAbDirectoryQueryProxy.cpp',
|
||||
'nsAbDirFactoryService.cpp',
|
||||
'nsAbDirProperty.cpp',
|
||||
'nsAbLDIFService.cpp',
|
||||
# 'nsAbManager.cpp',
|
||||
'nsAbQueryStringToExpression.cpp',
|
||||
'nsAbView.cpp',
|
||||
'nsAddbookProtocolHandler.cpp',
|
||||
'nsAddbookUrl.cpp',
|
||||
'nsAddrDatabase.cpp',
|
||||
'nsDirPrefs.cpp',
|
||||
'nsMsgVCardService.cpp',
|
||||
'nsVCard.cpp',
|
||||
'nsVCardObj.cpp',
|
||||
|
@ -35,17 +31,12 @@ SOURCES += [
|
|||
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MAPI_SUPPORT']:
|
||||
SOURCES += [
|
||||
'nsAbOutlookDirectory.cpp',
|
||||
'nsAbOutlookDirFactory.cpp',
|
||||
'nsAbWinHelper.cpp',
|
||||
'nsMapiAddressBook.cpp',
|
||||
'nsWabAddressBook.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'Darwin':
|
||||
SOURCES += [
|
||||
'nsAbOSXDirFactory.cpp',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'nsAbOSXCard.mm',
|
||||
'nsAbOSXDirectory.mm',
|
||||
|
@ -59,7 +50,6 @@ if CONFIG['MOZ_LDAP_XPCOM']:
|
|||
'nsAbLDAPDirectory.cpp',
|
||||
'nsAbLDAPDirectoryModify.cpp',
|
||||
'nsAbLDAPDirectoryQuery.cpp',
|
||||
'nsAbLDAPDirFactory.cpp',
|
||||
'nsAbLDAPListenerBase.cpp',
|
||||
'nsAbLDAPReplicationData.cpp',
|
||||
'nsAbLDAPReplicationQuery.cpp',
|
||||
|
|
|
@ -1,305 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsAbBSDirectory.h"
|
||||
|
||||
#include "nsDirPrefs.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsAddrDatabase.h"
|
||||
#include "nsIAbManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsAbDirFactoryService.h"
|
||||
#include "nsIAbDirFactory.h"
|
||||
#include "nsArrayEnumerator.h"
|
||||
|
||||
#include "nsCRTGlue.h"
|
||||
|
||||
nsAbBSDirectory::nsAbBSDirectory() : mInitialized(false), mServers(13) {}
|
||||
|
||||
nsAbBSDirectory::~nsAbBSDirectory() {}
|
||||
|
||||
NS_IMETHODIMP nsAbBSDirectory::Init(const char *aURI) {
|
||||
mURI = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsAbBSDirectory, nsAbDirProperty)
|
||||
|
||||
nsresult nsAbBSDirectory::CreateDirectoriesFromFactory(const nsACString &aURI,
|
||||
DIR_Server *aServer,
|
||||
bool aNotify) {
|
||||
nsresult rv;
|
||||
|
||||
// Get the directory factory service
|
||||
nsCOMPtr<nsIAbDirFactoryService> dirFactoryService =
|
||||
do_GetService(NS_ABDIRFACTORYSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Get the directory factory from the URI
|
||||
nsCOMPtr<nsIAbDirFactory> dirFactory;
|
||||
rv = dirFactoryService->GetDirFactory(aURI, getter_AddRefs(dirFactory));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Create the directories
|
||||
nsCOMPtr<nsISimpleEnumerator> newDirEnumerator;
|
||||
rv = dirFactory->GetDirectories(NS_ConvertUTF8toUTF16(aServer->description),
|
||||
aURI, nsDependentCString(aServer->prefName),
|
||||
getter_AddRefs(newDirEnumerator));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Enumerate through the directories adding them
|
||||
// to the sub directories array
|
||||
bool hasMore;
|
||||
nsCOMPtr<nsIAbManager> abManager =
|
||||
do_GetService(NS_ABMANAGER_CONTRACTID, &rv);
|
||||
|
||||
while (NS_SUCCEEDED(newDirEnumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> newDirSupports;
|
||||
rv = newDirEnumerator->GetNext(getter_AddRefs(newDirSupports));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
nsCOMPtr<nsIAbDirectory> childDir = do_QueryInterface(newDirSupports, &rv);
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
// In some cases (LDAP) the actual URI of the directory may differ from
|
||||
// aURI. Use the URI of the directory.
|
||||
nsCString uri;
|
||||
childDir->GetURI(uri);
|
||||
|
||||
// Define a relationship between the preference entry and the directory.
|
||||
mServers.Put(uri, aServer);
|
||||
|
||||
mSubDirectories.AppendObject(childDir);
|
||||
|
||||
if (aNotify && abManager)
|
||||
abManager->NotifyDirectoryItemAdded(this, childDir);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbBSDirectory::GetChildNodes(nsISimpleEnumerator **aResult) {
|
||||
nsresult rv = EnsureInitialized();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_NewArrayEnumerator(aResult, mSubDirectories,
|
||||
NS_GET_IID(nsIAbDirectory));
|
||||
}
|
||||
|
||||
nsresult nsAbBSDirectory::EnsureInitialized() {
|
||||
if (mInitialized) return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIAbDirFactoryService> dirFactoryService =
|
||||
do_GetService(NS_ABDIRFACTORYSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsTArray<DIR_Server *> *directories = DIR_GetDirectories();
|
||||
if (!directories) return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t count = directories->Length();
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
DIR_Server *server = directories->ElementAt(i);
|
||||
|
||||
// if this is a 4.x, local .na2 addressbook (PABDirectory)
|
||||
// we must skip it.
|
||||
// mozilla can't handle 4.x .na2 addressbooks
|
||||
// note, the filename might be na2 for 4.x LDAP directories
|
||||
// (we used the .na2 file for replication), and we don't want to skip
|
||||
// those. see bug #127007
|
||||
uint32_t fileNameLen = strlen(server->fileName);
|
||||
if (((fileNameLen > kABFileName_PreviousSuffixLen) &&
|
||||
strcmp(server->fileName + fileNameLen - kABFileName_PreviousSuffixLen,
|
||||
kABFileName_PreviousSuffix) == 0) &&
|
||||
(server->dirType == PABDirectory))
|
||||
continue;
|
||||
|
||||
// Set the uri property
|
||||
nsAutoCString URI(server->uri);
|
||||
|
||||
// Create the directories
|
||||
rv = CreateDirectoriesFromFactory(URI, server, false /* notify */);
|
||||
|
||||
// If we failed, this could be because something has set a pref for us
|
||||
// which is now broke (e.g. no factory present). So just ignore this one
|
||||
// and move on.
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("CreateDirectoriesFromFactory failed - Invalid factory?");
|
||||
}
|
||||
|
||||
mInitialized = true;
|
||||
// sort directories by position...
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbBSDirectory::CreateNewDirectory(const nsAString &aDirName,
|
||||
const nsACString &aURI,
|
||||
uint32_t aType,
|
||||
const nsACString &aPrefName,
|
||||
nsACString &aResult) {
|
||||
nsresult rv = EnsureInitialized();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
/*
|
||||
* TODO
|
||||
* This procedure is still MDB specific
|
||||
* due to the dependence on the current
|
||||
* nsDirPref.cpp code
|
||||
*/
|
||||
|
||||
nsCString URI(aURI);
|
||||
|
||||
/*
|
||||
* The creation of the address book in the preferences
|
||||
* is very MDB implementation specific.
|
||||
* If the fileName attribute is null then it will
|
||||
* create an appropriate file name.
|
||||
* Somehow have to resolve this issue so that it
|
||||
* is more general.
|
||||
*
|
||||
*/
|
||||
DIR_Server *server = nullptr;
|
||||
rv = DIR_AddNewAddressBook(aDirName, EmptyCString(), URI,
|
||||
(DirectoryType)aType, aPrefName, &server);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aType == JSDirectory) {
|
||||
URI.AssignLiteral(kJSDirectoryRoot);
|
||||
URI.Append(nsDependentCString(server->fileName));
|
||||
}
|
||||
|
||||
aResult.Assign(server->prefName);
|
||||
|
||||
rv = CreateDirectoriesFromFactory(URI, server, true /* notify */);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbBSDirectory::CreateDirectoryByURI(
|
||||
const nsAString &aDisplayName, const nsACString &aURI) {
|
||||
nsresult rv = EnsureInitialized();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
DIR_Server *server = nullptr;
|
||||
rv = DIR_AddNewAddressBook(aDisplayName, EmptyCString(), aURI, PABDirectory,
|
||||
EmptyCString(), &server);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = CreateDirectoriesFromFactory(aURI, server, true /* notify */);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbBSDirectory::DeleteDirectory(nsIAbDirectory *directory) {
|
||||
NS_ENSURE_ARG_POINTER(directory);
|
||||
|
||||
nsresult rv = EnsureInitialized();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCString uri;
|
||||
directory->GetURI(uri);
|
||||
|
||||
DIR_Server *server = nullptr;
|
||||
mServers.Get(uri, &server);
|
||||
|
||||
if (!server) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIAbManager> abManager =
|
||||
do_GetService(NS_ABMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> dirEnumerator;
|
||||
abManager->GetDirectories(getter_AddRefs(dirEnumerator));
|
||||
|
||||
nsCOMArray<nsIAbDirectory> directories;
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(dirEnumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> dirSupports;
|
||||
rv = dirEnumerator->GetNext(getter_AddRefs(dirSupports));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
nsCOMPtr<nsIAbDirectory> d = do_QueryInterface(dirSupports, &rv);
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
nsCString u;
|
||||
d->GetURI(u);
|
||||
|
||||
DIR_Server *s;
|
||||
mServers.Get(u, &s);
|
||||
|
||||
if (s && s == server) {
|
||||
if (d) {
|
||||
directories.AppendElement(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DIR_DeleteServerFromList(server);
|
||||
|
||||
nsCOMPtr<nsIAbDirFactoryService> dirFactoryService =
|
||||
do_GetService(NS_ABDIRFACTORYSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t count = directories.Count();
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsIAbDirectory> d = directories[i];
|
||||
|
||||
nsCString uri;
|
||||
rv = d->GetURI(uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mServers.Remove(uri);
|
||||
|
||||
for (uint32_t i = 0; i < mSubDirectories.Length(); ++i) {
|
||||
nsAutoCString u;
|
||||
mSubDirectories[i]->GetURI(u);
|
||||
if (u.Equals(uri)) {
|
||||
mSubDirectories.RemoveObjectsAt(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (abManager) abManager->NotifyDirectoryDeleted(this, d);
|
||||
|
||||
nsCOMPtr<nsIAbDirFactory> dirFactory;
|
||||
rv = dirFactoryService->GetDirFactory(uri, getter_AddRefs(dirFactory));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
rv = dirFactory->DeleteDirectory(d);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbBSDirectory::HasDirectory(nsIAbDirectory *dir, bool *hasDir) {
|
||||
if (!hasDir) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv = EnsureInitialized();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCString uri;
|
||||
dir->GetURI(uri);
|
||||
|
||||
DIR_Server *dirServer = nullptr;
|
||||
mServers.Get(uri, &dirServer);
|
||||
return DIR_ContainsServer(dirServer, hasDir);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbBSDirectory::UseForAutocomplete(
|
||||
const nsACString &aIdentityKey, bool *aResult) {
|
||||
// For the "root" directory (kAllDirectoryRoot) always return true so that
|
||||
// we can search sub directories that may or may not be local.
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbBSDirectory::GetURI(nsACString &aURI) {
|
||||
if (mURI.IsEmpty()) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
aURI = mURI;
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsAbBSDirectory_h__
|
||||
#define nsAbBSDirectory_h__
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsAbDirProperty.h"
|
||||
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
class nsAbBSDirectory : public nsAbDirProperty {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsAbBSDirectory();
|
||||
|
||||
// nsIAbDirectory methods
|
||||
NS_IMETHOD Init(const char *aURI) override;
|
||||
NS_IMETHOD GetChildNodes(nsISimpleEnumerator **result) override;
|
||||
NS_IMETHOD CreateNewDirectory(const nsAString &aDirName,
|
||||
const nsACString &aURI, uint32_t aType,
|
||||
const nsACString &aPrefName,
|
||||
nsACString &aResult) override;
|
||||
NS_IMETHOD CreateDirectoryByURI(const nsAString &aDisplayName,
|
||||
const nsACString &aURI) override;
|
||||
NS_IMETHOD DeleteDirectory(nsIAbDirectory *directory) override;
|
||||
NS_IMETHOD HasDirectory(nsIAbDirectory *dir, bool *hasDir) override;
|
||||
NS_IMETHOD UseForAutocomplete(const nsACString &aIdentityKey,
|
||||
bool *aResult) override;
|
||||
NS_IMETHOD GetURI(nsACString &aURI) override;
|
||||
|
||||
protected:
|
||||
virtual ~nsAbBSDirectory();
|
||||
nsresult EnsureInitialized();
|
||||
nsresult CreateDirectoriesFromFactory(const nsACString &aURI,
|
||||
DIR_Server *aServer, bool aNotify);
|
||||
|
||||
protected:
|
||||
bool mInitialized;
|
||||
nsCOMArray<nsIAbDirectory> mSubDirectories;
|
||||
nsDataHashtable<nsCStringHashKey, DIR_Server *> mServers;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,48 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsString.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsAbDirFactoryService.h"
|
||||
#include "nsIAbDirFactory.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsAbDirFactoryService, nsIAbDirFactoryService)
|
||||
|
||||
nsAbDirFactoryService::nsAbDirFactoryService() {}
|
||||
|
||||
nsAbDirFactoryService::~nsAbDirFactoryService() {}
|
||||
|
||||
/* nsIAbDirFactory getDirFactory (in string uri); */
|
||||
NS_IMETHODIMP
|
||||
nsAbDirFactoryService::GetDirFactory(const nsACString& aURI,
|
||||
nsIAbDirFactory** aDirFactory) {
|
||||
NS_ENSURE_ARG_POINTER(aDirFactory);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// Obtain the network IO service
|
||||
nsCOMPtr<nsIIOService> nsService = mozilla::services::GetIOService();
|
||||
NS_ENSURE_TRUE(nsService, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// Extract the scheme
|
||||
nsAutoCString scheme;
|
||||
rv = nsService->ExtractScheme(aURI, scheme);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Try to find a factory using the component manager.
|
||||
nsAutoCString contractID;
|
||||
contractID.AssignLiteral(NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX);
|
||||
contractID.Append(scheme);
|
||||
|
||||
return CallCreateInstance(contractID.get(), aDirFactory);
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsAbDirFactoryService_h__
|
||||
#define nsAbDirFactoryService_h__
|
||||
|
||||
#include "nsIAbDirFactoryService.h"
|
||||
|
||||
class nsAbDirFactoryService : public nsIAbDirFactoryService {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIABDIRFACTORYSERVICE
|
||||
|
||||
nsAbDirFactoryService();
|
||||
|
||||
private:
|
||||
virtual ~nsAbDirFactoryService();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -342,20 +342,6 @@ nsAbDirProperty::HasMailListWithName(const char16_t *aName, bool *aHasList) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAbDirProperty::CreateNewDirectory(const nsAString &aDirName,
|
||||
const nsACString &aURI, uint32_t aType,
|
||||
const nsACString &aPrefName,
|
||||
nsACString &aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAbDirProperty::CreateDirectoryByURI(const nsAString &aDisplayName,
|
||||
const nsACString &aURI) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbDirProperty::AddMailList(nsIAbDirectory *list,
|
||||
nsIAbDirectory **addedList) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsAbLDAPDirFactory.h"
|
||||
#include "nsAbUtils.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIAbManager.h"
|
||||
#include "nsIAbDirectory.h"
|
||||
#include "nsAbLDAPDirectory.h"
|
||||
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsAbLDAPDirFactory, nsIAbDirFactory)
|
||||
|
||||
nsAbLDAPDirFactory::nsAbLDAPDirFactory() {}
|
||||
|
||||
nsAbLDAPDirFactory::~nsAbLDAPDirFactory() {}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAbLDAPDirFactory::GetDirectories(const nsAString &aDirName,
|
||||
const nsACString &aURI,
|
||||
const nsACString &aPrefName,
|
||||
nsISimpleEnumerator **aDirectories) {
|
||||
NS_ENSURE_ARG_POINTER(aDirectories);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIAbManager> abManager(do_GetService(NS_ABMANAGER_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAbDirectory> directory;
|
||||
if (Substring(aURI, 0, 5).EqualsLiteral("ldap:") ||
|
||||
Substring(aURI, 0, 6).EqualsLiteral("ldaps:")) {
|
||||
/*
|
||||
* If the URI starts with ldap: or ldaps:
|
||||
* then this directory is an LDAP directory.
|
||||
*
|
||||
* We don't want to use the ldap:// or ldaps:// URI
|
||||
* as the URI because the ldap:// or ldaps:// URI
|
||||
* will contain the hostname, basedn, port, etc.
|
||||
* so if those attributes changed, we'll run into the
|
||||
* the same problem that we hit with changing username / hostname
|
||||
* for mail servers. To solve this problem, we add an extra
|
||||
* level of indirection. The URI that we generate
|
||||
* (the bridge URI) will be moz-abldapdirectory://<prefName>
|
||||
* and when we need the hostname, basedn, port, etc,
|
||||
* we'll use the <prefName> to get the necessary prefs.
|
||||
* note, <prefName> does not change.
|
||||
*/
|
||||
nsAutoCString bridgeURI;
|
||||
bridgeURI = NS_LITERAL_CSTRING(kLDAPDirectoryRoot);
|
||||
bridgeURI += aPrefName;
|
||||
rv = abManager->GetDirectory(bridgeURI, getter_AddRefs(directory));
|
||||
} else {
|
||||
rv = abManager->GetDirectory(aURI, getter_AddRefs(directory));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_NewSingletonEnumerator(aDirectories, directory);
|
||||
}
|
||||
|
||||
/* void deleteDirectory (in nsIAbDirectory directory); */
|
||||
NS_IMETHODIMP
|
||||
nsAbLDAPDirFactory::DeleteDirectory(nsIAbDirectory *directory) {
|
||||
// No actual deletion - as the LDAP Address Book is not physically
|
||||
// created in the corresponding CreateDirectory() unlike the Personal
|
||||
// Address Books. But we still need to return NS_OK from here.
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsAbLDAPDirFactory_h__
|
||||
#define nsAbLDAPDirFactory_h__
|
||||
|
||||
#include "nsIAbDirFactory.h"
|
||||
|
||||
class nsAbLDAPDirFactory : public nsIAbDirFactory {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIABDIRFACTORY
|
||||
|
||||
nsAbLDAPDirFactory();
|
||||
|
||||
private:
|
||||
virtual ~nsAbLDAPDirFactory();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -19,40 +19,7 @@ NS_IMPL_ISUPPORTS(nsAbLDAPReplicationQuery, nsIAbLDAPReplicationQuery)
|
|||
nsAbLDAPReplicationQuery::nsAbLDAPReplicationQuery() : mInitialized(false) {}
|
||||
|
||||
nsresult nsAbLDAPReplicationQuery::InitLDAPData() {
|
||||
nsAutoCString fileName;
|
||||
nsresult rv = mDirectory->GetReplicationFileName(fileName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// this is done here to take care of the problem related to bug # 99124.
|
||||
// earlier versions of Mozilla could have the fileName associated with the
|
||||
// directory to be abook.mab which is the profile's personal addressbook. If
|
||||
// the pref points to it, calls nsDirPrefs to generate a new server filename.
|
||||
if (fileName.IsEmpty() || fileName.EqualsLiteral(kPersonalAddressbook)) {
|
||||
// Ensure fileName is empty for DIR_GenerateAbFileName to work
|
||||
// correctly.
|
||||
fileName.Truncate();
|
||||
|
||||
nsCOMPtr<nsIAbDirectory> standardDir(do_QueryInterface(mDirectory, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCString dirPrefId;
|
||||
rv = standardDir->GetDirPrefId(dirPrefId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// XXX This should be replaced by a local function at some stage.
|
||||
// For now we'll continue using the nsDirPrefs version.
|
||||
DIR_Server *server = DIR_GetServerFromList(dirPrefId.get());
|
||||
if (server) {
|
||||
DIR_SetServerFileName(server);
|
||||
// Now ensure the prefs are saved
|
||||
DIR_SavePrefsForOneServer(server);
|
||||
}
|
||||
}
|
||||
|
||||
rv = mDirectory->SetReplicationFileName(fileName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mDirectory->GetLDAPURL(getter_AddRefs(mURL));
|
||||
nsresult rv = mDirectory->GetLDAPURL(getter_AddRefs(mURL));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mDirectory->GetAuthDn(mLogin);
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,97 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef __nsAbManager_h
|
||||
#define __nsAbManager_h
|
||||
|
||||
#include "nsIAbManager.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsICommandLineHandler.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsIAbDirectory.h"
|
||||
#include "nsIFilePicker.h"
|
||||
|
||||
class nsIAbLDAPAttributeMap;
|
||||
|
||||
class nsAbManager : public nsIAbManager,
|
||||
public nsICommandLineHandler,
|
||||
public nsIObserver {
|
||||
public:
|
||||
nsAbManager();
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIABMANAGER
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSICOMMANDLINEHANDLER
|
||||
|
||||
nsresult Init();
|
||||
|
||||
private:
|
||||
virtual ~nsAbManager();
|
||||
nsresult GetRootDirectory(nsIAbDirectory **aResult);
|
||||
nsresult ExportDirectoryToDelimitedText(nsIAbDirectory *aDirectory,
|
||||
const char *aDelim,
|
||||
uint32_t aDelimLen,
|
||||
nsIFile *aLocalFile, bool useUTF8);
|
||||
nsresult ExportDirectoryToVCard(nsIAbDirectory *aDirectory,
|
||||
nsIFile *aLocalFile);
|
||||
nsresult ExportDirectoryToLDIF(nsIAbDirectory *aDirectory,
|
||||
nsIFile *aLocalFile);
|
||||
nsresult AppendLDIFForMailList(nsIAbCard *aCard,
|
||||
nsIAbLDAPAttributeMap *aAttrMap,
|
||||
nsACString &aResult);
|
||||
nsresult AppendDNForCard(const char *aProperty, nsIAbCard *aCard,
|
||||
nsIAbLDAPAttributeMap *aAttrMap,
|
||||
nsACString &aResult);
|
||||
nsresult AppendBasicLDIFForCard(nsIAbCard *aCard,
|
||||
nsIAbLDAPAttributeMap *aAttrMap,
|
||||
nsACString &aResult);
|
||||
nsresult AppendProperty(const char *aProperty, const char16_t *aValue,
|
||||
nsACString &aResult);
|
||||
bool IsSafeLDIFString(const char16_t *aStr);
|
||||
|
||||
struct abListener {
|
||||
nsCOMPtr<nsIAbListener> mListener;
|
||||
uint32_t mNotifyFlags;
|
||||
|
||||
abListener(nsIAbListener *aListener, uint32_t aNotifyFlags)
|
||||
: mListener(aListener), mNotifyFlags(aNotifyFlags) {}
|
||||
abListener(const abListener &aListener)
|
||||
: mListener(aListener.mListener),
|
||||
mNotifyFlags(aListener.mNotifyFlags) {}
|
||||
~abListener() {}
|
||||
|
||||
int operator==(nsIAbListener *aListener) const {
|
||||
return mListener == aListener;
|
||||
}
|
||||
int operator==(const abListener &aListener) const {
|
||||
return mListener == aListener.mListener;
|
||||
}
|
||||
};
|
||||
|
||||
class nsFilePickerShownCallback : public nsIFilePickerShownCallback {
|
||||
virtual ~nsFilePickerShownCallback() {}
|
||||
|
||||
public:
|
||||
nsFilePickerShownCallback(nsAbManager *aInput, nsIFilePicker *aFilePicker,
|
||||
nsIAbDirectory *aDirectory);
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Done(int16_t aResult) override;
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIFilePicker> mFilePicker;
|
||||
RefPtr<nsAbManager> mAbManager;
|
||||
RefPtr<nsIAbDirectory> mDirectory;
|
||||
};
|
||||
|
||||
nsTObserverArray<abListener> mListeners;
|
||||
nsCOMPtr<nsIAbDirectory> mCacheTopLevelAb;
|
||||
nsInterfaceHashtable<nsCStringHashKey, nsIAbDirectory> mAbStore;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,47 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsAbOSXDirFactory.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsIAbDirectory.h"
|
||||
#include "nsIAbManager.h"
|
||||
#include "nsString.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsAbOSXDirectory.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsAbOSXDirFactory, nsIAbDirFactory)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAbOSXDirFactory::GetDirectories(const nsAString &aDirName,
|
||||
const nsACString &aURI,
|
||||
const nsACString &aPrefName,
|
||||
nsISimpleEnumerator **aDirectories) {
|
||||
NS_ENSURE_ARG_POINTER(aDirectories);
|
||||
|
||||
*aDirectories = nullptr;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIAbManager> abManager(do_GetService(NS_ABMANAGER_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAbDirectory> directory;
|
||||
rv = abManager->GetDirectory(
|
||||
NS_LITERAL_CSTRING(NS_ABOSXDIRECTORY_URI_PREFIX "/"),
|
||||
getter_AddRefs(directory));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAbOSXDirectory> osxDirectory(do_QueryInterface(directory, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = osxDirectory->AssertChildNodes();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_NewSingletonEnumerator(aDirectories, osxDirectory);
|
||||
}
|
||||
|
||||
// No actual deletion, since you cannot create the address books from Mozilla.
|
||||
NS_IMETHODIMP
|
||||
nsAbOSXDirFactory::DeleteDirectory(nsIAbDirectory *aDirectory) { return NS_OK; }
|
|
@ -1,20 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsAbOSXDirFactory_h___
|
||||
#define nsAbOSXDirFactory_h___
|
||||
|
||||
#include "nsIAbDirFactory.h"
|
||||
|
||||
class nsAbOSXDirFactory final : public nsIAbDirFactory {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIABDIRFACTORY
|
||||
|
||||
private:
|
||||
~nsAbOSXDirFactory() {}
|
||||
};
|
||||
|
||||
#endif // nsAbOSXDirFactory_h___
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -6,82 +6,11 @@
|
|||
#ifndef _NSDIRPREFS_H_
|
||||
#define _NSDIRPREFS_H_
|
||||
|
||||
#include "nsTArray.h"
|
||||
|
||||
//
|
||||
// XXX nsDirPrefs is being greatly reduced if not removed altogether. Directory
|
||||
// Prefs etc. should be handled via their appropriate nsAb*Directory classes.
|
||||
//
|
||||
|
||||
#define kPreviousListVersion 2
|
||||
#define kCurrentListVersion 3
|
||||
#define PREF_LDAP_GLOBAL_TREE_NAME "ldap_2"
|
||||
#define PREF_LDAP_VERSION_NAME "ldap_2.version"
|
||||
#define PREF_LDAP_SERVER_TREE_NAME "ldap_2.servers"
|
||||
|
||||
#define kMainLdapAddressBook "ldap.sqlite" // v3 main ldap address book file
|
||||
|
||||
/* DIR_Server.dirType */
|
||||
typedef enum {
|
||||
LDAPDirectory,
|
||||
HTMLDirectory,
|
||||
PABDirectory,
|
||||
MAPIDirectory,
|
||||
JSDirectory = 101,
|
||||
FixedQueryLDAPDirectory = 777
|
||||
MAPIDirectory = 3,
|
||||
JSDirectory = 101
|
||||
} DirectoryType;
|
||||
|
||||
typedef enum {
|
||||
idNone = 0, /* Special value */
|
||||
idPrefName,
|
||||
idPosition,
|
||||
idDescription,
|
||||
idFileName,
|
||||
idUri,
|
||||
idType
|
||||
} DIR_PrefId;
|
||||
|
||||
#define DIR_Server_typedef 1 /* this quiets a redeclare warning in libaddr */
|
||||
|
||||
typedef struct DIR_Server {
|
||||
/* Housekeeping fields */
|
||||
char *prefName; /* preference name, this server's subtree */
|
||||
int32_t position; /* relative position in server list */
|
||||
|
||||
/* General purpose fields */
|
||||
char *description; /* human readable name */
|
||||
char *fileName; /* XP path name of local DB */
|
||||
DirectoryType dirType;
|
||||
char *uri; // URI of the address book
|
||||
|
||||
// Set whilst saving the server to avoid updating it again
|
||||
bool savingServer;
|
||||
} DIR_Server;
|
||||
|
||||
/* We are developing a new model for managing DIR_Servers. In the 4.0x world,
|
||||
the FEs managed each list. Calls to FE_GetDirServer caused the FEs to manage
|
||||
and return the DIR_Server list. In our new view of the world, the back end
|
||||
does most of the list management so we are going to have the back end create
|
||||
and manage the list. Replace calls to FE_GetDirServers() with
|
||||
DIR_GetDirServers(). */
|
||||
|
||||
nsTArray<DIR_Server *> *DIR_GetDirectories();
|
||||
DIR_Server *DIR_GetServerFromList(const char *prefName);
|
||||
nsresult DIR_ShutDown(
|
||||
void); /* FEs should call this when the app is shutting down. It frees all
|
||||
DIR_Servers regardless of ref count values! */
|
||||
|
||||
nsresult DIR_AddNewAddressBook(const nsAString &dirName,
|
||||
const nsACString &fileName,
|
||||
const nsACString &uri, DirectoryType dirType,
|
||||
const nsACString &prefName,
|
||||
DIR_Server **pServer);
|
||||
nsresult DIR_ContainsServer(DIR_Server *pServer, bool *hasDir);
|
||||
|
||||
nsresult DIR_DeleteServerFromList(DIR_Server *);
|
||||
|
||||
void DIR_SavePrefsForOneServer(DIR_Server *server);
|
||||
|
||||
void DIR_SetServerFileName(DIR_Server *pServer);
|
||||
|
||||
#endif /* dirprefs.h */
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
* - description
|
||||
* - editMailListToDatabase
|
||||
* - copyMailList
|
||||
* - createNewDirectory
|
||||
* - createDirectoryByURI
|
||||
*/
|
||||
|
||||
// Main function for the this test so we can check both personal and
|
||||
|
|
|
@ -111,10 +111,7 @@
|
|||
// addrbook includes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsAbBSDirectory.h"
|
||||
#include "nsAbDirFactoryService.h"
|
||||
#include "nsAddrDatabase.h"
|
||||
// #include "nsAbManager.h"
|
||||
#include "nsAbContentHandler.h"
|
||||
#include "nsAbDirProperty.h"
|
||||
#include "nsAbAddressCollector.h"
|
||||
|
@ -132,7 +129,6 @@
|
|||
# include "nsAbLDAPDirectory.h"
|
||||
# include "nsAbLDAPDirectoryQuery.h"
|
||||
# include "nsAbLDAPCard.h"
|
||||
# include "nsAbLDAPDirFactory.h"
|
||||
# include "nsAbLDAPReplicationService.h"
|
||||
# include "nsAbLDAPReplicationQuery.h"
|
||||
# include "nsAbLDAPReplicationData.h"
|
||||
|
@ -150,7 +146,6 @@
|
|||
#ifdef XP_MACOSX
|
||||
# include "nsAbOSXDirectory.h"
|
||||
# include "nsAbOSXCard.h"
|
||||
# include "nsAbOSXDirFactory.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -437,11 +432,9 @@ NS_DEFINE_NAMED_CID(NS_MAILNEWSDLF_CID);
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbContentHandler)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirProperty)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbCardProperty)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbBSDirectory)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddrDatabase)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAbAddressCollector, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddbookUrl)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirFactoryService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddbookProtocolHandler)
|
||||
|
||||
#if defined(MOZ_MAPI_SUPPORT)
|
||||
|
@ -457,7 +450,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbBooleanExpression)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPDirectory)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPDirectoryQuery)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPCard)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPDirFactory)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPReplicationService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPReplicationQuery)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPProcessReplicationData)
|
||||
|
@ -475,11 +467,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDIFService)
|
|||
#ifdef XP_MACOSX
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbOSXDirectory)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbOSXCard)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbOSXDirFactory)
|
||||
#endif
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_ABMANAGER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABDIRECTORY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ADDRDATABASE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABCARDPROPERTY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABDIRPROPERTY_CID);
|
||||
|
@ -487,7 +476,6 @@ NS_DEFINE_NAMED_CID(NS_ABADDRESSCOLLECTOR_CID);
|
|||
NS_DEFINE_NAMED_CID(NS_ADDBOOKURL_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ADDBOOK_HANDLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABCONTENTHANDLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABDIRFACTORYSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABDIRECTORYQUERYARGUMENTS_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_BOOLEANCONDITIONSTRING_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_BOOLEANEXPRESSION_CID);
|
||||
|
@ -500,7 +488,6 @@ NS_DEFINE_NAMED_CID(NS_ABOUTLOOKDIRFACTORY_CID);
|
|||
NS_DEFINE_NAMED_CID(NS_ABLDAPDIRECTORY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABLDAPDIRECTORYQUERY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABLDAPCARD_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABLDAPDIRFACTORY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABLDAP_REPLICATIONSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABLDAP_REPLICATIONQUERY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABLDAP_PROCESSREPLICATIONDATA_CID);
|
||||
|
@ -509,7 +496,6 @@ NS_DEFINE_NAMED_CID(NS_ABDIRECTORYQUERYPROXY_CID);
|
|||
#ifdef XP_MACOSX
|
||||
NS_DEFINE_NAMED_CID(NS_ABOSXDIRECTORY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABOSXCARD_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ABOSXDIRFACTORY_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_ABVIEW_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_MSGVCARDSERVICE_CID);
|
||||
|
@ -896,8 +882,6 @@ const mozilla::Module::CIDEntry kMailNewsCIDs[] = {
|
|||
{&kNS_STOPWATCH_CID, false, NULL, nsStopwatchConstructor},
|
||||
{&kNS_MAILNEWSDLF_CID, false, NULL, MailNewsDLFConstructor},
|
||||
// Address Book Entries
|
||||
// {&kNS_ABMANAGER_CID, false, NULL, nsAbManagerConstructor},
|
||||
{&kNS_ABDIRECTORY_CID, false, NULL, nsAbBSDirectoryConstructor},
|
||||
{&kNS_ADDRDATABASE_CID, false, NULL, nsAddrDatabaseConstructor},
|
||||
{&kNS_ABCARDPROPERTY_CID, false, NULL, nsAbCardPropertyConstructor},
|
||||
{&kNS_ABDIRPROPERTY_CID, false, NULL, nsAbDirPropertyConstructor},
|
||||
|
@ -906,8 +890,6 @@ const mozilla::Module::CIDEntry kMailNewsCIDs[] = {
|
|||
{&kNS_ADDBOOK_HANDLER_CID, false, NULL,
|
||||
nsAddbookProtocolHandlerConstructor},
|
||||
{&kNS_ABCONTENTHANDLER_CID, false, NULL, nsAbContentHandlerConstructor},
|
||||
{&kNS_ABDIRFACTORYSERVICE_CID, false, NULL,
|
||||
nsAbDirFactoryServiceConstructor},
|
||||
#if defined(MOZ_MAPI_SUPPORT)
|
||||
{&kNS_ABOUTLOOKDIRECTORY_CID, false, NULL, nsAbOutlookDirectoryConstructor},
|
||||
{&kNS_ABOUTLOOKDIRFACTORY_CID, false, NULL,
|
||||
|
@ -930,14 +912,12 @@ const mozilla::Module::CIDEntry kMailNewsCIDs[] = {
|
|||
nsAbLDAPReplicationQueryConstructor},
|
||||
{&kNS_ABLDAP_PROCESSREPLICATIONDATA_CID, false, NULL,
|
||||
nsAbLDAPProcessReplicationDataConstructor},
|
||||
{&kNS_ABLDAPDIRFACTORY_CID, false, NULL, nsAbLDAPDirFactoryConstructor},
|
||||
#endif
|
||||
{&kNS_ABDIRECTORYQUERYPROXY_CID, false, NULL,
|
||||
nsAbDirectoryQueryProxyConstructor},
|
||||
#ifdef XP_MACOSX
|
||||
{&kNS_ABOSXDIRECTORY_CID, false, NULL, nsAbOSXDirectoryConstructor},
|
||||
{&kNS_ABOSXCARD_CID, false, NULL, nsAbOSXCardConstructor},
|
||||
{&kNS_ABOSXDIRFACTORY_CID, false, NULL, nsAbOSXDirFactoryConstructor},
|
||||
#endif
|
||||
{&kNS_ABVIEW_CID, false, NULL, nsAbViewConstructor},
|
||||
{&kNS_MSGVCARDSERVICE_CID, false, NULL, nsMsgVCardServiceConstructor},
|
||||
|
@ -1137,9 +1117,6 @@ const mozilla::Module::ContractIDEntry kMailNewsContracts[] = {
|
|||
{NS_STOPWATCH_CONTRACTID, &kNS_STOPWATCH_CID},
|
||||
{NS_MAILNEWSDLF_CONTRACTID, &kNS_MAILNEWSDLF_CID},
|
||||
// Address Book Entries
|
||||
{NS_ABMANAGER_CONTRACTID, &kNS_ABMANAGER_CID},
|
||||
{NS_ABMANAGERSTARTUPHANDLER_CONTRACTID, &kNS_ABMANAGER_CID},
|
||||
{NS_ABDIRECTORY_CONTRACTID, &kNS_ABDIRECTORY_CID},
|
||||
{NS_ADDRDATABASE_CONTRACTID, &kNS_ADDRDATABASE_CID},
|
||||
{NS_ABCARDPROPERTY_CONTRACTID, &kNS_ABCARDPROPERTY_CID},
|
||||
{NS_ABDIRPROPERTY_CONTRACTID, &kNS_ABDIRPROPERTY_CID},
|
||||
|
@ -1150,7 +1127,6 @@ const mozilla::Module::ContractIDEntry kMailNewsContracts[] = {
|
|||
&kNS_ABCONTENTHANDLER_CID},
|
||||
{NS_CONTENT_HANDLER_CONTRACTID_PREFIX "text/x-vcard",
|
||||
&kNS_ABCONTENTHANDLER_CID},
|
||||
{NS_ABDIRFACTORYSERVICE_CONTRACTID, &kNS_ABDIRFACTORYSERVICE_CID},
|
||||
#if defined(MOZ_MAPI_SUPPORT)
|
||||
{NS_ABOUTLOOKDIRECTORY_CONTRACTID, &kNS_ABOUTLOOKDIRECTORY_CID},
|
||||
{NS_ABOUTLOOKDIRFACTORY_CONTRACTID, &kNS_ABOUTLOOKDIRFACTORY_CID},
|
||||
|
@ -1164,21 +1140,17 @@ const mozilla::Module::ContractIDEntry kMailNewsContracts[] = {
|
|||
{NS_ABLDAPDIRECTORY_CONTRACTID, &kNS_ABLDAPDIRECTORY_CID},
|
||||
{NS_ABLDAPDIRECTORYQUERY_CONTRACTID, &kNS_ABLDAPDIRECTORYQUERY_CID},
|
||||
{NS_ABLDAPCARD_CONTRACTID, &kNS_ABLDAPCARD_CID},
|
||||
{NS_ABLDAPDIRFACTORY_CONTRACTID, &kNS_ABLDAPDIRFACTORY_CID},
|
||||
{NS_ABLDAP_REPLICATIONSERVICE_CONTRACTID,
|
||||
&kNS_ABLDAP_REPLICATIONSERVICE_CID},
|
||||
{NS_ABLDAP_REPLICATIONQUERY_CONTRACTID, &kNS_ABLDAP_REPLICATIONQUERY_CID},
|
||||
{NS_ABLDAP_PROCESSREPLICATIONDATA_CONTRACTID,
|
||||
&kNS_ABLDAP_PROCESSREPLICATIONDATA_CID},
|
||||
{NS_ABLDAPACDIRFACTORY_CONTRACTID, &kNS_ABLDAPDIRFACTORY_CID},
|
||||
{NS_ABLDAPSACDIRFACTORY_CONTRACTID, &kNS_ABLDAPDIRFACTORY_CID},
|
||||
#endif
|
||||
|
||||
{NS_ABDIRECTORYQUERYPROXY_CONTRACTID, &kNS_ABDIRECTORYQUERYPROXY_CID},
|
||||
#ifdef XP_MACOSX
|
||||
{NS_ABOSXDIRECTORY_CONTRACTID, &kNS_ABOSXDIRECTORY_CID},
|
||||
{NS_ABOSXCARD_CONTRACTID, &kNS_ABOSXCARD_CID},
|
||||
{NS_ABOSXDIRFACTORY_CONTRACTID, &kNS_ABOSXDIRFACTORY_CID},
|
||||
#endif
|
||||
{NS_ABVIEW_CONTRACTID, &kNS_ABVIEW_CID},
|
||||
{NS_MSGVCARDSERVICE_CONTRACTID, &kNS_MSGVCARDSERVICE_CID},
|
||||
|
@ -1342,8 +1314,6 @@ static const mozilla::Module::CategoryEntry kMailNewsCategories[] = {
|
|||
"service," NS_MESSENGEROSINTEGRATION_CONTRACTID},
|
||||
#endif
|
||||
// Address Book Entries
|
||||
{"command-line-handler", "m-addressbook",
|
||||
NS_ABMANAGERSTARTUPHANDLER_CONTRACTID},
|
||||
// Bayesian Filter Entries
|
||||
// Compose Entries
|
||||
{"command-line-handler", "m-compose",
|
||||
|
|
Загрузка…
Ссылка в новой задаче