summaryrefslogtreecommitdiffstats
path: root/mailnews/addrbook/public
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
committerMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
commit302bf1b523012e11b60425d6eee1221ebc2724eb (patch)
treeb191a895f8716efcbe42f454f37597a545a6f421 /mailnews/addrbook/public
parent21b3f6247403c06f85e1f45d219f87549862198f (diff)
downloadUXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.gz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.lz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.xz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.zip
Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1
Diffstat (limited to 'mailnews/addrbook/public')
-rw-r--r--mailnews/addrbook/public/moz.build47
-rw-r--r--mailnews/addrbook/public/nsAbBaseCID.h445
-rw-r--r--mailnews/addrbook/public/nsIAbAddressCollector.idl58
-rw-r--r--mailnews/addrbook/public/nsIAbAutoCompleteResult.idl36
-rw-r--r--mailnews/addrbook/public/nsIAbBooleanExpression.idl122
-rw-r--r--mailnews/addrbook/public/nsIAbCard.idl358
-rw-r--r--mailnews/addrbook/public/nsIAbCollection.idl92
-rw-r--r--mailnews/addrbook/public/nsIAbDirFactory.idl35
-rw-r--r--mailnews/addrbook/public/nsIAbDirFactoryService.idl28
-rw-r--r--mailnews/addrbook/public/nsIAbDirSearchListener.idl15
-rw-r--r--mailnews/addrbook/public/nsIAbDirectory.idl296
-rw-r--r--mailnews/addrbook/public/nsIAbDirectoryQuery.idl164
-rw-r--r--mailnews/addrbook/public/nsIAbDirectoryQueryProxy.idl14
-rw-r--r--mailnews/addrbook/public/nsIAbDirectorySearch.idl53
-rw-r--r--mailnews/addrbook/public/nsIAbItem.idl90
-rw-r--r--mailnews/addrbook/public/nsIAbLDAPAttributeMap.idl194
-rw-r--r--mailnews/addrbook/public/nsIAbLDAPCard.idl56
-rw-r--r--mailnews/addrbook/public/nsIAbLDAPDirectory.idl112
-rw-r--r--mailnews/addrbook/public/nsIAbLDAPReplicationData.idl68
-rw-r--r--mailnews/addrbook/public/nsIAbLDAPReplicationQuery.idl67
-rw-r--r--mailnews/addrbook/public/nsIAbLDAPReplicationService.idl32
-rw-r--r--mailnews/addrbook/public/nsIAbLDIFService.idl40
-rw-r--r--mailnews/addrbook/public/nsIAbListener.idl90
-rw-r--r--mailnews/addrbook/public/nsIAbMDBDirectory.idl71
-rw-r--r--mailnews/addrbook/public/nsIAbManager.idl190
-rw-r--r--mailnews/addrbook/public/nsIAbView.idl109
-rw-r--r--mailnews/addrbook/public/nsIAddbookUrl.idl19
-rw-r--r--mailnews/addrbook/public/nsIAddrDBAnnouncer.idl35
-rw-r--r--mailnews/addrbook/public/nsIAddrDBListener.idl36
-rw-r--r--mailnews/addrbook/public/nsIAddrDatabase.idl311
-rw-r--r--mailnews/addrbook/public/nsIMsgVCardService.idl29
31 files changed, 3312 insertions, 0 deletions
diff --git a/mailnews/addrbook/public/moz.build b/mailnews/addrbook/public/moz.build
new file mode 100644
index 000000000..5925ccc8a
--- /dev/null
+++ b/mailnews/addrbook/public/moz.build
@@ -0,0 +1,47 @@
+# vim: set filetype=python:
+# 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/.
+
+XPIDL_SOURCES += [
+ 'nsIAbAddressCollector.idl',
+ 'nsIAbAutoCompleteResult.idl',
+ 'nsIAbBooleanExpression.idl',
+ 'nsIAbCard.idl',
+ 'nsIAbCollection.idl',
+ 'nsIAbDirectory.idl',
+ 'nsIAbDirectoryQuery.idl',
+ 'nsIAbDirectoryQueryProxy.idl',
+ 'nsIAbDirectorySearch.idl',
+ 'nsIAbDirFactory.idl',
+ 'nsIAbDirFactoryService.idl',
+ 'nsIAbDirSearchListener.idl',
+ 'nsIAbItem.idl',
+ 'nsIAbLDAPAttributeMap.idl',
+ 'nsIAbLDIFService.idl',
+ 'nsIAbListener.idl',
+ 'nsIAbManager.idl',
+ 'nsIAbMDBDirectory.idl',
+ 'nsIAbView.idl',
+ 'nsIAddbookUrl.idl',
+ 'nsIAddrDatabase.idl',
+ 'nsIAddrDBAnnouncer.idl',
+ 'nsIAddrDBListener.idl',
+ 'nsIMsgVCardService.idl',
+]
+
+if CONFIG['MOZ_LDAP_XPCOM']:
+ XPIDL_SOURCES += [
+ 'nsIAbLDAPCard.idl',
+ 'nsIAbLDAPDirectory.idl',
+ 'nsIAbLDAPReplicationData.idl',
+ 'nsIAbLDAPReplicationQuery.idl',
+ 'nsIAbLDAPReplicationService.idl',
+ ]
+
+XPIDL_MODULE = 'addrbook'
+
+EXPORTS += [
+ 'nsAbBaseCID.h',
+]
+
diff --git a/mailnews/addrbook/public/nsAbBaseCID.h b/mailnews/addrbook/public/nsAbBaseCID.h
new file mode 100644
index 000000000..0dcc630c5
--- /dev/null
+++ b/mailnews/addrbook/public/nsAbBaseCID.h
@@ -0,0 +1,445 @@
+/* -*- 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 nsAbBaseCID_h__
+#define nsAbBaseCID_h__
+
+#include "nsISupports.h"
+#include "nsIFactory.h"
+#include "nsIComponentManager.h"
+
+//
+// The start of the contract ID for address book directory factories.
+//
+#define NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX \
+ "@mozilla.org/addressbook/directory-factory;1?name="
+
+//
+// The start of the contract ID for address book directory types
+//
+#define NS_AB_DIRECTORY_TYPE_CONTRACTID_PREFIX \
+ "@mozilla.org/addressbook/directory;1?type="
+
+//
+// nsAbManager
+//
+#define NS_ABMANAGER_CONTRACTID \
+ "@mozilla.org/abmanager;1"
+
+#define NS_ABMANAGERSTARTUPHANDLER_CONTRACTID \
+ "@mozilla.org/commandlinehandler/general-startup;1?type=addressbook"
+
+#define NS_ABMANAGER_CID \
+{ /* {ad81b321-8a8a-42ca-a508-fe659de84586} */ \
+ 0xad81b321, 0x8a8a, 0x42ca, \
+ {0xa5, 0x08, 0xfe, 0x65, 0x9d, 0x8e, 0x45, 0x86} \
+}
+
+//
+// nsAbContentHandler
+//
+#define NS_ABCONTENTHANDLER_CID \
+{ /* {a72ad552-0484-4b5f-8d45-2d79158d22e3} */ \
+ 0xa72ad552, 0x0484, 0x4b5f, \
+ {0x8d, 0x45, 0x2d, 0x79, 0x15, 0x8d, 0x22, 0xe3} \
+}
+
+
+//
+// nsAbBSDirectory - the root address book
+//
+#define NS_ABDIRECTORY_CONTRACTID \
+ NS_AB_DIRECTORY_TYPE_CONTRACTID_PREFIX "moz-abdirectory"
+
+#define NS_ABDIRECTORY_CID \
+{ /* {012D3C24-1DD2-11B2-BA79-B4AD359FC461}*/ \
+ 0x012D3C24, 0x1DD2, 0x11B2, \
+ {0xBA, 0x79, 0xB4, 0xAD, 0x35, 0x9F, 0xC4, 0x61} \
+}
+
+
+//
+// nsAddressBookDB
+//
+#define NS_ADDRDATABASE_CONTRACTID \
+ "@mozilla.org/addressbook/carddatabase;1"
+
+#define NS_ADDRDATABASE_CID \
+{ /* 63187917-1D19-11d3-A302-001083003D0C */ \
+ 0x63187917, 0x1d19, 0x11d3, \
+ {0xa3, 0x2, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
+}
+
+//
+// nsAbCardProperty
+//
+#define NS_ABCARDPROPERTY_CONTRACTID \
+ "@mozilla.org/addressbook/cardproperty;1"
+#define NS_ABCARDPROPERTY_CID \
+{ /* 2B722171-2CEA-11d3-9E0B-00A0C92B5F0D */ \
+ 0x2b722171, 0x2cea, 0x11d3, \
+ {0x9e, 0xb, 0x0, 0xa0, 0xc9, 0x2b, 0x5f, 0xd} \
+}
+
+//
+// nsAbDirProperty
+//
+#define NS_ABDIRPROPERTY_CONTRACTID \
+ "@mozilla.org/addressbook/directoryproperty;1"
+#define NS_ABDIRPROPERTY_CID \
+{ /* 6FD8EC67-3965-11d3-A316-001083003D0C */ \
+ 0x6fd8ec67, 0x3965, 0x11d3, \
+ {0xa3, 0x16, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
+}
+
+//
+// nsAbDirectoryProperties
+//
+#define NS_ABDIRECTORYPROPERTIES_CONTRACTID \
+ "@mozilla.org/addressbook/properties;1"
+#define NS_ABDIRECTORYPROPERTIES_CID \
+{ /* 8b00a972-1dd2-11b2-9d9c-9c377a9c3dba */ \
+ 0x8b00a972, 0x1dd2, 0x11b2, \
+ {0x9d, 0x9c, 0x9c, 0x37, 0x7a, 0x9c, 0x3d, 0xba} \
+}
+
+//
+// nsAbAddressCollector
+//
+#define NS_ABADDRESSCOLLECTOR_CONTRACTID \
+ "@mozilla.org/addressbook/services/addressCollector;1"
+#define NS_ABADDRESSCOLLECTOR_CID \
+{ /* e7702d5a-99d8-4648-bab7-919ea29f30b6 */ \
+ 0xe7702d5a, 0x99d8, 0x4648, \
+ {0xba, 0xb7, 0x91, 0x9e, 0xa2, 0x9f, 0x30, 0xb6} \
+}
+
+//
+// addbook URL
+//
+#define NS_ADDBOOKURL_CONTRACTID \
+ "@mozilla.org/addressbook/services/url;1?type=addbook"
+
+#define NS_ADDBOOKURL_CID \
+{ /* ff04c8e6-501e-11d3-a527-0060b0fc0444 */ \
+ 0xff04c8e6, 0x501e, 0x11d3, \
+ {0xa5, 0x27, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0x44} \
+}
+
+//
+// addbook Protocol Handler
+//
+#define NS_ADDBOOK_HANDLER_CONTRACTID \
+ "@mozilla.org/addressbook/services/addbook;1"
+#define NS_ADDBOOK_HANDLER_CID \
+{ /* ff04c8e6-501e-11d3-ffcc-0060b0fc0444 */ \
+ 0xff04c8e6, 0x501e, 0x11d3, \
+ {0xff, 0xcc, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0x44} \
+}
+
+//
+// directory factory service
+//
+#define NS_ABDIRFACTORYSERVICE_CONTRACTID \
+ "@mozilla.org/addressbook/directory-factory-service;1"
+
+#define NS_ABDIRFACTORYSERVICE_CID \
+{ /* {F8B212F2-742B-4A48-B7A0-4C44D4DDB121}*/ \
+ 0xF8B212F2, 0x742B, 0x4A48, \
+ {0xB7, 0xA0, 0x4C, 0x44, 0xD4, 0xDD, 0xB1, 0x21} \
+}
+
+//
+// mdb directory factory
+//
+#define NS_ABMDBDIRECTORY "moz-abmdbdirectory"
+
+#define NS_ABMDBDIRFACTORY_CONTRACTID \
+ NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX NS_ABMDBDIRECTORY
+
+#define NS_ABMDBDIRFACTORY_CID \
+{ /* {E1CB9C8A-722D-43E4-9D7B-7CCAE4B0338A}*/ \
+ 0xE1CB9C8A, 0x722D, 0x43E4, \
+ {0x9D, 0x7B, 0x7C, 0xCA, 0xE4, 0xB0, 0x33, 0x8A} \
+}
+
+//
+// nsAbMDBDirectory
+//
+#define NS_ABMDBDIRECTORY_CONTRACTID \
+ NS_AB_DIRECTORY_TYPE_CONTRACTID_PREFIX NS_ABMDBDIRECTORY
+
+#define NS_ABMDBDIRECTORY_CID \
+{ /* {e618f894-1dd1-11b2-889c-9aaefaa90dde}*/ \
+ 0xe618f894, 0x1dd1, 0x11b2, \
+ {0x88, 0x9c, 0x9a, 0xae, 0xfa, 0xa9, 0x0d, 0xde} \
+}
+
+//
+// nsAbMDBCard
+//
+#define NS_ABMDBCARD_CONTRACTID \
+ "@mozilla.org/addressbook/moz-abmdbcard;1"
+
+#define NS_ABMDBCARD_CID \
+{ /* {f578a5d2-1dd1-11b2-8841-f45cc5e765f8} */ \
+ 0xf578a5d2, 0x1dd1, 0x11b2, \
+ {0x88, 0x41, 0xf4, 0x5c, 0xc5, 0xe7, 0x65, 0xf8} \
+}
+
+#ifdef XP_WIN
+//
+// nsAbOutlookDirectory
+//
+#define NS_ABOUTLOOKDIRECTORY_CONTRACTID \
+ NS_AB_DIRECTORY_TYPE_CONTRACTID_PREFIX "moz-aboutlookdirectory"
+
+#define NS_ABOUTLOOKDIRECTORY_CID \
+{ /* {9cc57822-0599-4c47-a399-1c6fa185a05c}*/ \
+ 0x9cc57822, 0x0599, 0x4c47, \
+ {0xa3, 0x99, 0x1c, 0x6f, 0xa1, 0x85, 0xa0, 0x5c} \
+}
+
+//
+// Outlook directory factory
+//
+#define NS_ABOUTLOOKDIRFACTORY_CONTRACTID \
+ NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX "moz-aboutlookdirectory"
+
+#define NS_ABOUTLOOKDIRFACTORY_CID \
+{ /* {558ccc0f-2681-4dac-a066-debd8d26faf6}*/ \
+ 0x558ccc0f, 0x2681, 0x4dac, \
+ {0xa0, 0x66, 0xde, 0xbd, 0x8d, 0x26, 0xfa, 0xf6} \
+}
+#endif
+
+//
+// Addressbook Query support
+//
+
+#define NS_ABDIRECTORYQUERYARGUMENTS_CONTRACTID \
+ "@mozilla.org/addressbook/directory/query-arguments;1"
+
+#define NS_ABDIRECTORYQUERYARGUMENTS_CID \
+{ /* {f7dc2aeb-8e62-4750-965c-24b9e09ed8d2} */ \
+ 0xf7dc2aeb, 0x8e62, 0x4750, \
+ { 0x96, 0x5c, 0x24, 0xb9, 0xe0, 0x9e, 0xd8, 0xd2 } \
+}
+
+
+#define NS_BOOLEANCONDITIONSTRING_CONTRACTID \
+ "@mozilla.org/boolean-expression/condition-string;1"
+
+#define NS_BOOLEANCONDITIONSTRING_CID \
+{ /* {ca1944a9-527e-4c77-895d-d0466dd41cf5} */ \
+ 0xca1944a9, 0x527e, 0x4c77, \
+ { 0x89, 0x5d, 0xd0, 0x46, 0x6d, 0xd4, 0x1c, 0xf5 } \
+}
+
+
+#define NS_BOOLEANEXPRESSION_CONTRACTID \
+ "@mozilla.org/boolean-expression/n-peer;1"
+
+#define NS_BOOLEANEXPRESSION_CID \
+{ /* {2c2e75c8-6f56-4a50-af1c-72af5d0e8d41} */ \
+ 0x2c2e75c8, 0x6f56, 0x4a50, \
+ { 0xaf, 0x1c, 0x72, 0xaf, 0x5d, 0x0e, 0x8d, 0x41 } \
+}
+
+#define NS_ABDIRECTORYQUERYPROXY_CONTRACTID \
+ "@mozilla.org/addressbook/directory-query/proxy;1"
+
+#define NS_ABDIRECTORYQUERYPROXY_CID \
+{ /* {E162E335-541B-43B4-AAEA-FE591E240CAF}*/ \
+ 0xE162E335, 0x541B, 0x43B4, \
+ {0xAA, 0xEA, 0xFE, 0x59, 0x1E, 0x24, 0x0C, 0xAF} \
+}
+
+// nsAbLDAPDirectory
+//
+#define NS_ABLDAPDIRECTORY_CONTRACTID \
+ NS_AB_DIRECTORY_TYPE_CONTRACTID_PREFIX "moz-abldapdirectory"
+
+#define NS_ABLDAPDIRECTORY_CID \
+{ /* {783E2777-66D7-4826-9E4B-8AB58C228A52}*/ \
+ 0x783E2777, 0x66D7, 0x4826, \
+ {0x9E, 0x4B, 0x8A, 0xB5, 0x8C, 0x22, 0x8A, 0x52} \
+}
+
+// nsAbLDAPDirectoryQuery
+//
+#define NS_ABLDAPDIRECTORYQUERY_CONTRACTID \
+ "@mozilla.org/addressbook/ldap-directory-query;1"
+
+#define NS_ABLDAPDIRECTORYQUERY_CID \
+{ /* {783E2777-66D7-4826-9E4B-8AB58C228A53}*/ \
+ 0x783E2777, 0x66D7, 0x4826, \
+ {0x9E, 0x4B, 0x8A, 0xB5, 0x8C, 0x22, 0x8A, 0x53} \
+}
+
+//
+// nsAbLDAPCard
+//
+#define NS_ABLDAPCARD_CONTRACTID \
+ "@mozilla.org/addressbook/moz-abldapcard"
+
+#define NS_ABLDAPCARD_CID \
+{ /* {10307B01-EBD6-465F-B972-1630410F70E6}*/ \
+ 0x10307B01, 0xEBD6, 0x465F, \
+ {0xB9, 0x72, 0x16, 0x30, 0x41, 0x0F, 0x70, 0xE6} \
+}
+
+//
+// LDAP directory factory
+//
+#define NS_ABLDAPDIRFACTORY_CONTRACTID \
+ NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX "moz-abldapdirectory"
+
+#define NS_ABLDAPDIRFACTORY_CID \
+{ /* {8e3701af-8828-426c-84ac-124825c778f8} */ \
+ 0x8e3701af, 0x8828, 0x426c, \
+ {0x84, 0xac, 0x12, 0x48, 0x25, 0xc7, 0x78, 0xf8} \
+}
+
+//
+// LDAP autocomplete directory factory
+//
+#define NS_ABLDAPACDIRFACTORY_CONTRACTID \
+ NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX "ldap"
+#define NS_ABLDAPSACDIRFACTORY_CONTRACTID \
+ NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX "ldaps"
+
+// nsAbLDAPAutoCompFormatter
+
+// 4e276d6d-9981-46b4-9070-92f344ac5f5a
+//
+#define NS_ABLDAPAUTOCOMPFORMATTER_CID \
+{ 0x4e276d6d, 0x9981, 0x46b4, \
+ { 0x90, 0x70, 0x92, 0xf3, 0x44, 0xac, 0x5f, 0x5a }}
+
+#define NS_ABLDAPAUTOCOMPFORMATTER_CONTRACTID \
+ "@mozilla.org/ldap-autocomplete-formatter;1?type=addrbook"
+
+
+// nsAbLDAPReplicationService
+//
+// {ece81280-2639-11d6-b791-00b0d06e5f27}
+//
+#define NS_ABLDAP_REPLICATIONSERVICE_CID \
+ {0xece81280, 0x2639, 0x11d6, \
+ { 0xb7, 0x91, 0x00, 0xb0, 0xd0, 0x6e, 0x5f, 0x27 }}
+
+#define NS_ABLDAP_REPLICATIONSERVICE_CONTRACTID \
+ "@mozilla.org/addressbook/ldap-replication-service;1"
+
+// nsAbLDAPReplicationQuery
+//
+// {5414fff0-263b-11d6-b791-00b0d06e5f27}
+//
+#define NS_ABLDAP_REPLICATIONQUERY_CID \
+ {0x5414fff0, 0x263b, 0x11d6, \
+ { 0xb7, 0x91, 0x00, 0xb0, 0xd0, 0x6e, 0x5f, 0x27 }}
+
+#define NS_ABLDAP_REPLICATIONQUERY_CONTRACTID \
+ "@mozilla.org/addressbook/ldap-replication-query;1"
+
+
+// nsAbLDAPChangeLogQuery
+//
+// {63E11D51-3C9B-11d6-B7B9-00B0D06E5F27}
+#define NS_ABLDAP_CHANGELOGQUERY_CID \
+ {0x63e11d51, 0x3c9b, 0x11d6, \
+ { 0xb7, 0xb9, 0x0, 0xb0, 0xd0, 0x6e, 0x5f, 0x27 }}
+
+#define NS_ABLDAP_CHANGELOGQUERY_CONTRACTID \
+ "@mozilla.org/addressbook/ldap-changelog-query;1"
+
+// nsAbLDAPProcessReplicationData
+//
+// {5414fff1-263b-11d6-b791-00b0d06e5f27}
+//
+#define NS_ABLDAP_PROCESSREPLICATIONDATA_CID \
+ {0x5414fff1, 0x263b, 0x11d6, \
+ { 0xb7, 0x91, 0x00, 0xb0, 0xd0, 0x6e, 0x5f, 0x27 }}
+
+#define NS_ABLDAP_PROCESSREPLICATIONDATA_CONTRACTID \
+ "@mozilla.org/addressbook/ldap-process-replication-data;1"
+
+
+// nsAbLDAPProcessChangeLogData
+//
+// {63E11D52-3C9B-11d6-B7B9-00B0D06E5F27}
+#define NS_ABLDAP_PROCESSCHANGELOGDATA_CID \
+ {0x63e11d52, 0x3c9b, 0x11d6, \
+ {0xb7, 0xb9, 0x0, 0xb0, 0xd0, 0x6e, 0x5f, 0x27 }}
+
+#define NS_ABLDAP_PROCESSCHANGELOGDATA_CONTRACTID \
+ "@mozilla.org/addressbook/ldap-process-changelog-data;1"
+
+// nsABView
+
+#define NS_ABVIEW_CID \
+{ 0xc5eb5d6a, 0x1dd1, 0x11b2, \
+ { 0xa0, 0x25, 0x94, 0xd1, 0x18, 0x1f, 0xc5, 0x9c }}
+
+#define NS_ABVIEW_CONTRACTID \
+ "@mozilla.org/addressbook/abview;1"
+
+#ifdef XP_MACOSX
+//
+// nsAbOSXDirectory
+//
+#define NS_ABOSXDIRECTORY_PREFIX "moz-abosxdirectory"
+#define NS_ABOSXCARD_PREFIX "moz-abosxcard"
+
+#define NS_ABOSXDIRECTORY_CONTRACTID \
+ NS_AB_DIRECTORY_TYPE_CONTRACTID_PREFIX NS_ABOSXDIRECTORY_PREFIX
+
+#define NS_ABOSXDIRECTORY_CID \
+{ /* {83781cc6-c682-11d6-bdeb-0005024967b8}*/ \
+ 0x83781cc6, 0xc682, 0x11d6, \
+ {0xbd, 0xeb, 0x00, 0x05, 0x02, 0x49, 0x67, 0xb8} \
+}
+
+//
+// nsAbOSXCard
+//
+#define NS_ABOSXCARD_CONTRACTID \
+ NS_AB_DIRECTORY_TYPE_CONTRACTID_PREFIX NS_ABOSXCARD_PREFIX
+
+#define NS_ABOSXCARD_CID \
+{ /* {89bbf582-c682-11d6-bc9d-0005024967b8}*/ \
+ 0x89bbf582, 0xc682, 0x11d6, \
+ {0xbc, 0x9d, 0x00, 0x05, 0x02, 0x49, 0x67, 0xb8} \
+}
+
+//
+// OS X directory factory
+//
+#define NS_ABOSXDIRFACTORY_CONTRACTID \
+ NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX NS_ABOSXDIRECTORY_PREFIX
+
+#define NS_ABOSXDIRFACTORY_CID \
+{ /* {90efe2fe-c682-11d6-9c83-0005024967b8}*/ \
+ 0x90efe2fe, 0xc682, 0x11d6, \
+ {0x9c, 0x83, 0x00, 0x05, 0x02, 0x49, 0x67, 0xb8} \
+}
+#endif
+
+#define NS_MSGVCARDSERVICE_CID \
+{ 0x3c4ac0da, 0x2cda, 0x4018, \
+ { 0x95, 0x51, 0xe1, 0x58, 0xb2, 0xe1, 0x22, 0xd3 }}
+
+#define NS_MSGVCARDSERVICE_CONTRACTID \
+ "@mozilla.org/addressbook/msgvcardservice;1"
+
+#define NS_ABLDIFSERVICE_CID \
+{ 0xdb6f46da, 0x8de3, 0x478d, \
+ { 0xb5, 0x39, 0x80, 0x13, 0x98, 0x65, 0x6c, 0xf6 }}
+
+#define NS_ABLDIFSERVICE_CONTRACTID \
+ "@mozilla.org/addressbook/abldifservice;1"
+
+#endif // nsAbBaseCID_h__
diff --git a/mailnews/addrbook/public/nsIAbAddressCollector.idl b/mailnews/addrbook/public/nsIAbAddressCollector.idl
new file mode 100644
index 000000000..3d5071a6b
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbAddressCollector.idl
@@ -0,0 +1,58 @@
+/* -*- Mode: IDL; 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 nsIAbCard;
+
+/**
+ * nsIAbAddressCollector is the interface to the address collecter service.
+ * It will save and update the supplied addresses into the address book
+ * specified by the "mail.collect_addressbook" pref.
+ */
+[scriptable, uuid(069d3fba-37d4-4158-b401-a8efaeea0b66)]
+interface nsIAbAddressCollector : nsISupports {
+ /**
+ * Collects email addresses into the address book.
+ * If a card already exists for the email, the first/last/display names
+ * will be updated if they are supplied alongside the address.
+ * If a card does not exist for the email it will be created if aCreateCard
+ * is true.
+ *
+ * @param aAddresses The list of emails (in standard header format)
+ * to collect into the address book.
+ * @param aCreateCard Set to true if a card should be created if the
+ * email address doesn't exist.
+ * @param aSendFormat The send format to save for the card. See
+ * nsIAbPreferMailFormat for values. If updating a card
+ * this value will only be changed if the current value
+ * for the card is "unknown".
+ */
+ void collectAddress(in AUTF8String aAddresses, in boolean aCreateCard,
+ in unsigned long aSendFormat);
+
+ /**
+ * Collects a single name and email address into the address book.
+ * By default, it saves the address without checking for an existing one.
+ * See collectAddress for the general implementation.
+ *
+ * @param aEmail The email address to collect.
+ * @param aDisplayName The display name associated with the email address.
+ * @param aCreateCard Set to true if a card should be created if the
+ * email address doesn't exist (ignored if
+ * aSkipCheckExisting is true).
+ * @param aSendFormat The send format to save for the card. See
+ * nsIAbPreferMailFormat for values. If updating a card
+ * this value will only be changed if the current value
+ * for the card is "unknown".
+ * @param aSkipCheckExisting Optional parameter, if this is set then the
+ * implementation will skip checking for an
+ * existing card, and just create a new card.
+ */
+ void collectSingleAddress(in AUTF8String aEmail, in AUTF8String aDisplayName,
+ in boolean aCreateCard,
+ in unsigned long aSendFormat,
+ [optional] in boolean aSkipCheckExisting);
+};
diff --git a/mailnews/addrbook/public/nsIAbAutoCompleteResult.idl b/mailnews/addrbook/public/nsIAbAutoCompleteResult.idl
new file mode 100644
index 000000000..f54290acc
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbAutoCompleteResult.idl
@@ -0,0 +1,36 @@
+/* -*- 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 "nsIAutoCompleteResult.idl"
+
+interface nsIAbCard;
+
+/**
+ * This interface is used to extend the nsIAutoCompleteResult interface to
+ * provide extra facilities for obtaining more details of the results of
+ * an address book search.
+ */
+[scriptable, uuid(c0d35623-f719-4e43-ae24-573e393f87f9)]
+interface nsIAbAutoCompleteResult : nsIAutoCompleteResult {
+ /**
+ * Get the card from the result at the given index
+ */
+ nsIAbCard getCardAt(in long index);
+
+ /**
+ * Gets the email to use for the card within the result at the given index.
+ * This is the email that was matched against for the card where there are
+ * multiple email addresses on a card.
+ *
+ * @param index Index of the autocomplete result to return the value for.
+ * @result The email address to use from the card.
+ */
+ AString getEmailToUse(in long index);
+
+ /**
+ * The template used to build the query for this search. Optional.
+ */
+ attribute AString modelQuery;
+};
diff --git a/mailnews/addrbook/public/nsIAbBooleanExpression.idl b/mailnews/addrbook/public/nsIAbBooleanExpression.idl
new file mode 100644
index 000000000..aeef67b46
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbBooleanExpression.idl
@@ -0,0 +1,122 @@
+/* -*- 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"
+
+interface nsIArray;
+typedef long nsAbBooleanConditionType;
+
+/**
+ * Condition types
+ *
+ * Constants defining the types of condition
+ * to obtain a boolean result of TRUE or FALSE
+ *
+ */
+[scriptable, uuid(F51387B1-5AEF-4A1C-830E-7CD3B02366CE)]
+interface nsIAbBooleanConditionTypes
+{
+ const long Exists = 0;
+ const long DoesNotExist = 1;
+ const long Contains = 2;
+ const long DoesNotContain = 3;
+ const long Is = 4;
+ const long IsNot = 5;
+ const long BeginsWith = 6;
+ const long EndsWith = 7;
+ const long LessThan = 8;
+ const long GreaterThan = 9;
+ const long SoundsLike = 10;
+ const long RegExp = 11;
+};
+
+
+typedef long nsAbBooleanOperationType;
+
+/*
+ * Operation types
+ *
+ * Constants defining the boolean operation that
+ * should be performed between two boolean expressions
+ *
+ */
+[uuid(9bdd2e51-2be4-49a4-a558-36d1a812231a)]
+interface nsIAbBooleanOperationTypes
+{
+ const long AND = 0;
+ const long OR = 1;
+ const long NOT = 2;
+};
+
+
+/**
+ * String condition
+ *
+ * A string condition represents a leaf node in a
+ * boolean expression tree and represents
+ * test which will return TRUE or FALSE
+ *
+ * Condition is an expression which is a
+ * leaf node in a boolean expression tree
+ *
+ */
+[scriptable, uuid(C3869D72-CFD0-45F0-A0EC-3F67D83C7110)]
+interface nsIAbBooleanConditionString : nsISupports
+{
+ /**
+ * The condition for how the a value
+ * should be compared
+ *
+ */
+ attribute nsAbBooleanConditionType condition;
+
+ /**
+ * The lhs of the condition
+ *
+ * Represents a property name which
+ * should be evaluated to obtain the
+ * lhs.
+ *
+ */
+ attribute string name;
+
+ /**
+ * The rhs of the condition
+ *
+ * <name> [condition] value
+ *
+ */
+ attribute wstring value;
+};
+
+/**
+ * N Boolean expression type
+ *
+ * Supports Unary Binary and N boolean expressions
+ *
+ * An operation represents a node in a boolean
+ * expression tree which may contain one or more
+ * child conditions or expressions
+ *
+ */
+[scriptable, uuid(223a9462-1aeb-4c1f-b069-5fc6278989b2)]
+interface nsIAbBooleanExpression: nsISupports
+{
+ /**
+ * The boolean operation to be applied to
+ * results of all evaluated expressions
+ *
+ */
+ attribute nsAbBooleanOperationType operation;
+
+ /**
+ * List of peer expressions
+ *
+ * e1 [op] e2 [op] .... en
+ *
+ */
+ attribute nsIArray expressions;
+};
+
diff --git a/mailnews/addrbook/public/nsIAbCard.idl b/mailnews/addrbook/public/nsIAbCard.idl
new file mode 100644
index 000000000..ccd1c4c43
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbCard.idl
@@ -0,0 +1,358 @@
+/* -*- 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 "nsIAbItem.idl"
+
+interface nsISimpleEnumerator;
+interface nsIVariant;
+
+[scriptable, uuid(97448252-F189-11d4-A422-001083003D0C)]
+interface nsIAbPreferMailFormat {
+ const unsigned long unknown = 0;
+ const unsigned long plaintext = 1;
+ const unsigned long html = 2;
+};
+
+/**
+ * An interface representing an address book card.
+ *
+ * The UUID of a card is a composition of a directory ID and a per-directory ID.
+ * The per-directory ID is reflected in the localId property. If either of these
+ * properties change, the UUID will change correspondingly.
+ *
+ * None of these IDs will be reflected in the property collection. Neither
+ * nsIAbCard::properties, nsIAbCard::deleteProperty, nor any of the property
+ * getters and setters are able to interact with these properties.
+ *
+ * Fundamentally, a card is a collection of properties. Modifying a property in
+ * some way on a card does not change the backend used to store the card; the
+ * directory is required to do make the changes here.
+ *
+ * The following are the core properties that are used:
+ * - Names:
+ * - FirstName, LastName
+ * - PhoneticFirstName, PhoneticLastName
+ * - DisplayName, NickName
+ * - SpouseName, FamilyName
+ * - PrimaryEmail, SecondEmail
+ * - Home Contact:
+ * - HomeAddress, HomeAddress2, HomeCity, HomeState, HomeZipCode, HomeCountry
+ * - HomePhone, HomePhoneType
+ * - Work contact. Same as home, but with `Work' instead of `Home'
+ * - Other Contact:
+ * - FaxNumber, FaxNumberType
+ * - PagerNumber, PagerNumberType
+ * - CellularNumber, CellularNumberType
+ * - JobTitle, Department, Company
+ * - _AimScreenName
+ * - Dates:
+ * - AnniversaryYear, AnniversaryMonth, AnniversaryDay
+ * - BirthYear, BirthMonth, BirthDay
+ * - WebPage1 (work), WebPage2 (home)
+ * - Custom1, Custom2, Custom3, Custom4
+ * - Notes
+ * - Integral properties:
+ * - LastModifiedDate
+ * - PopularityIndex
+ * - PreferMailFormat (see nsIAbPreferMailFormat)
+ * - Photo properties:
+ * - PhotoName
+ * - PhotoType
+ * - PhotoURI
+ *
+ * The contract id for the standard implementation is
+ * <tt>\@mozilla.org/addressbook/cardproperty;1</tt>.
+ */
+[scriptable, uuid(9bddf024-5178-4097-894e-d84b4ddde101)]
+interface nsIAbCard : nsIAbItem {
+ /**
+ * The UUID for the nsIAbDirectory containing this card.
+ *
+ * The directory considered to contain this card is the directory which
+ * produced this card (e.g., through nsIAbDirectory::getCardForProperty) or
+ * the last directory to modify this card, if another directory did so. If the
+ * last directory to modify this card deleted it, then this card is considered
+ * unassociated.
+ *
+ * If this card is not associated with a directory, this string will be empty.
+ *
+ * There is no standardized way to associate a card with multiple directories.
+ *
+ * Consumers of this interface outside of directory implementations SHOULD
+ * NOT, in general, modify this property.
+ */
+ attribute AUTF8String directoryId;
+
+ /**
+ * The per-directory ID of this card.
+ *
+ * This property is the second part of the tuple logically representing a card
+ * UUID. It shares many requirements with that of nsIAbItem::uuid. In
+ * particular:
+ * - It MUST be unique (within the scope of its directory).
+ * - The empty string MUST only be used to indicate that it has not yet been
+ * assigned a localId.
+ * - It is STRONGLY RECOMMENDED that this id is consistent across sessions and
+ * that, should the card be deleted, its ids will not be reused.
+ * - The format of localId is left undefined.
+ *
+ * As long as directoryId is not changed, this property SHOULD NOT be changed.
+ * If directoryId is changed, the new directory MAY choose to reuse the same
+ * localId if reasonable. However, consumers MUST NOT assume that two cards
+ * with different directoryIds but the same localId are logically the same
+ * card.
+ *
+ * Similar to directoryId, consumers of cards outside of directory
+ * implementations SHOULD NOT, in general, modify this property.
+ */
+ attribute AUTF8String localId;
+
+ /**
+ * A list of all the properties that this card has as an enumerator, whose
+ * members are all nsIProperty objects.
+ */
+ readonly attribute nsISimpleEnumerator properties;
+
+ /**
+ * Returns a property for the given name.
+ *
+ * @param name The case-sensitive name of the property to get.
+ * @param defaultValue The value to return if the property does not exist.
+ * @exception NS_ERROR_NOT_AVAILABLE if the named property does not exist.
+ * @exception NS_ERROR_CANNOT_CONVERT_DATA if the property cannot be converted
+ * to the desired type.
+ */
+ nsIVariant getProperty(in AUTF8String name, in nsIVariant defaultValue);
+ /**
+ * @{
+ * Returns a property for the given name. Javascript callers should NOT use these,
+ * but use getProperty instead. XPConnect will do the type conversion automagically.
+ *
+ * These functions convert values in the same manner as the default
+ * implementation of nsIVariant. Of particular note is that boolean variables
+ * are converted to integers as in C/C++ (true is a non-zero value), so that
+ * false will be converted to a string of "0" and not "false."
+ *
+ *
+ * @param name The case-sensitive name of the property to get.
+ * @exception NS_ERROR_NOT_AVAILABLE if the named property does not exist.
+ * @exception NS_ERROR_CANNOT_CONVERT_DATA if the property cannot be converted
+ * to the desired type.
+ */
+ AString getPropertyAsAString(in string name);
+ AUTF8String getPropertyAsAUTF8String(in string name);
+ unsigned long getPropertyAsUint32(in string name);
+ boolean getPropertyAsBool(in string name);
+
+ /** @} */
+
+ /**
+ * Assigns the given to value to the property of the given name.
+ *
+ * Should the property exist, its value will be overwritten. An
+ * implementation may impose additional semantic constraints for certain
+ * properties. However, such constraints might not be checked by this method.
+ *
+ * @warning A value MUST be convertible to a string; if this convention is not
+ * followed, consumers of cards may fail unpredictably or return incorrect
+ * results.
+ *
+ * @param name The case-sensitive name of the property to set.
+ * @param value The new value of the property.
+ */
+ void setProperty(in AUTF8String name, in nsIVariant value);
+
+ /**
+ * @{
+ * Sets a property for the given name. Javascript callers should NOT use these,
+ * but use setProperty instead. XPConnect will do the type conversion automagically.
+ *
+ * These functions convert values in the same manner as the default
+ * implementation of nsIVariant.
+ */
+ void setPropertyAsAString(in string name, in AString value);
+ void setPropertyAsAUTF8String(in string name, in AUTF8String value);
+ void setPropertyAsUint32(in string name, in unsigned long value);
+ void setPropertyAsBool(in string name, in boolean value);
+
+ /** @} */
+
+ /**
+ * Deletes the property with the given name.
+ *
+ * Some properties may not be deleted. However, the implementation will not
+ * check this constraint at this method. If such a property is deleted, an
+ * error may be thrown when the card is modified at the database level.
+ *
+ * @param name The case-sensitive name of the property to set.
+ */
+ void deleteProperty(in AUTF8String name);
+
+ /**
+ * @{
+ * These properties are shorthand for getProperty and setProperty.
+ */
+ attribute AString firstName;
+ attribute AString lastName;
+ attribute AString displayName;
+ attribute AString primaryEmail;
+ /** @} */
+
+ /**
+ * Determines whether or not a card has the supplied email address in either
+ * of its PrimaryEmail or SecondEmail attributes.
+ *
+ * Note: This function is likely to be temporary whilst we work out proper
+ * APIs for multi-valued attributes in bug 118665.
+ *
+ * @param aEmailAddress The email address to attempt to match against.
+ * @return True if aEmailAddress matches any of the email
+ * addresses stored in the card.
+ */
+ boolean hasEmailAddress(in AUTF8String aEmailAddress);
+
+ /**
+ * Translates a card into a specific format.
+ * The following types are supported:
+ * - base64xml
+ * - xml
+ * - vcard
+ *
+ * @param aType The type of item to translate the card into.
+ * @return A string containing the translated card.
+ * @exception NS_ERROR_ILLEGAL_VALUE if we do not recognize the type.
+ */
+ AUTF8String translateTo(in AUTF8String aType);
+
+ /**
+ * Translates a card from the specified format
+ */
+ //void translateFrom(in AUTF8String aType, in AUTF8String aData);
+
+ /**
+ * Generate a phonetic name from the card, using the firstName and lastName
+ * values.
+ *
+ * @param aLastNameFirst Set to True to put the last name before the first.
+ * @return A string containing the generated phonetic name.
+ */
+ AString generatePhoneticName(in boolean aLastNameFirst);
+
+ /**
+ * Generate a chat name from the card, containing the value of the
+ * first non-empty chat field.
+ *
+ * @return A string containing the generated chat name.
+ */
+ AString generateChatName();
+
+ /**
+ * This function will copy all values from one card to another.
+ *
+ * @param srcCard The source card to copy values from.
+ */
+ void copy(in nsIAbCard aSrcCard);
+
+ /**
+ * Returns true if this card is equal to the other card.
+ *
+ * The default implementation defines equal as this card pointing to the
+ * same object as @arg aCard; another implementation defines it as equality of
+ * properties and values.
+ *
+ * @warning The exact nature of equality is still undefined, and actual
+ * results may not match theoretical results. Most notably, the code
+ * <tt>a.equals(b) == b.equals(a)</tt> might not return true. In
+ * particular, calling equals on cards from different address books
+ * may return inaccurate results.
+ *
+ *
+ * @return Equality, as defined above.
+ * @param aCard The card to compare against.
+ */
+ boolean equals(in nsIAbCard aCard);
+
+ // PROPERTIES TO BE DELETED AS PART OF REWRITE
+
+ attribute boolean isMailList;
+ /**
+ * If isMailList is true then mailListURI
+ * will contain the URI of the associated
+ * mail list
+ */
+ attribute string mailListURI;
+};
+
+%{C++
+// A nice list of properties for the benefit of C++ clients
+#define kFirstNameProperty "FirstName"
+#define kLastNameProperty "LastName"
+#define kDisplayNameProperty "DisplayName"
+#define kNicknameProperty "NickName"
+#define kPriEmailProperty "PrimaryEmail"
+#define kPreferMailFormatProperty "PreferMailFormat"
+#define kLastModifiedDateProperty "LastModifiedDate"
+#define kPopularityIndexProperty "PopularityIndex"
+
+#define kPhoneticFirstNameProperty "PhoneticFirstName"
+#define kPhoneticLastNameProperty "PhoneticLastName"
+#define kSpouseNameProperty "SpouseName"
+#define kFamilyNameProperty "FamilyName"
+#define k2ndEmailProperty "SecondEmail"
+
+#define kHomeAddressProperty "HomeAddress"
+#define kHomeAddress2Property "HomeAddress2"
+#define kHomeCityProperty "HomeCity"
+#define kHomeStateProperty "HomeState"
+#define kHomeZipCodeProperty "HomeZipCode"
+#define kHomeCountryProperty "HomeCountry"
+#define kHomeWebPageProperty "WebPage2"
+
+#define kWorkAddressProperty "WorkAddress"
+#define kWorkAddress2Property "WorkAddress2"
+#define kWorkCityProperty "WorkCity"
+#define kWorkStateProperty "WorkState"
+#define kWorkZipCodeProperty "WorkZipCode"
+#define kWorkCountryProperty "WorkCountry"
+#define kWorkWebPageProperty "WebPage1"
+
+#define kHomePhoneProperty "HomePhone"
+#define kHomePhoneTypeProperty "HomePhoneType"
+#define kWorkPhoneProperty "WorkPhone"
+#define kWorkPhoneTypeProperty "WorkPhoneType"
+#define kFaxProperty "FaxNumber"
+#define kFaxTypeProperty "FaxNumberType"
+#define kPagerTypeProperty "PagerNumberType"
+#define kPagerProperty "PagerNumber"
+#define kCellularProperty "CellularNumber"
+#define kCellularTypeProperty "CellularNumberType"
+
+#define kJobTitleProperty "JobTitle"
+#define kDepartmentProperty "Department"
+#define kCompanyProperty "Company"
+#define kScreenNameProperty "_AimScreenName"
+#define kCustom1Property "Custom1"
+#define kCustom2Property "Custom2"
+#define kCustom3Property "Custom3"
+#define kCustom4Property "Custom4"
+#define kNotesProperty "Notes"
+
+#define kGtalkProperty "_GoogleTalk"
+#define kAIMProperty "_AimScreenName"
+#define kYahooProperty "_Yahoo"
+#define kSkypeProperty "_Skype"
+#define kQQProperty "_QQ"
+#define kMSNProperty "_MSN"
+#define kICQProperty "_ICQ"
+#define kXMPPProperty "_JabberId"
+#define kIRCProperty "_IRC"
+
+#define kAnniversaryYearProperty "AnniversaryYear"
+#define kAnniversaryMonthProperty "AnniversaryMonth"
+#define kAnniversaryDayProperty "AnniversaryDay"
+#define kBirthYearProperty "BirthYear"
+#define kBirthMonthProperty "BirthMonth"
+#define kBirthDayProperty "BirthDay"
+%}
diff --git a/mailnews/addrbook/public/nsIAbCollection.idl b/mailnews/addrbook/public/nsIAbCollection.idl
new file mode 100644
index 000000000..1efbcce16
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbCollection.idl
@@ -0,0 +1,92 @@
+/* -*- 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 "nsIAbItem.idl"
+
+interface nsIAbCard;
+interface nsISimpleEnumerator;
+
+/**
+ * A collection of address book items.
+ */
+[scriptable, uuid(70f6123f-e06b-4101-9750-4ce73b38134b)]
+interface nsIAbCollection : nsIAbItem {
+
+ /**
+ * Returns true if this collection is read-only.
+ */
+ readonly attribute boolean readOnly;
+
+ /**
+ * Returns true if this collection is accessed over a network connection.
+ */
+ readonly attribute boolean isRemote;
+
+ /**
+ * Returns true if this collection is accessed over a secure connection.
+ *
+ * If isRemote returns false, then this value MUST be false as well.
+ */
+ readonly attribute boolean isSecure;
+
+ /**
+ * Returns an address book card for the specified email address if found.
+ *
+ * If there are multiple cards with the given email address, this method will
+ * return one of these cards in an implementation-defined manner.
+ *
+ * Matching is performed in a case-insensitive manner.
+ *
+ * This method performs a synchronous operation. If the collection cannot do
+ * the search in such a manner, then it should throw NS_ERROR_NOT_IMPLEMENTED.
+ *
+ * @param emailAddress The email address to find in any of the email address
+ * fields. If emailAddress is empty, the database won't
+ * be searched and the function will return as if no card
+ * was found.
+ * @return An nsIAbCard if one was found, else returns NULL.
+ * @exception NS_ERROR_NOT_IMPLEMENTED If the collection cannot do this.
+ */
+ nsIAbCard cardForEmailAddress(in AUTF8String emailAddress);
+
+ /**
+ * Returns an address book card for the specified property if found.
+ *
+ * If there are multiple cards with the given value for the property, this
+ * method will return one of these cards in an implementation-defined manner.
+ *
+ * This method performs a synchronous operation. If the collection cannot do
+ * the search in such a manner, then it should throw NS_ERROR_NOT_IMPLEMENTED.
+ *
+ * If the property is not natively a string, it can still be searched for
+ * using the string-encoded value of the property, e.g. "0". See
+ * nsIAbCard::getPropertyAsAUTF8String for more information. Empty values will
+ * return no match, to prevent spurious results.
+ *
+ * @param aProperty The property to look for.
+ * @param aValue The value to search for.
+ * @param aCaseSensitive True if matching should be done case-sensitively.
+ * @result An nsIAbCard if one was found, else returns NULL.
+ * @exception NS_ERROR_NOT_IMPLEMENTED If the collection cannot do this.
+ */
+ nsIAbCard getCardFromProperty(in string aProperty, in AUTF8String aValue,
+ in boolean aCaseSensitive);
+
+ /**
+ * Returns all address book cards with a specific property matching value
+ *
+ * This function is almost identical to getCardFromProperty, with the
+ * exception of returning all cards rather than just the first.
+ *
+ * @param aProperty The property to look for.
+ * @param aValue The value to search for.
+ * @param aCaseSensitive True if matching should be done case-sensitively.
+ * @result A nsISimpleEnumerator that holds nsIAbCard
+ * instances.
+ */
+ nsISimpleEnumerator getCardsFromProperty(in string aProperty,
+ in AUTF8String aValue,
+ in boolean aCaseSensitive);
+};
diff --git a/mailnews/addrbook/public/nsIAbDirFactory.idl b/mailnews/addrbook/public/nsIAbDirFactory.idl
new file mode 100644
index 000000000..3be1f6394
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbDirFactory.idl
@@ -0,0 +1,35 @@
+/* -*- 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);
+};
+
diff --git a/mailnews/addrbook/public/nsIAbDirFactoryService.idl b/mailnews/addrbook/public/nsIAbDirFactoryService.idl
new file mode 100644
index 000000000..8276d17ba
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbDirFactoryService.idl
@@ -0,0 +1,28 @@
+/* -*- 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);
+};
+
diff --git a/mailnews/addrbook/public/nsIAbDirSearchListener.idl b/mailnews/addrbook/public/nsIAbDirSearchListener.idl
new file mode 100644
index 000000000..2e8455c79
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbDirSearchListener.idl
@@ -0,0 +1,15 @@
+/* -*- 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 nsIAbCard;
+
+[scriptable, uuid(eafe2488-4efb-4ac8-a6b4-7756eb1650a3)]
+interface nsIAbDirSearchListener : nsISupports {
+ void onSearchFinished(in long aResult, in AString aErrorMsg);
+
+ void onSearchFoundCard(in nsIAbCard aCard);
+};
diff --git a/mailnews/addrbook/public/nsIAbDirectory.idl b/mailnews/addrbook/public/nsIAbDirectory.idl
new file mode 100644
index 000000000..e3e52beec
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbDirectory.idl
@@ -0,0 +1,296 @@
+/* -*- 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 "nsIAbCollection.idl"
+#include "nsIAbCard.idl"
+
+interface nsISimpleEnumerator;
+interface nsIArray;
+interface nsIMutableArray;
+
+/* moz-abdirectory:// is the URI to access nsAbBSDirectory,
+ * which is the root directory for all types of address books
+ * this is used to get all address book directories. */
+
+%{C++
+#define kAllDirectoryRoot "moz-abdirectory://"
+
+#define kPersonalAddressbook "abook.mab"
+#define kPersonalAddressbookUri "moz-abmdbdirectory://abook.mab"
+#define kCollectedAddressbook "history.mab"
+#define kCollectedAddressbookUri "moz-abmdbdirectory://history.mab"
+
+#define kABFileName_PreviousSuffix ".na2" /* final v2 address book format */
+#define kABFileName_PreviousSuffixLen 4
+#define kABFileName_CurrentSuffix ".mab" /* v3 address book extension */
+%}
+
+/**
+ * A top-level address book directory.
+ *
+ * Please note that in order to be properly instantiated by nsIAbManager, every
+ * type of nsIAbDirectory must have a contract ID of the form:
+ *
+ * @mozilla.org/addressbook/directory;1?type=<AB URI Scheme>
+ *
+ * Where AB URI Scheme does not include the ://. For example, for the Mork-based
+ * address book, the scheme is "moz-abmdbdirectory", so the contract ID for
+ * the Mork-based address book type is:
+ *
+ * @mozilla.org/addressbook/directory;1?type=moz-abmdbdirectory
+ *
+ * The UUID of an nsIAbDirectory is its preference ID and its name, concatenated
+ * together.
+ */
+[scriptable, uuid(72dc868b-db5b-4daa-b6c6-071be4a05d02)]
+interface nsIAbDirectory : nsIAbCollection {
+
+ /**
+ * The chrome URI to use for bringing up a dialog to edit this directory.
+ * When opening the dialog, use a JS argument of
+ * {selectedDirectory: thisdir} where thisdir is this directory that you just
+ * got the chrome URI from.
+ */
+ readonly attribute ACString propertiesChromeURI;
+
+ /**
+ * The description of the directory. If this directory is not a mailing list,
+ * then setting this attribute will send round a "DirName" update via
+ * nsIAddrBookSession.
+ */
+ attribute AString dirName;
+
+ // XXX This should really be replaced by a QI or something better
+ readonly attribute long dirType;
+
+ // eliminated a bit more.
+
+ // The filename for address books within this directory.
+ readonly attribute ACString fileName;
+
+ // The URI of the address book
+ readonly attribute ACString URI;
+
+ // The position of the directory on the display.
+ readonly attribute long position;
+
+ // will be used for LDAP replication
+ attribute unsigned long lastModifiedDate;
+
+ // Defines whether this directory is a mail
+ // list or not
+ attribute boolean isMailList;
+
+ // Get the children directories
+ readonly attribute nsISimpleEnumerator childNodes;
+
+ /**
+ * Get the cards associated with the directory. This will return the cards
+ * associated with the mailing lists too.
+ */
+ readonly attribute nsISimpleEnumerator childCards;
+
+ /**
+ * Returns true if this directory represents a query - i.e. the rdf resource
+ * was something like moz-abmdbdirectory://abook.mab?....
+ */
+ readonly attribute boolean isQuery;
+
+ /**
+ * Initializes a directory, pointing to a particular
+ * URI
+ */
+ void init(in string aURI);
+
+ // Deletes either a mailing list or a top
+ // level directory, which also updates the
+ // preferences
+ void deleteDirectory(in nsIAbDirectory directory);
+
+ // Check if directory contains card
+ // If the implementation is asynchronous the card
+ // may not yet have arrived. If it is in the process
+ // of obtaining cards the method will throw an
+ // NS_ERROR_NOT_AVAILABLE exception if the card
+ // cannot be found.
+ boolean hasCard(in nsIAbCard cards);
+
+ // Check if directory contains directory
+ boolean hasDirectory(in nsIAbDirectory dir);
+
+ // Check if directory contains a mailinglist by name
+ boolean hasMailListWithName(in wstring aName);
+
+ /**
+ * Adds a card to the database.
+ *
+ * This card does not need to be of the same type as the database, e.g., one
+ * can add an nsIAbLDAPCard to an nsIAbMDBDirectory.
+ *
+ * @return "Real" card (eg nsIAbLDAPCard) that can be used for some
+ * extra functions.
+ */
+ nsIAbCard addCard(in nsIAbCard card);
+
+ /**
+ * Modifies a card in the database to match that supplied.
+ */
+ void modifyCard(in nsIAbCard modifiedCard);
+
+ /**
+ * Deletes the array of cards from the database.
+ *
+ * @param aCards The cards to delete from the database.
+ */
+ void deleteCards(in nsIArray aCards);
+
+ void dropCard(in nsIAbCard card, in boolean needToCopyCard);
+
+ /**
+ * Whether or not the directory should be searched when doing autocomplete,
+ * (currently by using GetChildCards); LDAP does not support this in online
+ * mode, so that should return false; additionally any other directory types
+ * that also do not support GetChildCards should return false.
+ *
+ * @param aIdentity An optional parameter detailing the identity key (see
+ * nsIMsgAccountManager) that this autocomplete is being
+ * run against.
+ * @return True if this directory should/can be used during
+ * local autocomplete.
+ */
+ boolean useForAutocomplete(in ACString aIdentityKey);
+
+ /**
+ * Does this directory support mailing lists? Note that in the case
+ * this directory is a mailing list and nested mailing lists are not
+ * supported, this will return false rather than true which the parent
+ * directory might.
+ */
+ readonly attribute boolean supportsMailingLists;
+
+ /**
+ * This attribute serves two purposes
+ * 1. If this directory is not a mail list, directories are stored here
+ * 2. If it is a mail list card entries are stored here
+ *
+ * @note This is a *live* array and not a static copy
+ */
+ attribute nsIMutableArray addressLists;
+
+ // Specific to a directory which stores mail lists
+
+ /**
+ * Creates a new mailing list in the directory. Currently only supported
+ * for top-level directories.
+ *
+ * @param list The new mailing list to add.
+ * @return The mailing list directory added, which may have been modified.
+ */
+ nsIAbDirectory addMailList(in nsIAbDirectory list);
+
+ /**
+ * Nick Name of the mailing list. This attribute is only really used when
+ * the nsIAbDirectory represents a mailing list.
+ */
+ attribute AString listNickName;
+
+ /**
+ * Description of the mailing list. This attribute is only really used when
+ * the nsIAbDirectory represents a mailing list.
+ */
+ attribute AString description;
+
+ /**
+ * Edits an existing mailing list (specified as listCard) into its parent
+ * directory. You should call this function on the resource with the same
+ * uri as the listCard.
+ *
+ * @param listCard A nsIAbCard version of the mailing list with the new
+ * values.
+ */
+ void editMailListToDatabase(in nsIAbCard listCard);
+
+ // 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.
+ */
+ attribute ACString dirPrefId;
+
+ /**
+ * @name getXXXValue
+ *
+ * Helper functions to get different types of pref, but return a default
+ * value if a pref value was not obtained.
+ *
+ * @param aName The name of the pref within the branch dirPrefId to
+ * get a value from.
+ *
+ * @param aDefaultValue The default value to return if getting the pref fails
+ * or the pref is not present.
+ *
+ * @return The value of the pref or the default value.
+ *
+ * @exception NS_ERROR_NOT_INITIALIZED if the pref branch couldn't
+ * be obtained (e.g. dirPrefId isn't set).
+ */
+ //@{
+ long getIntValue(in string aName, in long aDefaultValue);
+ boolean getBoolValue(in string aName, in boolean aDefaultValue);
+ ACString getStringValue(in string aName, in ACString aDefaultValue);
+ AUTF8String getLocalizedStringValue(in string aName, in AUTF8String aDefaultValue);
+ //@}
+
+ /**
+ * The following attributes are read from an nsIAbDirectory via the above methods:
+ *
+ * HidesRecipients (Boolean)
+ * If true, and this nsIAbDirectory is a mailing list, then when sending mail to
+ * this list, recipients addresses will be hidden from one another by sending
+ * via BCC.
+ */
+
+ /**
+ * @name setXXXValue
+ *
+ * Helper functions to set different types of pref values.
+ *
+ * @param aName The name of the pref within the branch dirPrefId to
+ * get a value from.
+ *
+ * @param aValue The value to set the pref to.
+ *
+ * @exception NS_ERROR_NOT_INITIALIZED if the pref branch couldn't
+ * be obtained (e.g. dirPrefId isn't set).
+ */
+ //@{
+ void setIntValue(in string aName, in long aValue);
+ void setBoolValue(in string aName, in boolean aValue);
+ void setStringValue(in string aName, in ACString aValue);
+ void setLocalizedStringValue(in string aName, in AUTF8String aValue);
+ //@}
+
+};
diff --git a/mailnews/addrbook/public/nsIAbDirectoryQuery.idl b/mailnews/addrbook/public/nsIAbDirectoryQuery.idl
new file mode 100644
index 000000000..11a82d926
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbDirectoryQuery.idl
@@ -0,0 +1,164 @@
+/* -*- 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"
+
+interface nsIAbDirSearchListener;
+interface nsIAbCard;
+interface nsIAbDirectory;
+
+/**
+ * The arguments for a query.
+ *
+ * Contains an expression for perform matches
+ * and an array of properties which should be
+ * returned if a match is found from the expression
+ *
+ */
+[scriptable, uuid(03af3018-2590-4f4c-a88c-1fff6595ef05)]
+interface nsIAbDirectoryQueryArguments : nsISupports
+{
+ /**
+ * Defines the boolean expression for
+ * the matching of cards
+ *
+ */
+ attribute nsISupports expression;
+
+ /**
+ * Defines if sub directories should be
+ * queried
+ *
+ */
+ attribute boolean querySubDirectories;
+
+ /**
+ * A parameter which can be used to pass in data specific to a particular
+ * type of addressbook.
+ */
+ attribute nsISupports typeSpecificArg;
+
+ /**
+ * A custom search filter which user wants to use in LDAP query.
+ */
+ attribute AUTF8String filter;
+};
+
+
+[scriptable, uuid(3A6E0C0C-1DD2-11B2-B23D-EA3A8CCB333C)]
+interface nsIAbDirectoryQueryPropertyValue : nsISupports
+{
+ /**
+ * The property which should be matched
+ *
+ * For example 'primaryEmail' or 'homePhone'
+ * for card properties.
+ *
+ * Two further properties are defined that
+ * do not exist as properties on a card.
+ *
+ * 'card:nsIAbCard' which represents the interface
+ * of a card component
+ *
+ */
+ readonly attribute string name;
+
+ /**
+ * The value of the property
+ *
+ */
+ readonly attribute wstring value;
+
+ /**
+ * The value of the property
+ * as an interface
+ *
+ * Only valid if the corresponding
+ * property name is related to an
+ * interface instead of a wstring
+ *
+ */
+ readonly attribute nsISupports valueISupports;
+};
+
+[scriptable, uuid(516e7ffa-69bc-41db-a493-dfb4895832f3)]
+interface nsIAbDirectoryQueryResultListener : nsISupports
+{
+ /**
+ * Called when a match is found. May be called from a different thread to
+ * the one that initiates the query.
+ *
+ * @param aCard An individual result associated returned from a query
+ */
+ void onQueryFoundCard(in nsIAbCard aCard);
+
+ /**
+ * List of defined query results
+ *
+ */
+ const long queryResultMatch = 0;
+ const long queryResultComplete = 1;
+ const long queryResultStopped = 2;
+ const long queryResultError = 3;
+
+ /**
+ * Called when a query has finished. May be called from a different thread
+ * to the one that initiates the query.
+ *
+ * @param aResult A result code from the list above.
+ *
+ * @param aErrorCode An error code specific to the type of query.
+ */
+ void onQueryResult(in long aResult, in long aErrorCode);
+};
+
+[scriptable, uuid(60b5961c-ce61-47b3-aa99-6d865f734dee)]
+interface nsIAbDirectoryQuery : nsISupports
+{
+ /**
+ * Initiates a query on a directory and sub-directories for properties
+ * on cards
+ *
+ * @param aDirectory A directory that the query may get extra details
+ * from.
+ *
+ * @param aArguments The properties and values to match value could of
+ * type nsIAbDirectoryQueryMatchItem for matches other
+ * than ?contains?
+ *
+ * @param aListener The listener which will obtain individual query
+ * results.
+ *
+ * @param aResultLimit Limits the number of results returned to a maximum
+ * value.
+ *
+ * @param aTimeOut The maximum length of time for the query
+ *
+ * @return A context id for the query
+ */
+ long doQuery(in nsIAbDirectory aDirectory,
+ in nsIAbDirectoryQueryArguments aArguments,
+ in nsIAbDirSearchListener aListener,
+ in long aResultLimit,
+ in long aTimeOut);
+
+ /**
+ * Stops an existing query operation if
+ * query operation is asynchronous
+ *
+ * The nsIAbDirectoryQueryResultListener will
+ * be notified when query has stopped
+ *
+ * It is implementation specific if notification
+ * synchronous or asynchronous
+ *
+ * @param contextID
+ * The unique number returned from
+ * the doQuery methods
+ *
+ */
+ void stopQuery (in long contextID);
+};
diff --git a/mailnews/addrbook/public/nsIAbDirectoryQueryProxy.idl b/mailnews/addrbook/public/nsIAbDirectoryQueryProxy.idl
new file mode 100644
index 000000000..68e2923cd
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbDirectoryQueryProxy.idl
@@ -0,0 +1,14 @@
+/* -*- 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 "nsIAbDirectoryQuery.idl"
+
+[scriptable, uuid(b8034849-1e98-4d39-819c-15ba61a7434f)]
+interface nsIAbDirectoryQueryProxy : nsIAbDirectoryQuery
+{
+ void initiate();
+};
+
diff --git a/mailnews/addrbook/public/nsIAbDirectorySearch.idl b/mailnews/addrbook/public/nsIAbDirectorySearch.idl
new file mode 100644
index 000000000..818684499
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbDirectorySearch.idl
@@ -0,0 +1,53 @@
+/* -*- 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"
+
+/**
+ * Searching of cards on a directory.
+ *
+ * The search data is defined in the query
+ * section of the directory URI, for example
+ *
+ * moz-abldapdirectory://ldap1.holland/dc=sun,dc=com?<query>
+ *
+ * If no search data is defined then the methods
+ * will return immediately with no error.
+ */
+[scriptable, uuid(ABF26047-37E3-44FD-A28A-6D37A1B9CCB3)]
+interface nsIAbDirectorySearch : nsISupports
+{
+ /**
+ * Starts a search on the directory.
+ *
+ * If a search is already being performed
+ * it is stopped.
+ *
+ * The results from a search, cards, will
+ * returned by informing the address book
+ * session that a new card has been added
+ * to the directory.
+ *
+ * The nsIAbDirectoryQuery implementation
+ * of the directory component (or a proxy)
+ * may be used as an implementation for
+ * this specialization of query.
+ *
+ * This method is semantically equivalent
+ * to the nsIAbDirectory.getChildCards
+ * method when there is search criteria
+ * defined in the directory uri.
+ *
+ */
+ void startSearch ();
+
+ /**
+ * Stops a search on the directory.
+ *
+ */
+ void stopSearch ();
+};
+
diff --git a/mailnews/addrbook/public/nsIAbItem.idl b/mailnews/addrbook/public/nsIAbItem.idl
new file mode 100644
index 000000000..adda32d96
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbItem.idl
@@ -0,0 +1,90 @@
+/* -*- 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 nsIMsgHeaderParser;
+interface nsIStringBundle;
+
+/**
+ * A containable item for address books.
+ */
+[scriptable, uuid(bb691a55-cbfe-4cf8-974a-e18cfa845a73)]
+interface nsIAbItem : nsISupports {
+ /**
+ * A universally-unique identifier for this item.
+ *
+ * If this item cannot be associated with a UUID for some reason, it MUST
+ * return the empty string. The empty string MUST NOT be a valid UUID for any
+ * item. Under no circumstances may this function throw an error.
+ *
+ * It is STRONGLY RECOMMENDED that implementations guarantee that this UUID
+ * will not change between two different sessions of the application and that,
+ * if this item is deleted, the UUID will not be reused.
+ *
+ * The format of the UUID for a generic nsIAbItem is purposefully left
+ * undefined, although any item contained by an nsIAbDirectory SHOULD use
+ * nsIAbManager::generateUUID to generate the UUID.
+ */
+ readonly attribute AUTF8String uuid;
+
+ /**
+ * @{
+ * These constants reflect the possible values of the
+ * mail.addr_book.lastnamefirst preferences. They are intended to be used in
+ * generateName, defined below.
+ */
+ const unsigned long GENERATE_DISPLAY_NAME = 0;
+ const unsigned long GENERATE_LAST_FIRST_ORDER = 1;
+ const unsigned long GENERATE_FIRST_LAST_ORDER = 2;
+ /** @} */
+
+ /**
+ * Generate a name from the item for display purposes.
+ *
+ * If this item is an nsIAbCard, then it will use the aGenerateFormat option
+ * to determine the string to return.
+ * If this item is not an nsIAbCard, then the aGenerateFormat option may be
+ * ignored, and the displayName of the item returned.
+ *
+ * @param aGenerateFormat The format to generate as per the GENERATE_*
+ * constants above.
+ * @param aBundle An optional parameter that is a pointer to a string
+ * bundle that holds:
+ * chrome://messenger/locale/addressbook/addressBook.properties
+ * If this bundle is not supplied, then the function
+ * will obtain the bundle itself. If cached by the
+ * caller and supplied to this function, then
+ * performance will be improved over many calls.
+ * @return A string containing the generated name.
+ */
+ AString generateName(in long aGenerateFormat,
+ [optional] in nsIStringBundle aBundle);
+
+ /**
+ * Generate a formatted email address from the card, that can be used for
+ * sending emails.
+ *
+ * @param aExpandList If this card is a list, and this parameter is set
+ * to true, then the list will be expanded to include
+ * the emails of the cards within the list.
+ * @param aGroupMailLists If this card (or the items within this card) is a
+ * list, and this is set to true, then the list will
+ * be expanded in the RFC 2822 group format
+ * "displayname : email1 ; email2 ; etc".
+ * @param aHeaderParser An optional parameter pointing to the
+ * nsIMsgHeaderParser service. If this is not supplied
+ * the function will obtain the service itself. If
+ * cached by the called and supplied to this function,
+ * then performance will be improved over many calls.
+ * @return A string containing a comma-separated list of
+ * formatted addresses.
+ */
+ //AString generateFormattedEmail(in boolean aExpandList,
+ // in boolean aAsGroupMailLists,
+ // [optional] in nsIMsgHeaderParser aHeaderParser);
+
+};
+
diff --git a/mailnews/addrbook/public/nsIAbLDAPAttributeMap.idl b/mailnews/addrbook/public/nsIAbLDAPAttributeMap.idl
new file mode 100644
index 000000000..8b07f68af
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbLDAPAttributeMap.idl
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 20; 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 nsILDAPMessage;
+interface nsIAbCard;
+
+/**
+ * A mapping between addressbook properties and ldap attributes.
+ *
+ * Each addressbook property can map to one or more attributes. If
+ * there is no entry in preferences for a field, the getters generally
+ * return null; empty strings are passed through as usual. The intent is
+ * that properties with a non-zero number of attributes can be overridden for
+ * a specific server by supplying a zero-length string. For this to work,
+ * most callers are likely to want to check for both success and a
+ * non-empty string.
+ *
+ * Note that the one exception to this pattern is getAttributes, which
+ * throws NS_ERROR_FAILURE for non-existent property entries, since
+ * XPConnect doesn't like returning null arrays.
+ *
+ * Note that each LDAP attribute can map to at most one addressbook
+ * property. The checkState method is a useful tool in enforcing
+ * this. Failure to enforce it may make it impossible to guarantee
+ * that getProperty will do something consistent and reasonable.
+ *
+ * Maybe someday once we support ldap autoconfig stuff (ie
+ * draft-joslin-config-schema-11.txt), we can simplify this and other
+ * code and only allow a property to map to a single attribute.
+ */
+[scriptable, uuid(fa019fd1-7f3d-417a-8957-154cca0240be)]
+interface nsIAbLDAPAttributeMap : nsISupports
+{
+ /**
+ * Get all the LDAP attributes associated with a given property
+ * name, in order of precedence (highest to lowest).
+ *
+ * @param aProperty the address book property to return attrs for
+ *
+ * @return a comma-separated list of attributes, null if no entry is
+ * present
+ */
+ ACString getAttributeList(in ACString aProperty);
+
+ /**
+ * Get all the LDAP attributes associated with a given property name, in
+ * order of precedence (highest to lowest).
+ *
+ * @param aProperty the address book property to return attrs for
+ *
+ * @return an array of attributes
+ *
+ * @exception NS_ERROR_FAILURE if there is no entry for this property
+ */
+ void getAttributes(in ACString aProperty, out unsigned long aCount,
+ [retval, array, size_is(aCount)] out string aAttrs);
+
+ /**
+ * Get the first (canonical) LDAP attribute associated with a given property
+ * name
+ *
+ * @param aProperty the address book property to return attrs for
+ *
+ * @return the first attribute associated with a given property,
+ * null if there is no entry for this property
+ */
+ ACString getFirstAttribute(in ACString aProperty);
+
+ /**
+ * Set an existing mapping to the comma-separated list of attributes.
+ *
+ * @param aProperty the mozilla addressbook property name
+ *
+ * @param aAttributeList a comma-separated list of attributes in
+ * order of precedence from high to low
+ *
+ * @param aAllowInconsistencies allow changes that would result in
+ * a map with an LDAP attribute associated
+ * with more than one property. Useful for
+ * doing a bunch of sets at once, and
+ * calling checkState at the end.
+ *
+ * @exception NS_ERROR_FAILURE making this change would result in a map
+ * with an LDAP attribute pointing to more
+ * than one property
+ */
+ void setAttributeList(in ACString aProperty, in ACString aAttributeList,
+ in boolean allowInconsistencies);
+
+ /**
+ * Find the Mozilla addressbook property name that this attribute should
+ * map to.
+ *
+ * @return the addressbook property name, null if it's not used in the map
+ */
+ ACString getProperty(in ACString aAttribute);
+
+ /**
+ * Get all attributes that may be used in an addressbook card via this
+ * property map (used for passing to to an LDAP search when you want
+ * everything that could be in a card returned).
+ *
+ * @return a comma-separated list of attribute names
+ *
+ * @exception NS_ERROR_FAILURE there are no attributes in this property map
+ */
+ ACString getAllCardAttributes();
+
+ /**
+ * Get all properties that may be used in an addressbook card via this
+ * property map.
+ *
+ * @return an array of properties
+ *
+ * @exception NS_ERROR_FAILURE there are no attributes in this property map
+ */
+ void getAllCardProperties(out unsigned long aCount,
+ [retval, array, size_is(aCount)] out string aProps);
+
+ /**
+ * Check that no LDAP attributes are listed in more than one property.
+ *
+ * @exception NS_ERROR_FAILURE one or more LDAP attributes are listed
+ * multiple times. The object is now in an
+ * inconsistent state, and should be either
+ * manually repaired or discarded.
+ */
+ void checkState();
+
+ /* These last two methods are really just for the convenience of the caller
+ * and to avoid tons of unnecessary crossing of the XPConnect boundary.
+ */
+
+ /**
+ * Set any attributes specified in the given prefbranch on this object.
+ *
+ * @param aPrefBranchName the pref branch containing all the
+ * property names
+ *
+ * @exception NS_ERROR_FAILURE one or more LDAP attributes are listed
+ * multiple times. The object is now in an
+ * inconsistent state, and should be either
+ * manually repaired or discarded.
+ */
+ void setFromPrefs(in ACString aPrefBranchName);
+
+ /**
+ * Set the properties on an addressbook card from the given LDAP message
+ * using the map in this object.
+ *
+ * @param aCard is the card object whose values are to be set
+ * @param aMessage is the LDAP message to get the values from
+ *
+ * @exception NS_ERROR_FAILURE is thrown if no addressbook properties
+ * are found in the message
+ */
+ void setCardPropertiesFromLDAPMessage(in nsILDAPMessage aMessage,
+ in nsIAbCard aCard);
+};
+
+/**
+ * The nsIAbLDAPAttributeMapService is used to build and hold a cache
+ * of maps.
+ */
+[scriptable, uuid(12e2d589-3c2a-48e4-8c82-b1e6464a0dfd)]
+interface nsIAbLDAPAttributeMapService : nsISupports
+{
+ /**
+ * Accessor to construct or return a cached copy of the attribute
+ * map for a given preference branch. The map is constructed by
+ * first taking the default map (as specified by the
+ * "ldap_2.servers.default.attrmap" prefbranch), and then having any
+ * preferences specified by aPrefBranchName override the defaults.
+ * LDIF import and export code should use the default map.
+ *
+ * @return the requested map
+ *
+ * @exception NS_ERROR_FAILURE error constructing the map;
+ * possibly because of a failure
+ * from checkState()
+ */
+ nsIAbLDAPAttributeMap getMapForPrefBranch(in ACString aPrefBranchName);
+};
+
+
+%{C++
+// test whether one of the getters has actually found an attribute
+#define ATTRMAP_FOUND_ATTR(rv, str) (NS_SUCCEEDED(rv) && !(str).IsEmpty())
+%}
diff --git a/mailnews/addrbook/public/nsIAbLDAPCard.idl b/mailnews/addrbook/public/nsIAbLDAPCard.idl
new file mode 100644
index 000000000..6761623f2
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbLDAPCard.idl
@@ -0,0 +1,56 @@
+/* -*- 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 "nsIAbCard.idl"
+
+interface nsIAbLDAPAttributeMap;
+interface nsILDAPModification;
+interface nsILDAPMessage;
+interface nsIArray;
+
+[scriptable, uuid(2831b3b0-30ef-4070-8ad3-90ae04980e11)]
+interface nsIAbLDAPCard : nsISupports
+{
+ /**
+ * Returns the required information for an LDAP update message.
+ *
+ * @param aAttrMap The map between LDAP attributes and card properties
+ * @param aClassCount The number of objectClass values
+ * @param aClasses The objectClass values that the card needs to have
+ * @param updateType This should be one of:
+ * nsILDAPModification::MOD_ADD
+ * nsILDAPModification::MOD_REPLACE
+ *
+ * @return Returns an array of modifications required to
+ * add or replace the card in the ldap directory.
+ */
+ nsIArray getLDAPMessageInfo(in nsIAbLDAPAttributeMap aAttrMap,
+ in unsigned long aClassCount,
+ [array, size_is(aClassCount)] in string aClasses,
+ in long updateType);
+
+ /**
+ * Builds a relative distinguished name (RDN) with the given set of
+ * attributes.
+ *
+ * @param aAttrMap The map between LDAP attributes and card properties
+ * @param aAttrCount The number of attributes to use for the RDN
+ * @param aAttributes The name of the attributes to use for the RDN
+ *
+ */
+ ACString buildRdn(in nsIAbLDAPAttributeMap aAttrMap,
+ in unsigned long aAttrCount,
+ [array, size_is(aAttrCount)] in string aAttributes);
+
+ /**
+ * Stores meta-properties from a raw LDAP search result.
+ *
+ * @param aMessage The LDAP search result message.
+ *
+ */
+ void setMetaProperties(in nsILDAPMessage aMessage);
+
+ attribute ACString dn;
+};
diff --git a/mailnews/addrbook/public/nsIAbLDAPDirectory.idl b/mailnews/addrbook/public/nsIAbLDAPDirectory.idl
new file mode 100644
index 000000000..1c95ff623
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbLDAPDirectory.idl
@@ -0,0 +1,112 @@
+/* -*- 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 nsIMutableArray;
+interface nsIFile;
+interface nsIAddrDatabase;
+interface nsIAbLDAPAttributeMap;
+interface nsILDAPURL;
+
+%{C++
+#define kLDAPDirectoryRoot "moz-abldapdirectory://"
+#define kLDAPDirectoryRootLen 22
+%}
+
+/**
+ * XXX This should really inherit from nsIAbDirectory, and some day it will.
+ * But for now, doing that complicates implementation.
+ */
+[scriptable, uuid(90dde295-e354-4d58-Add8-f9b29a95942d)]
+interface nsIAbLDAPDirectory : nsISupports
+{
+ /**
+ * If set, these arrays of nsILDAPControls are passed through to the
+ * nsILDAPOperation that searchExt is called on.
+ */
+ attribute nsIMutableArray searchServerControls;
+ attribute nsIMutableArray searchClientControls;
+
+ /**
+ * The Replication File Name to use.
+ */
+ attribute ACString replicationFileName;
+
+ /**
+ * The version of LDAP protocol in use.
+ */
+ attribute unsigned long protocolVersion;
+
+ /**
+ * The SASL mechanism to use to authenticate to the LDAP server
+ * If this is an empty string, then a simple bind will be performed
+ * A non-zero string is assumed to be the name of the SASL mechanism.
+ * Currently the only supported mechanism is GSSAPI
+ */
+ attribute ACString saslMechanism;
+
+ /**
+ * The AuthDN to use to access the server.
+ */
+ attribute AUTF8String authDn;
+
+ /**
+ * The maximum number of matches that the server will return per a search.
+ */
+ attribute long maxHits;
+
+ /**
+ * The Last Change Number used for replication.
+ */
+ attribute long lastChangeNumber;
+
+ /**
+ * The LDAP server's scoping of the lastChangeNumber.
+ */
+ attribute ACString dataVersion;
+
+ /**
+ * The attribute map that is associated with this directory's server.
+ */
+ readonly attribute nsIAbLDAPAttributeMap attributeMap;
+
+ /**
+ * The LDAP URL for this directory. Note that this differs from
+ * nsIAbDirectory::URI. This attribute will give you a true ldap
+ * url, e.g. ldap://localhost:389/ whereas the uri will give you the
+ * directories rdf uri, e.g. moz-abldapdirectory://<pref base name>/.
+ */
+ attribute nsILDAPURL lDAPURL;
+
+ /**
+ * The replication (offline) file that this database uses.
+ */
+ readonly attribute nsIFile replicationFile;
+
+ /**
+ * A database that is set up for the replication file.
+ */
+ readonly attribute nsIAddrDatabase replicationDatabase;
+
+ /**
+ * The LDAP attributes used to build the Relative Distinguished Name
+ * of new cards, in the form of a comma separated list.
+ *
+ * The default is to use the common name (cn) attribute.
+ */
+ attribute ACString rdnAttributes;
+
+ /**
+ * The LDAP objectClass values added to cards when they are created/added,
+ * in the form of a comma separated list.
+ *
+ * The default is to use the following classes:
+ * top,person,organizationalPerson,inetOrgPerson,mozillaAbPersonAlpha
+ */
+ attribute ACString objectClasses;
+
+};
+
diff --git a/mailnews/addrbook/public/nsIAbLDAPReplicationData.idl b/mailnews/addrbook/public/nsIAbLDAPReplicationData.idl
new file mode 100644
index 000000000..4b811cf2a
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbLDAPReplicationData.idl
@@ -0,0 +1,68 @@
+/* -*- 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 nsIAbLDAPDirectory;
+interface nsILDAPConnection;
+interface nsILDAPURL;
+interface nsIAbLDAPReplicationQuery;
+interface nsIWebProgressListener;
+
+/**
+ * this service does replication of an LDAP directory to a local Mork AB Database.
+ */
+[scriptable, uuid(e628bbc9-8793-4f0b-bce4-990d399b1fca)]
+interface nsIAbLDAPProcessReplicationData : nsISupports
+{
+ /**
+ * readonly attribute giving the current replication state
+ */
+ readonly attribute int32_t replicationState;
+
+ /**
+ * replication states
+ */
+ const long kIdle = 0;
+ const long kAnonymousBinding = 1;
+ const long kAuthenticatedBinding = 2;
+ const long kSyncServerBinding = 3;
+ const long kSearchingAuthDN = 4;
+ const long kDecidingProtocol = 5;
+ const long kAuthenticating = 6;
+ const long kReplicatingAll = 7;
+ const long kSearchingRootDSE = 8;
+ const long kFindingChanges = 9;
+ const long kReplicatingChanges = 10;
+ const long kReplicationDone = 11;
+
+ /**
+ * readonly attribute giving the current protocol used
+ */
+ readonly attribute int32_t protocolUsed ;
+
+ /**
+ * replication protocols
+ */
+ const long kDefaultDownloadAll = 0;
+ const long kChangeLogProtocol = 1;
+ const long kLCUPProtocol = 2;
+ const long kLastUpdatedTimeStampMethod = 3;
+
+ /**
+ * this method initializes the implementation
+ */
+ void init(in nsIAbLDAPDirectory directory,
+ in nsILDAPConnection connection,
+ in nsILDAPURL url,
+ in nsIAbLDAPReplicationQuery query,
+ in nsIWebProgressListener progressListener);
+
+ /**
+ * this method a aborts the ongoing processing
+ */
+ void abort();
+};
+
diff --git a/mailnews/addrbook/public/nsIAbLDAPReplicationQuery.idl b/mailnews/addrbook/public/nsIAbLDAPReplicationQuery.idl
new file mode 100644
index 000000000..087e81bdd
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbLDAPReplicationQuery.idl
@@ -0,0 +1,67 @@
+/* -*- 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 nsIWebProgressListener;
+interface nsILDAPURL;
+interface nsILDAPConnection;
+interface nsILDAPOperation;
+interface nsIAbLDAPDirectory;
+
+/**
+ * this interface provides methods to perform LDAP Replication Queries
+ */
+[scriptable, uuid(460a739c-a8c1-4f24-b705-c89d136ab9f5)]
+interface nsIAbLDAPReplicationQuery : nsISupports
+{
+ /**
+ * initialize for the query
+ */
+ void init(in nsIAbLDAPDirectory aDirectory,
+ in nsIWebProgressListener aProgressListener);
+
+ /**
+ * Starts an LDAP query to do replication as needed
+ */
+ void doReplicationQuery();
+
+ /**
+ * Cancels the currently executing query
+ */
+ void cancelQuery();
+
+ /**
+ * this method is the callback when query is done, failed or successful
+ */
+ void done(in boolean aSuccess);
+};
+
+// XXX This interface currently isn't implemented as it didn't work.
+// Bug 311632 should fix it
+[scriptable, uuid(126202D1-4460-11d6-B7C2-00B0D06E5F27)]
+interface nsIAbLDAPChangeLogQuery : nsISupports
+{
+ /**
+ * Starts an LDAP query to find auth DN
+ */
+ void queryAuthDN(in AUTF8String aValueUsedToFindDn);
+
+ /**
+ * Starts an LDAP query to search server's Root DSE
+ */
+ void queryRootDSE();
+
+ /**
+ * Starts an LDAP ChangeLog query to find changelog entries
+ */
+ void queryChangeLog(in AUTF8String aChangeLogDN, in int32_t aLastChangeNo);
+
+ /**
+ * Starts an LDAP query to find changed entries
+ */
+ void queryChangedEntries(in AUTF8String aChangedEntryDN);
+};
+
diff --git a/mailnews/addrbook/public/nsIAbLDAPReplicationService.idl b/mailnews/addrbook/public/nsIAbLDAPReplicationService.idl
new file mode 100644
index 000000000..b58001538
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbLDAPReplicationService.idl
@@ -0,0 +1,32 @@
+/* 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 nsIWebProgressListener;
+interface nsIAbLDAPDirectory;
+
+/**
+ * this service does replication of an LDAP directory to a local Mork AB Database.
+ */
+[scriptable, uuid(3f499c70-5ceb-4b91-8b7f-62c366859383)]
+interface nsIAbLDAPReplicationService: nsISupports {
+
+ /**
+ * Start Replication of given LDAP directory represented by the URI
+ */
+ void startReplication(in nsIAbLDAPDirectory aDirectory,
+ in nsIWebProgressListener progressListener);
+
+ /**
+ * Cancel Replication of given LDAP directory represented by the URI
+ */
+ void cancelReplication(in nsIAbLDAPDirectory aDirectory);
+
+ /**
+ * callback when replication is done, failure or success
+ */
+ void done(in boolean aSuccess);
+};
+
diff --git a/mailnews/addrbook/public/nsIAbLDIFService.idl b/mailnews/addrbook/public/nsIAbLDIFService.idl
new file mode 100644
index 000000000..74643ccbd
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbLDIFService.idl
@@ -0,0 +1,40 @@
+/* -*- 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 nsIFile;
+interface nsIAddrDatabase;
+
+[scriptable, uuid(7afaa95f-0b1c-4d8a-a65f-bb5073ed6d39)]
+interface nsIAbLDIFService : nsISupports {
+
+ /**
+ * Determine if a file is likely to be an LDIF file based on field
+ * names that commonly appear in LDIF files.
+ *
+ * @param aSrc The file to examine
+ *
+ * @return true if the file appears to be of LDIF type,
+ * false otherwise
+ */
+ boolean isLDIFFile(in nsIFile aSrc);
+
+ /**
+ * Imports a file into the specified address book.
+ *
+ * @param aDb The address book to import addresses into.
+ *
+ * @param aSrc The file to import addresses from.
+ *
+ * @param aStoreLocAsHome Stores the address as a home rather than work
+ * address.
+ *
+ * @param aProgress May be null, but if a pointer is supplied,
+ * then it will be updated regularly with the
+ * current position of reading from the file.
+ *
+ */
+ void importLDIFFile(in nsIAddrDatabase aDb, in nsIFile aSrc, in boolean aStoreLocAsHome, inout unsigned long aProgress);
+};
diff --git a/mailnews/addrbook/public/nsIAbListener.idl b/mailnews/addrbook/public/nsIAbListener.idl
new file mode 100644
index 000000000..cc9761abf
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbListener.idl
@@ -0,0 +1,90 @@
+/* -*- 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"
+
+typedef unsigned long abListenerNotifyFlagValue;
+
+/**
+ * nsIAbListener
+ *
+ * Implement this interface to receive notifications of address book
+ * items being added, removed or changed with loaded address books.
+ *
+ * Subscribe to events by using nsIAbManager.
+ */
+[scriptable, uuid(b3ca8745-2dad-4032-ae2f-0b8622f32697)]
+interface nsIAbListener : nsISupports {
+ /**
+ * These flags are used when registering the listener with nsIAbManager to
+ * specify when to receive notifications of address book updates.
+ */
+
+ /**
+ * An address book, mailing list or card is added.
+ */
+ const abListenerNotifyFlagValue itemAdded = 0x1;
+ /**
+ * A mailing list or card is removed from an address book.
+ */
+ const abListenerNotifyFlagValue directoryItemRemoved = 0x2;
+ /**
+ * An address book is removed
+ */
+ const abListenerNotifyFlagValue directoryRemoved = 0x4;
+ /**
+ * An address book, mailing list or card is changed.
+ */
+ const abListenerNotifyFlagValue itemChanged = 0x8;
+ /**
+ * All of the above notifications are to be received.
+ */
+ const abListenerNotifyFlagValue all = 0xFFFFFFFF;
+
+ /**
+ * Called when an address book item (book, card or list) is added
+ *
+ * @param parentDir The parent of the item being added.
+ *
+ * @param item The item being added to the database (a
+ * directory or card).
+ *
+ */
+ void onItemAdded(in nsISupports parentDir, in nsISupports item);
+
+ /**
+ * Called when an address book, mailing list or card is removed. This
+ * is partially configurable when setting up the listener via
+ * nsIAddrBookSession
+ *
+ * @param parentDir The parent of the item being removed, this
+ * may be an empty directory in the case of a
+ * top level address book.
+ *
+ * @param item The item being removed from the database.
+ *
+ */
+ void onItemRemoved(in nsISupports parentDir, in nsISupports item);
+
+ /**
+ * Called when an address book item is changed. Note the current
+ * implementation means that property is either the literal string "DirName"
+ * or null, with oldValue and newValue being specified if the property is
+ * "DirName" otherwise they are null.
+ *
+ * @param item The item being updated (a directory or a
+ * card).
+ *
+ * @param property The property of the item being changed.
+ *
+ * @param oldValue The old value of the item property being
+ * changed if it is known, null otherwise.
+ *
+ * @param newValue The new value of the item property being
+ * changed.
+ *
+ */
+ void onItemPropertyChanged(in nsISupports item, in string property, in wstring oldValue, in wstring newValue);
+};
diff --git a/mailnews/addrbook/public/nsIAbMDBDirectory.idl b/mailnews/addrbook/public/nsIAbMDBDirectory.idl
new file mode 100644
index 000000000..200fcd8ee
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbMDBDirectory.idl
@@ -0,0 +1,71 @@
+/* -*- 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 nsIFile;
+interface nsIAbDirectory;
+interface nsIAbCard;
+interface nsIAddrDatabase;
+
+%{C++
+#define kMDBDirectoryRoot "moz-abmdbdirectory://"
+#define kMDBDirectoryRootLen 21
+%}
+
+[scriptable, uuid(744072be-1ba0-46bc-af24-46e22567a2ea)]
+interface nsIAbMDBDirectory : nsISupports {
+
+ // Creates a directory component from the
+ // uriName, adds it to its children and returns
+ // the component
+ nsIAbDirectory addDirectory(in string uriName);
+
+ /**
+ * Supplies a nsIFile point to the database file for this directory
+ *
+ * @exception NS_ERROR_NOT_INITIALIZED If there is no filename preference
+ * present or it is empty
+ */
+ readonly attribute nsIFile databaseFile;
+
+ /**
+ * Supplies a nsIAddrDatabase that uses the databaseFile. See also
+ * databaseFile for possible exceptions.
+ */
+ readonly attribute nsIAddrDatabase database;
+
+ // Mail list specific
+ //
+
+ // Removes all elements from the addressLists
+ // property
+ [noscript] void removeElementsFromAddressList();
+
+ // Specific to a directory which stores mail lists
+ //
+
+ // Adds a directory to the addressLists attribute
+ void addMailListToDirectory(in nsIAbDirectory mailList);
+
+ // Specific to a directory which is a mail list
+ //
+
+ // Copies mail list properties from the srcList
+ void copyDBMailList(in nsIAbMDBDirectory srcListDB);
+
+ // Adds a card to the addressList attribute
+ void addAddressToList(in nsIAbCard card);
+
+ // Removes items from the addressLists member
+ void removeEmailAddressAt(in unsigned long aIndex);
+
+ attribute unsigned long dbRowID;
+
+ // Empty implementation, called by the data base
+ [noscript] void notifyDirItemAdded(in nsISupports item);
+
+ [noscript] void clearDatabase();
+};
diff --git a/mailnews/addrbook/public/nsIAbManager.idl b/mailnews/addrbook/public/nsIAbManager.idl
new file mode 100644
index 000000000..49a585544
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbManager.idl
@@ -0,0 +1,190 @@
+/* -*- Mode: IDL; 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"
+#include "nsIAbListener.idl"
+
+interface mozIDOMWindowProxy;
+interface nsIAbDirectory;
+interface nsIAbCard;
+interface nsIAbDirectoryProperties;
+interface nsIFile;
+interface nsISimpleEnumerator;
+interface nsIAbBooleanExpression;
+
+/**
+ * nsIAbManager is an interface to the main address book mananger
+ * via the contract id "@mozilla.org/abmanager;1"
+ *
+ * It contains the main functions to create and delete address books as well
+ * as some helper functions.
+ */
+[scriptable, uuid(ea0d8b3d-a549-4874-82d8-3a82cee2a3f1)]
+interface nsIAbManager : nsISupports
+{
+ /**
+ * Returns an enumerator containing all the top-level directories
+ * (non-recursive)
+ */
+ readonly attribute nsISimpleEnumerator directories;
+
+ /**
+ * Returns the directory that represents the supplied URI.
+ *
+ * @param aURI The URI of the address book to find.
+ * @return The found address book.
+ */
+ nsIAbDirectory getDirectory(in ACString aURI);
+
+ /**
+ * Returns the directory that has the supplied dirPrefId.
+ *
+ * @param aDirPrefId The dirPrefId of the directory.
+ * @return The found AB directory.
+ */
+ nsIAbDirectory getDirectoryFromId(in ACString aDirPrefId);
+
+ /**
+ * Creates a new address book.
+ *
+ * @param aDirName The description of the address book.
+ * @param aURI The URI for the address book. This is specific to each
+ * type of address book.
+ * @param aType The type of the address book (see nsDirPrefs.h)
+ * @param aPrefName Overrides the default of ldap_2.servers.<aDirName>
+ * (note that the caller must ensure its uniqueness).
+ */
+ ACString newAddressBook(in AString aDirName, in ACString aURI,
+ in unsigned long aType,
+ [optional] in ACString aPrefName);
+
+ /**
+ * Deletes an address book.
+ *
+ * @param aURI The URI for the address book. This is specific to each
+ * type of address book.
+ */
+ void deleteAddressBook(in ACString aURI);
+
+ /**
+ * Exports an address book, it will provide a dialog to the user for the
+ * location to save the file to and will then save the address book to media.
+ *
+ * @param aParentWin Parent Window for the file save dialog to use.
+ * @param aDirectory The directory to export.
+ */
+ void exportAddressBook(in mozIDOMWindowProxy aParentWin, in nsIAbDirectory aDirectory);
+
+ /**
+ * Adds a nsIAbListener to receive notifications of address book updates
+ * according to the specified notifyFlags.
+ *
+ * @param aListener The listener that is to receive updates.
+ * @param aNotifyFlags A bitwise-or of abListenerNotifyFlagValue items
+ * specifying which notifications to receive. See
+ * nsIAbListener for possible values.
+ */
+ void addAddressBookListener(in nsIAbListener aListener,
+ in abListenerNotifyFlagValue aNotifyFlags);
+
+ /**
+ * Removes a nsIAbListener from receive notifications of address book
+ * updates.
+ *
+ * @param aListener The listener that is to no longer receive updates.
+ */
+ void removeAddressBookListener(in nsIAbListener aListener);
+
+ /**
+ * Call to notify the registered listeners when a property on an item has
+ * changed.
+ *
+ * @param aItem The items that has changed (e.g. an nsIAbDirectory)
+ * @param aProperty The property that has changed (e.g. DirName)
+ * @param aOldValue The old value of the property.
+ * @param aNewValue The new value of the property.
+ */
+ void notifyItemPropertyChanged(in nsISupports aItem,
+ in string aProperty,
+ in wstring aOldValue,
+ in wstring aNewValue);
+
+ /**
+ * Call to notify the registered listeners when a directory item is added.
+ *
+ * @param aParentDirectory The parent directory of the item that has been
+ * added.
+ * @param aItem The item that has been added.
+ */
+ void notifyDirectoryItemAdded(in nsIAbDirectory aParentDirectory,
+ in nsISupports aItem);
+
+ /**
+ * Call to notify the registered listeners when a directory item is removed.
+ *
+ * @param aParentDirectory The parent directory of the item that has been
+ * removed.
+ * @param aItem The item that has been removed.
+ */
+ void notifyDirectoryItemDeleted(in nsIAbDirectory aParentDirectory,
+ in nsISupports aItem);
+
+ /**
+ * Call to notify the registered listeners when a directory is removed.
+ *
+ * @param aParentDirectory The parent directory of the directory that has
+ * been removed.
+ * @param aDirectory The directory that has been removed.
+ */
+ void notifyDirectoryDeleted(in nsIAbDirectory aParentDirectory,
+ in nsISupports aDirectory);
+
+ /**
+ * Returns the user profile directory. NOTE: this should not be used
+ * as it may go away soon.
+ */
+ readonly attribute nsIFile userProfileDirectory;
+
+ /**
+ * Finds out if the mailing list name exists in any *mork/MDB* based
+ * address book
+ *
+ * @param aName The name of the list to try and find.
+ *
+ * @return True if the name exists.
+ */
+ boolean mailListNameExists(in wstring name);
+
+ /**
+ * Translates an escaped vcard string into a nsIAbCard.
+ *
+ * @param escapedVCardStr The string containing the vcard.
+ *
+ * @return A card containing the translated vcard data.
+ */
+ nsIAbCard escapedVCardToAbCard(in string escapedVCardStr);
+
+ /**
+ * Generates a UUID from a (directory ID, local ID) tuple.
+ *
+ * Use of this method is preferred in such cases, since it is designed to work
+ * with other methods of this interface.
+ *
+ * @param directoryId The directory ID.
+ * @param localId The per-directory ID.
+ * @return A string to use for the UUID.
+ */
+ AUTF8String generateUUID(in AUTF8String directoryId, in AUTF8String localId);
+
+
+ /**
+ * A utility function that converts an nsIAbDirectory query string to an
+ * nsIAbBooleanExpression.
+ *
+ * @param aQueryString The nsIAbDirectory query string
+ * @return an nsIAbBooleanExpression for the query string
+ */
+ nsIAbBooleanExpression convertQueryStringToExpression(in AUTF8String aQueryString);
+};
diff --git a/mailnews/addrbook/public/nsIAbView.idl b/mailnews/addrbook/public/nsIAbView.idl
new file mode 100644
index 000000000..cd591a1e5
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAbView.idl
@@ -0,0 +1,109 @@
+/* -*- Mode: IDL; 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 nsIAbCard;
+interface nsIAbDirectory;
+interface nsIArray;
+
+/// Define a class using this interface to listen to updates from nsIAbView.
+[scriptable, uuid(79ad5d6e-1dd2-11b2-addd-f547dab50d75)]
+interface nsIAbViewListener : nsISupports
+{
+ /// Called when the selection is changed in the tree
+ void onSelectionChanged();
+
+ /// Called when the total count of cards is changed.
+ void onCountChanged(in long total);
+};
+
+/**
+ * This interface and its associated nsAbView object provides an interface
+ * to allow a tree to be associated with an address book, and the results
+ * to be displayed in that tree.
+ *
+ * If you wish for the tree to display the results of a different address
+ * book, then call setView again. There is no need to delete and recreate the
+ * nsAbView object. If you wish to clear the view, then just call clearView.
+ */
+[scriptable, uuid(45e2fa9f-0b59-4090-a2fa-fb7042cf64a2)]
+interface nsIAbView : nsISupports
+{
+ /**
+ * Sets up the nsIAbView to look at the specified directory. This may be
+ * called multiple times.
+ *
+ * @param aDirectory The directory to search, this may be a directory
+ * with a query string.
+ * @param aViewListener An optional listener.
+ * @param aSortColumn The column to sort by. See the xul element with
+ * id abResultsTreeCols for possible values.
+ * @param aSortDirection The sort direction to use ("ascending"/"descending")
+ * @return The actual sortColumn (various switching of apps
+ * could cause the persisted sortColumn to be bogus).
+ */
+ AString setView(in nsIAbDirectory aAddressBook,
+ in nsIAbViewListener aAbViewListener,
+ in AString aSortColumn,
+ in AString aSortDirection);
+
+ /**
+ * Clears the view and releases any locally held copies of the address book
+ * directory. This should be called when the view is no longer required, e.g.
+ * on unload.
+ */
+ void clearView();
+
+ /**
+ * Sorts the tree by the specified parameters.
+ *
+ * @param aSortColumn The column to sort by. See the xul element with
+ * id abResultsTreeCols for possible values.
+ * @param aSortDirection The sort direction to use ("ascending"/"descending")
+ * @param aResort The function DOES optimize for the case when sortColumn
+ * and sortDirection is identical since the last call.
+ * If an unconditional resort is needed, set this to true.
+ */
+ void sortBy(in wstring aSortColumn, in wstring aSortDirection,
+ [optional] in boolean aResort);
+
+ /// Returns the current sort column
+ readonly attribute AString sortColumn;
+
+ /// Returns the current sort direction
+ readonly attribute AString sortDirection;
+
+ /**
+ * Returns the current directory that this view is hooked up to. May be
+ * null if no directory has been set.
+ */
+ readonly attribute nsIAbDirectory directory;
+
+ /**
+ * Returns the card associated with the given row.
+ *
+ * @param aRow The row from which to return the card.
+ * @return A card associated with the row, or null if row is not valid.
+ */
+ nsIAbCard getCardFromRow(in long aRow);
+
+ /// Selects all rows in the view.
+ void selectAll();
+
+ /// Deletes all the selected cards (no prompts are given).
+ void deleteSelectedCards();
+
+ /**
+ * Swaps the first and last name order, and updates the appropriate
+ * preference.
+ */
+ void swapFirstNameLastName();
+
+ /**
+ * Returns an array of the currently selected addresses.
+ */
+ readonly attribute nsIArray selectedAddresses;
+};
diff --git a/mailnews/addrbook/public/nsIAddbookUrl.idl b/mailnews/addrbook/public/nsIAddbookUrl.idl
new file mode 100644
index 000000000..5f2676dde
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAddbookUrl.idl
@@ -0,0 +1,19 @@
+/* -*- 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 "nsIURI.idl"
+
+[scriptable, uuid(6EB9D874-01AA-11d4-8FBE-000064657374)]
+interface nsIAddbookUrlOperation
+{
+ const long InvalidUrl = 0;
+ const long PrintAddressBook = 1;
+ const long AddVCard = 2;
+};
+
+[uuid(5f965083-e866-4bfb-ba40-13c344395798)]
+interface nsIAddbookUrl : nsIURI {
+ readonly attribute long addbookOperation;
+};
diff --git a/mailnews/addrbook/public/nsIAddrDBAnnouncer.idl b/mailnews/addrbook/public/nsIAddrDBAnnouncer.idl
new file mode 100644
index 000000000..735ca64cb
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAddrDBAnnouncer.idl
@@ -0,0 +1,35 @@
+/* -*- 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"
+#include "nsIAbCard.idl"
+#include "nsIAbDirectory.idl"
+
+interface nsIAddrDBListener;
+
+[scriptable, uuid(166b19a1-1235-4613-9601-816dedc48c9e)]
+interface nsIAddrDBAnnouncer : nsISupports {
+
+ void addListener(in nsIAddrDBListener listener);
+ void removeListener(in nsIAddrDBListener listener);
+
+ void notifyCardAttribChange(in unsigned long abCode);
+
+ /**
+ * Notify all the listeners of the database about an event performed
+ * on a card entry.
+ *
+ * @param aAbCode The code to indicate the type of event
+ * (see nsAddrDatabase.h AB_NOTIFY_CODE for values).
+ * @param aCard The card entry on which the event occurred.
+ * @param aParent The parent of card entry. This is set by
+ * object which performs the operation.
+ */
+ void notifyCardEntryChange(in unsigned long aAbCode,
+ in nsIAbCard aCard,
+ in nsIAbDirectory aParent);
+
+ void notifyAnnouncerGoingAway();
+};
diff --git a/mailnews/addrbook/public/nsIAddrDBListener.idl b/mailnews/addrbook/public/nsIAddrDBListener.idl
new file mode 100644
index 000000000..f407313e2
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAddrDBListener.idl
@@ -0,0 +1,36 @@
+/* -*- 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"
+#include "nsIAbCard.idl"
+#include "nsIAbDirectory.idl"
+
+interface nsIAddrDBAnnouncer;
+
+[scriptable, uuid(5d7e5a7a-1ac9-46dc-abfd-758c98be26e9)]
+interface nsIAddrDBListener : nsISupports {
+
+ void onCardAttribChange(in unsigned long abCode);
+
+ /**
+ * Handle the card entry change event.
+ *
+ * @param aAbCode The code to indicate the type of event
+ * (see nsAddrDatabase.h AB_NOTIFY_CODE for values).
+ * @param aCard The card entry on which the event occurred.
+ * @param aParent The parent of card entry.
+ * If set to null, the event can be ignored.
+ * This happens during import & sync operations when
+ * listeners of a database need not be notified about
+ * card entry changes.
+ */
+ void onCardEntryChange (in unsigned long aAbCode,
+ in nsIAbCard aCard,
+ in nsIAbDirectory aParent);
+
+ void onListEntryChange (in unsigned long abCode,
+ in nsIAbDirectory list);
+ void onAnnouncerGoingAway();
+
+};
diff --git a/mailnews/addrbook/public/nsIAddrDatabase.idl b/mailnews/addrbook/public/nsIAddrDatabase.idl
new file mode 100644
index 000000000..e387b260f
--- /dev/null
+++ b/mailnews/addrbook/public/nsIAddrDatabase.idl
@@ -0,0 +1,311 @@
+/* -*- 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 "nsIAddrDBAnnouncer.idl"
+#include "nsIAbCard.idl"
+#include "nsIAbDirectory.idl"
+
+interface nsIFile;
+interface nsIMdbTableRowCursor;
+interface nsIMdbEnv;
+interface nsIMdbRow;
+interface nsIArray;
+interface nsISimpleEnumerator;
+
+%{C++
+// this is the prefix we for attributes that are specific
+// to the mozilla addressbook, and weren't in 4.x and aren't specified in
+// RFC 2789. used when exporting and import LDIF
+// see nsTextAddress.cpp, nsAddressBook.cpp
+#define MOZ_AB_LDIF_PREFIX "mozilla"
+
+// note, GeneratedName is not a real column
+// if you change any of this, make sure to change
+// Get / Set CardValue in nsAbCardProperty.cpp
+#define kPhoneticNameColumn "_PhoneticName"
+#define kAddressCharSetColumn "AddrCharSet"
+#define kMailListName "ListName"
+#define kMailListNickName "ListNickName"
+#define kMailListDescription "ListDescription"
+#define kMailListTotalAddresses "ListTotalAddresses"
+// not shown in the UI
+#define kLowerPriEmailColumn "LowercasePrimaryEmail"
+#define kLower2ndEmailColumn "LowercaseSecondEmail"
+
+// Palm Integration
+#define CARD_ATTRIB_PALMID "PalmRecId"
+#define CARD_ATTRIB_DISPLAY "DisplayName"
+
+%}
+
+[scriptable, uuid(20d4c6c3-0460-403e-aa9c-813654641566)]
+interface nsAddrDBCommitType
+{
+ const long kLargeCommit = 1;
+ const long kSessionCommit = 2;
+ const long kCompressCommit = 3;
+};
+
+[scriptable, uuid(c54973e4-d251-4b93-a0d0-81a616225061)]
+interface nsIAddrDatabase : nsIAddrDBAnnouncer {
+
+ /**
+ * Path to the address book database that this instance represents.
+ */
+ attribute nsIFile dbPath;
+ nsIAddrDatabase open(in nsIFile dbFile, in boolean create, in boolean upgrading);
+
+ void close(in boolean forceCommit);
+
+ /**
+ * Open the MDB database synchronously creating it if required. If
+ * successful, this routine will set up the m_mdbStore and m_mdbEnv of the
+ * database object so other database calls can work.
+ *
+ * @param dbName The location of the database file
+ * to open.
+ * @param create If set to true, will create the
+ * database file if it does not
+ * already exist.
+ * @exception NS_ERROR_FILE_NOT_FOUND The file was not found at the
+ * specified location (and create was
+ * false).
+ * @exception NS_ERROR_FILE_ACCESS_DENIED The file could not be opened as
+ * access was denied.
+ */
+ void openMDB(in nsIFile dbName, in boolean create);
+ void closeMDB(in boolean commit);
+
+ void commit(in unsigned long commitType);
+ void forceClosed();
+
+ /**
+ * Create a new card and add to the database
+ *
+ * @param aNewCard the card to be added
+ * @param aNotify if set to true, all the listeners of the
+ * database will be notified.
+ * @param aParent parent directory or mailing list to which the
+ * card is added. If set to null, listeners of the
+ * database will not be notified of card creation.
+ */
+ void createNewCardAndAddToDB(in nsIAbCard aNewCard, in boolean aNotify, in nsIAbDirectory aParent);
+
+ void createNewListCardAndAddToDB(in nsIAbDirectory list, in unsigned long listRowID, in nsIAbCard newCard, in boolean aNotify);
+
+ /**
+ * Create a new mailing list and add to the database
+ *
+ * @param aNewList the mailing list to be added.
+ * @param aNotify if set to true, all the listeners of the
+ * database will be notified.
+ * @param aParent parent directory to which the mailing list
+ * is added. If set to null, listeners of the database
+ * will not be notified of mailing list creation.
+ */
+ void createMailListAndAddToDB(in nsIAbDirectory aNewList, in boolean aNotify, in nsIAbDirectory aParent);
+
+ /**
+ * Enumerate the cards in the directory. The enumerator will return the
+ * cards associated with mailing lists too.
+ *
+ * @param directory the directory of which to enumerate the cards.
+ * @return an enumerator.
+ */
+ nsISimpleEnumerator enumerateCards(in nsIAbDirectory directory);
+
+ /**
+ * Enumerate the cards associated with the mailing lists in the directory.
+ *
+ * @param directory the directory of which to enumerate the cards.
+ * @return an enumerator.
+ */
+ nsISimpleEnumerator enumerateListAddresses(in nsIAbDirectory directory);
+
+ void getMailingListsFromDB(in nsIAbDirectory parentDir);
+
+ /**
+ * Delete a card from the database.
+ *
+ * @param aCard the card to be deleted.
+ * @param aNotify if set to true, all the listeners of the
+ * database will be notified.
+ * @param aParent parent directory from which the card
+ * is to be deleted. If set to null, listeners of
+ * the database will not be notified of card deletion.
+ */
+ void deleteCard(in nsIAbCard aCard, in boolean aNotify, in nsIAbDirectory aParent);
+
+ /**
+ * Edit a card in the database.
+ *
+ * @param aCard the card to be edited.
+ * @param aNotify if set to true, all the listeners of the
+ * database will be notified.
+ * @param aParent parent directory in which the card
+ * is to be edited. If set to null, listeners of
+ * the database will not be notified of card entry
+ * change.
+ */
+ void editCard(in nsIAbCard aCard, in boolean aNotify, in nsIAbDirectory aParent);
+ boolean containsCard(in nsIAbCard card);
+ /**
+ * Deletes a mailing list from the directory
+ *
+ * @param aMailList The nsIAbDirectory implementation of the mailing
+ * list that is to be deleted.
+ * @param aParent The parent of the mailing list that is being
+ * deleted. If this is supplied, then a notification
+ * of card entry change in the database will be made.
+ */
+ void deleteMailList(in nsIAbDirectory aMailList,
+ [optional] in nsIAbDirectory aParent);
+ void editMailList(in nsIAbDirectory mailList, in nsIAbCard listCard, in boolean aNotify);
+ boolean containsMailList(in nsIAbDirectory mailList);
+ void deleteCardFromMailList(in nsIAbDirectory mailList, in nsIAbCard card, in boolean aNotify);
+
+ /**
+ * Gets the first card which matches the attribute/value pair supplied.
+ *
+ * @param aDirectory The current nsIAbDirectory associated with this
+ * instance of the database.
+ * @param aName The attribute to look up the value in.
+ * @param aUTF8Value The value to look up in UTF8 format.
+ * @param aCaseInsensitive Set to true for case-insenstive matching.
+ * @result Returns an nsIAbCard if one is found, otherwise
+ * NULL.
+ */
+ nsIAbCard getCardFromAttribute(in nsIAbDirectory aDirectory, in string aName,
+ in AUTF8String aUTF8Value,
+ in boolean aCaseInsensitive);
+
+ /**
+ * Gets all cards which matches the attribute/value pair supplied.
+ *
+ * @param aDirectory The current nsIAbDirectory associated with this
+ * instance of the database.
+ * @param aName The attribute to look up the value in.
+ * @param aUTF8Value The value to look up in UTF8 format.
+ * @param aCaseInsensitive Set to true for case-insenstive matching.
+ * @result Returns an nsISimpleEnumerator of nsIAbCard
+ * instances.
+ */
+ nsISimpleEnumerator getCardsFromAttribute(in nsIAbDirectory aDirectory,
+ in string aName,
+ in AUTF8String uUTF8Value,
+ in boolean aCaseInsensitive);
+
+ boolean findMailListbyUnicodeName(in wstring listName);
+
+ void getCardCount(out uint32_t count);
+
+ [noscript] readonly attribute nsIMdbRow newRow;
+ [noscript] readonly attribute nsIMdbRow newListRow;
+ [noscript] void addCardRowToDB(in nsIMdbRow newRow);
+ [noscript] void addLdifListMember(in nsIMdbRow row, in string value);
+ [noscript] void addFirstName(in nsIMdbRow row, in string value);
+ [noscript] void addLastName(in nsIMdbRow row, in string value);
+ [noscript] void addPhoneticFirstName(in nsIMdbRow row, in string value);
+ [noscript] void addPhoneticLastName(in nsIMdbRow row, in string value);
+ [noscript] void addDisplayName(in nsIMdbRow row, in string value);
+ [noscript] void addNickName(in nsIMdbRow row, in string value);
+ [noscript] void addPrimaryEmail(in nsIMdbRow row, in string value);
+ [noscript] void add2ndEmail(in nsIMdbRow row, in string value);
+ [noscript] void addWorkPhone(in nsIMdbRow row, in string value);
+ [noscript] void addHomePhone(in nsIMdbRow row, in string value);
+ [noscript] void addFaxNumber(in nsIMdbRow row, in string value);
+ [noscript] void addPagerNumber(in nsIMdbRow row, in string value);
+ [noscript] void addCellularNumber(in nsIMdbRow row, in string value);
+ [noscript] void addWorkPhoneType(in nsIMdbRow row, in string value);
+ [noscript] void addHomePhoneType(in nsIMdbRow row, in string value);
+ [noscript] void addFaxNumberType(in nsIMdbRow row, in string value);
+ [noscript] void addPagerNumberType(in nsIMdbRow row, in string value);
+ [noscript] void addCellularNumberType(in nsIMdbRow row, in string value);
+ [noscript] void addHomeAddress(in nsIMdbRow row, in string value);
+ [noscript] void addHomeAddress2(in nsIMdbRow row, in string value);
+ [noscript] void addHomeCity(in nsIMdbRow row, in string value);
+ [noscript] void addHomeState(in nsIMdbRow row, in string value);
+ [noscript] void addHomeZipCode(in nsIMdbRow row, in string value);
+ [noscript] void addHomeCountry(in nsIMdbRow row, in string value);
+ [noscript] void addWorkAddress(in nsIMdbRow row, in string value);
+ [noscript] void addWorkAddress2(in nsIMdbRow row, in string value);
+ [noscript] void addWorkCity(in nsIMdbRow row, in string value);
+ [noscript] void addWorkState(in nsIMdbRow row, in string value);
+ [noscript] void addWorkZipCode(in nsIMdbRow row, in string value);
+ [noscript] void addWorkCountry(in nsIMdbRow row, in string value);
+ [noscript] void addJobTitle(in nsIMdbRow row, in string value);
+ [noscript] void addDepartment(in nsIMdbRow row, in string value);
+ [noscript] void addCompany(in nsIMdbRow row, in string value);
+ [noscript] void addAimScreenName(in nsIMdbRow row, in string value);
+ [noscript] void addAnniversaryYear(in nsIMdbRow row, in string value);
+ [noscript] void addAnniversaryMonth(in nsIMdbRow row, in string value);
+ [noscript] void addAnniversaryDay(in nsIMdbRow row, in string value);
+ [noscript] void addSpouseName(in nsIMdbRow row, in string value);
+ [noscript] void addFamilyName(in nsIMdbRow row, in string value);
+ [noscript] void addDefaultAddress(in nsIMdbRow row, in string value);
+ [noscript] void addCategory(in nsIMdbRow row, in string value);
+ [noscript] void addWebPage1(in nsIMdbRow row, in string value);
+ [noscript] void addWebPage2(in nsIMdbRow row, in string value);
+ [noscript] void addBirthYear(in nsIMdbRow row, in string value);
+ [noscript] void addBirthMonth(in nsIMdbRow row, in string value);
+ [noscript] void addBirthDay(in nsIMdbRow row, in string value);
+ [noscript] void addCustom1(in nsIMdbRow row, in string value);
+ [noscript] void addCustom2(in nsIMdbRow row, in string value);
+ [noscript] void addCustom3(in nsIMdbRow row, in string value);
+ [noscript] void addCustom4(in nsIMdbRow row, in string value);
+ [noscript] void addNotes(in nsIMdbRow row, in string value);
+ [noscript] void addPreferMailFormat(in nsIMdbRow row, in unsigned long value);
+ [noscript] void addPopularityIndex(in nsIMdbRow row, in unsigned long value);
+
+ [noscript] void addListName(in nsIMdbRow row, in string value);
+ [noscript] void addListNickName(in nsIMdbRow row, in string value);
+ [noscript] void addListDescription(in nsIMdbRow row, in string value);
+ [noscript] void addListDirNode(in nsIMdbRow listRow);
+
+ /**
+ * use for getting and setting generic string attributes
+ * like _AimScreenName
+ */
+ void setCardValue(in nsIAbCard card, in string name, in wstring value, in boolean notify);
+ wstring getCardValue(in nsIAbCard card, in string name);
+
+ /**
+ * Returns an array of the deleted cards currently stored in the mork file.
+ */
+ readonly attribute nsIArray deletedCardList;
+
+ /**
+ * Returns the count of the deleted card currently stored in the mork file.
+ */
+ readonly attribute unsigned long deletedCardCount;
+
+ /**
+ * Add the column representing the card to the mailing list row
+ * in the database.
+ *
+ * @param aPCard the card to be added.
+ * @param aPListRow the row to which the column will be added.
+ * @param aPos the position of the card in the mailing list.
+ * @param aPNewCard a pointer to hold the new card added to the row.
+ * @param aInMailingList If set to true, the card is already present
+ * in the mailing list
+ * @param aParent parent mailing list to which the card
+ * is added. If set to null, listeners of the
+ * database will not be notified of card creation.
+ * @param aRoot If the card is created while creating a new mailing
+ * list, its set to the parent addressbook.
+ * Set to null in other case.
+ */
+ void AddListCardColumnsToRow(in nsIAbCard aPCard,
+ in nsIMdbRow aPListRow,
+ in unsigned long aPos,
+ out nsIAbCard aPNewCard,
+ in boolean aInMailingList,
+ in nsIAbDirectory aParent,
+ in nsIAbDirectory aRoot);
+ void InitCardFromRow(in nsIAbCard aNewCard,in nsIMdbRow aCardRow);
+ void SetListAddressTotal(in nsIMdbRow aListRow, in uint32_t aTotal);
+ nsIMdbRow FindRowByCard(in nsIAbCard aCard);
+};
diff --git a/mailnews/addrbook/public/nsIMsgVCardService.idl b/mailnews/addrbook/public/nsIMsgVCardService.idl
new file mode 100644
index 000000000..e3e3411ca
--- /dev/null
+++ b/mailnews/addrbook/public/nsIMsgVCardService.idl
@@ -0,0 +1,29 @@
+/* -*- 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"
+
+%{C++
+#include "nsVCardObj.h"
+%}
+
+[ptr] native VObject_ptr(VObject);
+[ptr] native VObjectIterator_ptr(VObjectIterator);
+[ptr] native const_char_ptr(const char);
+
+[uuid(8b6ae917-676d-4f1f-bbad-2ecc9be0d9b1)]
+interface nsIMsgVCardService : nsISupports {
+ [noscript, notxpcom] void cleanVObject(in VObject_ptr o);
+ [noscript, notxpcom] VObject_ptr nextVObjectInList(in VObject_ptr o);
+ [noscript, notxpcom] VObject_ptr parse_MIME(in string input, in unsigned long len);
+ [noscript, notxpcom] charPtr fakeCString(in VObject_ptr o);
+ [noscript, notxpcom] VObject_ptr isAPropertyOf(in VObject_ptr o, in string id);
+ [noscript, notxpcom] charPtr writeMemoryVObjects(in string s, out long len, in VObject_ptr list, in boolean expandSpaces);
+ [noscript, notxpcom] VObject_ptr nextVObject(in VObjectIterator_ptr i);
+ [noscript, notxpcom] void initPropIterator(in VObjectIterator_ptr i, in VObject_ptr o);
+ [noscript, notxpcom] long moreIteration(in VObjectIterator_ptr i);
+ [noscript, notxpcom] const_char_ptr vObjectName(in VObject_ptr o);
+ [noscript, notxpcom] charPtr vObjectAnyValue(in VObject_ptr o);
+};