Class com.gContactSync.AddressBook
Defined in: AddressBook.js.
Constructor Attributes | Constructor Name and Description |
---|---|
com.gContactSync.AddressBook(aDirectory)
A class for a Thunderbird Address Book with methods to add, modify, obtain,
and delete cards.
|
Field Attributes | Field Name and Description |
---|---|
The cards within this address book
|
|
set to true when mContacts should be updated
|
|
The Uniform Resource Identifier (URI) of the directory
|
Method Attributes | Method Name and Description |
---|---|
addContact(aContact)
Adds the contact to this address book and returns the added contact.
|
|
addList(aName, aNickName)
Creates a new mail list, adds it to the address book, and returns a
MailList object containing the list.
|
|
checkDirectory(aDirectory, aMethodName)
Checks the validity of a directory and throws an error if it is invalid.
|
|
checkList(aList, aMethodName)
Checks the validity of a mailing list and throws an error if it is invalid.
|
|
deleteAB()
Permanently deletes this address book without a confirmation dialog.
|
|
deleteContacts(aContacts)
Deletes the nsIAbCards from the nsIAbDirectory Address Book.
|
|
equals(aOtherDir)
Returns true if the directory passed in is the same as the directory
stored by this AddressBook object.
|
|
Returns an array of all of the cards in this Address Book.
|
|
getAllLists(skipGetCards)
Returns an an object containing MailList objects whose attribute name is
the name of the mail list.
|
|
Returns the directory type of this address book.
|
|
getListByNickName(aNickName)
Finds and returns the first Mail List that matches the given nickname in
this address book.
|
|
getName()
Returns the name of this address book.
|
|
Returns the preference ID of this directory prefixed with
"extensions.gContactSync.
|
|
getStringPref(aName, aDefaultValue)
Gets and returns the string preference, if possible, with the given name.
|
|
hasContact(aContact)
Returns the card in this directory, if any, with the same (not-null)
value for the GoogleID attribute, or, if the GoogleID is null, if the
display name, primary, and second emails are the same.
|
|
isDirectoryValid(aDirectory)
Checks the validity of a directory and returns false if it is invalid.
|
|
Creates and returns a new TBContact in this address book.
|
|
newListObj(aList, aParentDirectory, aNew)
Creates a new mailing list in this directory and returns a MailList object
representing the new list.
|
|
setName(aName)
Sets the name of this address book.
|
|
setPrefId(aPrefId)
Sets the preference id for this mailing list.
|
|
setStringPref(aName, aValue)
Sets the string preference, if possible, with the given name and value.
|
|
updateContact(aContact)
Updates a card (commits changes) in this address book.
|
Class Detail
com.gContactSync.AddressBook(aDirectory)
A class for a Thunderbird Address Book with methods to add, modify, obtain,
and delete cards.
- Parameters:
- aDirectory
- {nsIAbDirectory} The actual directory.
Field Detail
mContacts
The cards within this address book
mContactsUpdate
set to true when mContacts should be updated
mURI
The Uniform Resource Identifier (URI) of the directory
Method Detail
{TBContact}
addContact(aContact)
Adds the contact to this address book and returns the added contact.
- Parameters:
- aContact
- {TBContact} The contact to add.
- Returns:
- {TBContact} The newly-added contact.
{MailList}
addList(aName, aNickName)
Creates a new mail list, adds it to the address book, and returns a
MailList object containing the list.
- Parameters:
- aName
- {string} The new name for the mail list.
- aNickName
- {string} The nickname for the mail list.
- Returns:
- {MailList} A new MailList object containing the newly-made List with the given name and nickname.
checkDirectory(aDirectory, aMethodName)
Checks the validity of a directory and throws an error if it is invalid.
- Parameters:
- aDirectory
- {nsIAbDirectory} The directory to check.
- aMethodName
- {strong} The name of the method calling checkDirectory (used when throwing the error)
checkList(aList, aMethodName)
Checks the validity of a mailing list and throws an error if it is invalid.
- Parameters:
- aList
- {nsIAbDirectory} An object that should be a mailing list.
- aMethodName
- {string} The name of the method calling checkList (used when throwing the error)
{boolean}
deleteAB()
Permanently deletes this address book without a confirmation dialog.
This will not allow deleting the PAB or CAB and will show a popup
if there is an attempt to delete one of those ABs.
- Returns:
- {boolean} True if the AB was deleted.
deleteContacts(aContacts)
Deletes the nsIAbCards from the nsIAbDirectory Address Book. If the cards
aren't in the book nothing will happen.
- Parameters:
- aContacts
- {array} The cards to delete from the directory
{boolean}
equals(aOtherDir)
Returns true if the directory passed in is the same as the directory
stored by this AddressBook object. Two directories are considered the same
if and only if their Uniform Resource Identifiers (URIs) are the same.
- Parameters:
- aOtherDir
- The directory to compare with this object's directory.
- Returns:
- {boolean} True if the URI of the passed directory is the same as the URI of the directory stored by this object.
{array}
getAllContacts()
Returns an array of all of the cards in this Address Book.
- Returns:
- {array} An array of the TBContacts in this Address Book.
getAllLists(skipGetCards)
Returns an an object containing MailList objects whose attribute name is
the name of the mail list.
- Parameters:
- skipGetCards
- {boolean} True to skip getting the cards of each list.
- Returns:
- An object containing MailList objects.
{integer}
getDirType()
Returns the directory type of this address book.
See mailnews/addrbook/src/nsDirPrefs.h
- Returns:
- {integer} The directory type of this address book. 2 means a normal Mork AB -1 means the dir type could not be found.
{MailList}
getListByNickName(aNickName)
Finds and returns the first Mail List that matches the given nickname in
this address book.
- Parameters:
- aNickName
- {string} The nickname to search for. If null then this function returns nothing.
- Returns:
- {MailList} A new MailList object containing a list that matches the nickname or nothing if the list wasn't found.
{string}
getName()
Returns the name of this address book.
- Returns:
- {string} The name of this address book.
{string}
getPrefId()
Returns the preference ID of this directory prefixed with
"extensions.gContactSync."
- Returns:
- {string} The preference ID of this directory.
{string}
getStringPref(aName, aDefaultValue)
Gets and returns the string preference, if possible, with the given name.
Returns null if this list doesn't have a preference ID or if there was an
error getting the preference.
- Parameters:
- aName
- {string} The name of the preference to get.
- aDefaultValue
- {string} The value to set the preference at if it fails. Only used in Thunderbird 3.
- Returns:
- {string} The value of the preference with the given name in the preference branch specified by the preference ID, if possible. Otherwise null.
{TBContact}
hasContact(aContact)
Returns the card in this directory, if any, with the same (not-null)
value for the GoogleID attribute, or, if the GoogleID is null, if the
display name, primary, and second emails are the same.
- Parameters:
- aContact
- {TBContact} The card being searched for.
- Returns:
- {TBContact} The card in this AB, if any, with the same, and non-null value for its GoogleID attribute, or, if the GoogleID is null, if the display name, primary, and second emails are the same.
isDirectoryValid(aDirectory)
Checks the validity of a directory and returns false if it is invalid.
- Parameters:
- aDirectory
- {nsIAbDirectory} The directory to check.
{TBContact}
newContact()
Creates and returns a new TBContact in this address book.
NOTE: The contact is already added to this address book.
- Returns:
- {TBContact} A new TBContact in this address book.
{MailList}
newListObj(aList, aParentDirectory, aNew)
Creates a new mailing list in this directory and returns a MailList object
representing the new list.
- Parameters:
- aList
- aParentDirectory
- aNew
- Returns:
- {MailList} A new MailList object.
setName(aName)
Sets the name of this address book. Throws an error if the name is set to
either the PAB or CAB's name.
- Parameters:
- aName
- {string} The new name for this directory.
setPrefId(aPrefId)
Sets the preference id for this mailing list. The update method must be
called in order for the change to become permanent.
- Parameters:
- aPrefId
- {string} The new preference ID for this mailing list.
setStringPref(aName, aValue)
Sets the string preference, if possible, with the given name and value.
- Parameters:
- aName
- {string} The name of the preference to set.
- aValue
- {string} The value to which the preference is set.
updateContact(aContact)
Updates a card (commits changes) in this address book.
- Parameters:
- aContact
- {TBContact} The card to update.