Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Address Book Interfaces

This content covers features introduced in Thunderbird 3

This page contains a list of the interfaces that you'll will most likely hit when writing patches for the Address Book or writing extensions. The complete list of interfaces for the address book can be found here. Address Book examples show how to perform various tasks and provide code snippets.

nsIAbManager

nsIAbManager is an interface to the main address book manager. It is used to create/delete address book instances and provides other utility functions such as the ability to export address books and add listeners to be notified about updates to address books.

RDF Obsolescence

In Thunderbird 2.x/SeaMonkey 1.1 the RDF service was used to get the list of all address books. For Thunderbird 3/SeaMonkey 2, using the RDF interfaces should be considered obsolete, except for using as datasources for tree elements. Instead use nsIAbManager.getDirectory and nsIAbManager.directories, although these interfaces aren't finalized, they are more convenient and will be heading towards the Address Book interfaces of the future.

nsIAbItem

nsIAbItem is the base class for all items that can be in address books. The only exception to this rule is that nsIAbDirectory items cannot currently be nested.

nsIAbItem contains functions that are generic to all items, at the moment this is one function, generateName that returns the name of an item suitable for display.

nsIAbCard

The nsIAbCard interface is generally used to represent and manipulate cards in the address book. The User Interfaces calls these cards "Contacts".

Currently nsIAbCard can also represent mailing lists. If this is the case then its isMailList attribute will be true. nsIAbCard is typically used in this form when displaying lists of contacts from the address book (e.g. after quick search or in contacts sidebar).

Note: It is planned that at some stage the mailing list representation will be removed from nsIAbCard into its own interface. That may or may not happen before TB 3, the interested can follow along on bug 464833.

nsIAbCollection

nsIAbCollection represents collections of nsIAbItem. It contains information on the type of collection (remote, read-only, etc) and provides search functions.

Note: At the moment, only nsIAbDirectory uses nsIAbCollection, it is intended that there will be another class (probably called nsIAbGroup) that will hold mailing lists and specific groups of email addresses.

nsIAbDirectory

nsIAbDirectory are instances of nsIAbCollection that are saved in some form, this could be a file on the local disk, within another application or remotely over a network. On the user interface, each nsIAbDirectory is represented as an "Address Book".

The class contains methods for setting up the address book and for adding, modifying and removing nsIAbItem objects.

nsIAbDirectory and Mailing Lists

Currently nsIAbDirectory is also used to represent mailing lists. This is the case if the isMailList attribute is true. See the examples page for how this operates.

Note: It is planned that at some stage the mailing list representation will be removed from nsIAbDirectory into its own interface. That may or may not happen before TB 3, the interested can follow along on bug 464833.

Address Book/Directory interfaces specific to types of Address Books

These interfaces should only be used where necessary for setting up address books of the appropriate type or accessing type specific functions. Keeping to non-type-specific interfaces (where possible) will mean that functions will work across different types of address book and help to provide a better user experience.

nsIAbMDBDirectory

A nsIAbMDBDirectory object is also an nsIAbDirectory and represents a mork-based address book. Address books of this type are stored within the user's profile.

The interface provides functions specific to setting up mork address books.

nsIAbLDAPDirectory

A nsIAbLDAPDirectory object is also an nsIAbDirectory and represents a remote LDAP address book.

Document Tags and Contributors

 Contributors to this page: teoli, trevorh, mschroeder, jenzed, Standard8
 Last updated by: trevorh,