1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2001
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * Paul Sandoz <paul.sandoz@sun.com>
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39 #include "nsISupports.idl"
40
41 interface nsILocalFile;
42 interface nsIAbDirectory;
43 interface nsIAbCard;
44 interface nsIAddrDatabase;
45
46 %{C++
47 #define kMDBDirectoryRoot "moz-abmdbdirectory://"
48 #define kMDBDirectoryRootLen 21
49 %}
50
51 [scriptable, uuid(705a6b63-118c-402d-a835-b07347de5a53)]
52 interface nsIAbMDBDirectory : nsISupports {
53
54 // Creates an RDF directory component from the
55 // uriName, adds it to its children and returns
56 // the component
57 nsIAbDirectory addDirectory(in string uriName);
58
59 /**
60 * Supplies a nsILocalFile point to the database file for this directory
61 *
62 * @exception NS_ERROR_NOT_INITIALIZED If there is no filename preference
63 * present or it is empty
64 */
65 readonly attribute nsILocalFile databaseFile;
66
67 /**
68 * Supplies a nsIAddrDatabase that uses the databaseFile. See also
69 * databaseFile for possible exceptions.
70 */
71 readonly attribute nsIAddrDatabase database;
72
73 // Mail list specific
74 //
75
76 // Removes all elements from the addressLists
77 // property
78 [noscript] void removeElementsFromAddressList();
79
80 // Specific to a directory which stores mail lists
81 //
82
83 // Adds a directory to the addressLists attribute
84 void addMailListToDirectory(in nsIAbDirectory mailList);
85
86 // Specific to a directory which is a mail list
87 //
88
89 // Copies mail list properties from the srcList
90 void copyDBMailList(in nsIAbMDBDirectory srcListDB);
91
92 // Adds a card to the addressList attribute
93 void addAddressToList(in nsIAbCard card);
94
95 // Removes items from the addressLists member
96 void removeEmailAddressAt(in unsigned long aIndex);
97
98 attribute unsigned long dbRowID;
99
100 // Empty implementation, called by the data base
101 [noscript] void notifyDirItemAdded(in nsISupports item);
102
103 [noscript] void clearDatabase();
104
105 /**
106 * Returns the address card for the specified email address if found.
107 *
108 * @param emailAddress The email address to find in either the primary or
109 * secondary email address fields. If email address is
110 * empty, the database won't be searched and the function
111 * will return as if no card was found.
112 * @return An nsIAbCard if one was found, else returns NULL.
113 */
114 nsIAbCard cardForEmailAddress(in AUTF8String emailAddress);
115 };