Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
nsAddrDatabase Class Reference

#include <nsAddrDatabase.h>

Inheritance diagram for nsAddrDatabase:
Inheritance graph
[legend]
Collaboration diagram for nsAddrDatabase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIADDRDBANNOUNCER
NS_IMETHOD 
GetDbPath (nsFileSpec **aDbPath)
NS_IMETHOD SetDbPath (nsFileSpec *aDbPath)
NS_IMETHOD Open (nsIFile *aMabFile, PRBool aCreate, PRBool upgrading, nsIAddrDatabase **pCardDB)
NS_IMETHOD Close (PRBool forceCommit)
NS_IMETHOD OpenMDB (nsFileSpec *dbName, PRBool create)
NS_IMETHOD CloseMDB (PRBool commit)
NS_IMETHOD Commit (PRUint32 commitType)
NS_IMETHOD ForceClosed ()
NS_IMETHOD CreateNewCardAndAddToDB (nsIAbCard *newCard, PRBool notify)
NS_IMETHOD CreateNewCardAndAddToDBWithKey (nsIAbCard *newCard, PRBool notify, PRUint32 *key)
NS_IMETHOD CreateNewListCardAndAddToDB (nsIAbDirectory *list, PRUint32 listRowID, nsIAbCard *newCard, PRBool notify)
NS_IMETHOD CreateMailListAndAddToDB (nsIAbDirectory *newList, PRBool notify)
NS_IMETHOD CreateMailListAndAddToDBWithKey (nsIAbDirectory *newList, PRBool notify, PRUint32 *key)
NS_IMETHOD EnumerateCards (nsIAbDirectory *directory, nsIEnumerator **result)
NS_IMETHOD GetMailingListsFromDB (nsIAbDirectory *parentDir)
NS_IMETHOD EnumerateListAddresses (nsIAbDirectory *directory, nsIEnumerator **result)
NS_IMETHOD DeleteCard (nsIAbCard *newCard, PRBool notify)
NS_IMETHOD EditCard (nsIAbCard *card, PRBool notify)
NS_IMETHOD ContainsCard (nsIAbCard *card, PRBool *hasCard)
NS_IMETHOD DeleteMailList (nsIAbDirectory *mailList, PRBool notify)
NS_IMETHOD EditMailList (nsIAbDirectory *mailList, nsIAbCard *listCard, PRBool notify)
NS_IMETHOD ContainsMailList (nsIAbDirectory *mailList, PRBool *hasCard)
NS_IMETHOD DeleteCardFromMailList (nsIAbDirectory *mailList, nsIAbCard *card, PRBool aNotify)
NS_IMETHOD GetCardFromAttribute (nsIAbDirectory *directory, const char *aName, const char *aValue, PRBool aCaseInsensitive, nsIAbCard **card)
NS_IMETHOD GetNewRow (nsIMdbRow **newRow)
NS_IMETHOD GetNewListRow (nsIMdbRow **newRow)
NS_IMETHOD AddCardRowToDB (nsIMdbRow *newRow)
NS_IMETHOD AddLdifListMember (nsIMdbRow *row, const char *value)
NS_IMETHOD GetDeletedCardList (PRUint32 *aCount, nsISupportsArray **aDeletedList)
NS_IMETHOD GetDeletedCardCount (PRUint32 *count)
NS_IMETHOD PurgeDeletedCardTable ()
NS_IMETHOD AddFirstName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddLastName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddPhoneticFirstName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddPhoneticLastName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddDisplayName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddNickName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddPrimaryEmail (nsIMdbRow *row, const char *value)
NS_IMETHOD Add2ndEmail (nsIMdbRow *row, const char *value)
NS_IMETHOD AddDefaultEmail (nsIMdbRow *row, const char *value)
NS_IMETHOD AddCardType (nsIMdbRow *row, const char *value)
NS_IMETHOD AddPreferMailFormat (nsIMdbRow *row, PRUint32 value)
NS_IMETHOD AddPopularityIndex (nsIMdbRow *row, PRUint32 value)
NS_IMETHOD AddAllowRemoteContent (nsIMdbRow *row, PRBool value)
NS_IMETHOD AddWorkPhone (nsIMdbRow *row, const char *value)
NS_IMETHOD AddHomePhone (nsIMdbRow *row, const char *value)
NS_IMETHOD AddFaxNumber (nsIMdbRow *row, const char *value)
NS_IMETHOD AddPagerNumber (nsIMdbRow *row, const char *value)
NS_IMETHOD AddCellularNumber (nsIMdbRow *row, const char *value)
NS_IMETHOD AddWorkPhoneType (nsIMdbRow *row, const char *value)
NS_IMETHOD AddHomePhoneType (nsIMdbRow *row, const char *value)
NS_IMETHOD AddFaxNumberType (nsIMdbRow *row, const char *value)
NS_IMETHOD AddPagerNumberType (nsIMdbRow *row, const char *value)
NS_IMETHOD AddCellularNumberType (nsIMdbRow *row, const char *value)
NS_IMETHOD AddHomeAddress (nsIMdbRow *row, const char *value)
NS_IMETHOD AddHomeAddress2 (nsIMdbRow *row, const char *value)
NS_IMETHOD AddHomeCity (nsIMdbRow *row, const char *value)
NS_IMETHOD AddHomeState (nsIMdbRow *row, const char *value)
NS_IMETHOD AddHomeZipCode (nsIMdbRow *row, const char *value)
NS_IMETHOD AddHomeCountry (nsIMdbRow *row, const char *value)
NS_IMETHOD AddWorkAddress (nsIMdbRow *row, const char *value)
NS_IMETHOD AddWorkAddress2 (nsIMdbRow *row, const char *value)
NS_IMETHOD AddWorkCity (nsIMdbRow *row, const char *value)
NS_IMETHOD AddWorkState (nsIMdbRow *row, const char *value)
NS_IMETHOD AddWorkZipCode (nsIMdbRow *row, const char *value)
NS_IMETHOD AddWorkCountry (nsIMdbRow *row, const char *value)
NS_IMETHOD AddJobTitle (nsIMdbRow *row, const char *value)
NS_IMETHOD AddDepartment (nsIMdbRow *row, const char *value)
NS_IMETHOD AddCompany (nsIMdbRow *row, const char *value)
NS_IMETHOD AddAimScreenName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddAnniversaryYear (nsIMdbRow *row, const char *value)
NS_IMETHOD AddAnniversaryMonth (nsIMdbRow *row, const char *value)
NS_IMETHOD AddAnniversaryDay (nsIMdbRow *row, const char *value)
NS_IMETHOD AddSpouseName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddFamilyName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddDefaultAddress (nsIMdbRow *row, const char *value)
NS_IMETHOD AddCategory (nsIMdbRow *row, const char *value)
NS_IMETHOD AddWebPage1 (nsIMdbRow *row, const char *value)
NS_IMETHOD AddWebPage2 (nsIMdbRow *row, const char *value)
NS_IMETHOD AddBirthYear (nsIMdbRow *row, const char *value)
NS_IMETHOD AddBirthMonth (nsIMdbRow *row, const char *value)
NS_IMETHOD AddBirthDay (nsIMdbRow *row, const char *value)
NS_IMETHOD AddCustom1 (nsIMdbRow *row, const char *value)
NS_IMETHOD AddCustom2 (nsIMdbRow *row, const char *value)
NS_IMETHOD AddCustom3 (nsIMdbRow *row, const char *value)
NS_IMETHOD AddCustom4 (nsIMdbRow *row, const char *value)
NS_IMETHOD AddNotes (nsIMdbRow *row, const char *value)
NS_IMETHOD AddListName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddListNickName (nsIMdbRow *row, const char *value)
NS_IMETHOD AddListDescription (nsIMdbRow *row, const char *value)
NS_IMETHOD AddListDirNode (nsIMdbRow *listRow)
NS_IMETHOD GetDirectoryName (PRUnichar **name)
NS_IMETHOD FindMailListbyUnicodeName (const PRUnichar *listName, PRBool *exist)
NS_IMETHOD GetCardCount (PRUint32 *count)
NS_IMETHOD SetCardValue (nsIAbCard *card, const char *name, const PRUnichar *value, PRBool notify)
NS_IMETHOD GetCardValue (nsIAbCard *card, const char *name, PRUnichar **value)
NS_IMETHOD AddRowValue (nsIMdbRow *aRow, const nsACString &aLDIFAttributeName, const nsAString &aColValue)
 nsAddrDatabase ()
virtual ~nsAddrDatabase ()
nsIMdbFactoryGetMDBFactory ()
nsIMdbEnvGetEnv ()
PRUint32 GetCurVersion ()
nsIMdbTableRowCursorGetTableRowCursor ()
nsIMdbTableGetPabTable ()
nsresult CreateABCard (nsIMdbRow *cardRow, mdb_id listRowID, nsIAbCard **result)
nsresult CreateABListCard (nsIMdbRow *listRow, nsIAbCard **result)
nsresult CreateABList (nsIMdbRow *listRow, nsIAbDirectory **result)
PRBool IsListRowScopeToken (mdb_scope scope)
PRBool IsCardRowScopeToken (mdb_scope scope)
PRBool IsDataRowScopeToken (mdb_scope scope)
nsresult GetCardRowByRowID (mdb_id rowID, nsIMdbRow **dbRow)
nsresult GetListRowByRowID (mdb_id rowID, nsIMdbRow **dbRow)
PRUint32 GetListAddressTotal (nsIMdbRow *listRow)
nsresult GetAddressRowByPos (nsIMdbRow *listRow, PRUint16 pos, nsIMdbRow **cardRow)
NS_IMETHOD AddListCardColumnsToRow (nsIAbCard *aPCard, nsIMdbRow *aPListRow, PRUint32 aPos, nsIAbCard **aPNewCard, PRBool aInMailingList)
NS_IMETHOD InitCardFromRow (nsIAbCard *aNewCard, nsIMdbRow *aCardRow)
NS_IMETHOD SetListAddressTotal (nsIMdbRow *aListRow, PRUint32 aTotal)
NS_IMETHOD FindRowByCard (nsIAbCard *card, nsIMdbRow **aRow)
nsIAddrDatabase open (in nsIFile dbFile, in boolean create, in boolean upgrading)
void close (in boolean forceCommit)
void openMDB (in nsFileSpec dbName, in boolean create)
void closeMDB (in boolean commit)
void commit (in unsigned long commitType)
void forceClosed ()
void createNewCardAndAddToDB (in nsIAbCard newCard, in boolean aNotify)
void createNewCardAndAddToDBWithKey (in nsIAbCard newCard, in boolean aNotify, out unsigned long key)
void createNewListCardAndAddToDB (in nsIAbDirectory list, in unsigned long listRowID, in nsIAbCard newCard, in boolean aNotify)
void createMailListAndAddToDB (in nsIAbDirectory newList, in boolean aNotify)
void createMailListAndAddToDBWithKey (in nsIAbDirectory newList, in boolean aNotify, out PRUint32 key)
nsIEnumerator enumerateCards (in nsIAbDirectory directory)
nsIEnumerator enumerateListAddresses (in nsIAbDirectory directory)
void getMailingListsFromDB (in nsIAbDirectory parentDir)
void deleteCard (in nsIAbCard card, in boolean aNotify)
void editCard (in nsIAbCard card, in boolean aNotify)
boolean containsCard (in nsIAbCard card)
void deleteMailList (in nsIAbDirectory mailList, in boolean aNotify)
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)
nsIAbCard getCardFromAttribute (in nsIAbDirectory directory, in string aName, in string aUTF8Value, in boolean caseInsensitive)
 aUTF8Value needs to be in UTF-8
PRBool findMailListbyUnicodeName (in wstring listName)
void getCardCount (out PRUint32 count)
void addCardRowToDB (in nsIMdbRow newRow)
void addLdifListMember (in nsIMdbRow row, in string value)
void addFirstName (in nsIMdbRow row, in string value)
void addLastName (in nsIMdbRow row, in string value)
void addPhoneticFirstName (in nsIMdbRow row, in string value)
void addPhoneticLastName (in nsIMdbRow row, in string value)
void addDisplayName (in nsIMdbRow row, in string value)
void addNickName (in nsIMdbRow row, in string value)
void addPrimaryEmail (in nsIMdbRow row, in string value)
void add2ndEmail (in nsIMdbRow row, in string value)
void addDefaultEmail (in nsIMdbRow row, in string value)
void addCardType (in nsIMdbRow row, in string value)
void addWorkPhone (in nsIMdbRow row, in string value)
void addHomePhone (in nsIMdbRow row, in string value)
void addFaxNumber (in nsIMdbRow row, in string value)
void addPagerNumber (in nsIMdbRow row, in string value)
void addCellularNumber (in nsIMdbRow row, in string value)
void addWorkPhoneType (in nsIMdbRow row, in string value)
void addHomePhoneType (in nsIMdbRow row, in string value)
void addFaxNumberType (in nsIMdbRow row, in string value)
void addPagerNumberType (in nsIMdbRow row, in string value)
void addCellularNumberType (in nsIMdbRow row, in string value)
void addHomeAddress (in nsIMdbRow row, in string value)
void addHomeAddress2 (in nsIMdbRow row, in string value)
void addHomeCity (in nsIMdbRow row, in string value)
void addHomeState (in nsIMdbRow row, in string value)
void addHomeZipCode (in nsIMdbRow row, in string value)
void addHomeCountry (in nsIMdbRow row, in string value)
void addWorkAddress (in nsIMdbRow row, in string value)
void addWorkAddress2 (in nsIMdbRow row, in string value)
void addWorkCity (in nsIMdbRow row, in string value)
void addWorkState (in nsIMdbRow row, in string value)
void addWorkZipCode (in nsIMdbRow row, in string value)
void addWorkCountry (in nsIMdbRow row, in string value)
void addJobTitle (in nsIMdbRow row, in string value)
void addDepartment (in nsIMdbRow row, in string value)
void addCompany (in nsIMdbRow row, in string value)
void addAimScreenName (in nsIMdbRow row, in string value)
void addAnniversaryYear (in nsIMdbRow row, in string value)
void addAnniversaryMonth (in nsIMdbRow row, in string value)
void addAnniversaryDay (in nsIMdbRow row, in string value)
void addSpouseName (in nsIMdbRow row, in string value)
void addFamilyName (in nsIMdbRow row, in string value)
void addDefaultAddress (in nsIMdbRow row, in string value)
void addCategory (in nsIMdbRow row, in string value)
void addWebPage1 (in nsIMdbRow row, in string value)
void addWebPage2 (in nsIMdbRow row, in string value)
void addBirthYear (in nsIMdbRow row, in string value)
void addBirthMonth (in nsIMdbRow row, in string value)
void addBirthDay (in nsIMdbRow row, in string value)
void addCustom1 (in nsIMdbRow row, in string value)
void addCustom2 (in nsIMdbRow row, in string value)
void addCustom3 (in nsIMdbRow row, in string value)
void addCustom4 (in nsIMdbRow row, in string value)
void addNotes (in nsIMdbRow row, in string value)
void addPreferMailFormat (in nsIMdbRow row, in unsigned long value)
void addPopularityIndex (in nsIMdbRow row, in unsigned long value)
void addAllowRemoteContent (in nsIMdbRow row, in boolean value)
void addListName (in nsIMdbRow row, in string value)
void addListNickName (in nsIMdbRow row, in string value)
void addListDescription (in nsIMdbRow row, in string value)
void addListDirNode (in nsIMdbRow listRow)
void setCardValue (in nsIAbCard card, in string name, in wstring value, in boolean notify)
 use for getting and setting generic string attributes like _AimScreenName
wstring getCardValue (in nsIAbCard card, in string name)
void getDeletedCardList (out unsigned long aCount, out nsISupportsArray aDeletedList)
void getDeletedCardCount (out unsigned long count)
void addRowValue (in nsIMdbRow aRow, in ACString aLDIFAttributeName, in AString aColValue)
 used for adding a string attributes to a row.
void AddListCardColumnsToRow (in nsIAbCard aPCard, in nsIMdbRow aPListRow, in unsigned long aPos, out nsIAbCard aPNewCard, in boolean aInMailingList)
void InitCardFromRow (in nsIAbCard aNewCard, in nsIMdbRow aCardRow)
void SetListAddressTotal (in nsIMdbRow aListRow, in PRUint32 aTotal)
nsIMdbRow FindRowByCard (in nsIAbCard aCard)
void addListener (in nsIAddrDBListener listener)
void removeListener (in nsIAddrDBListener listener)
void notifyCardAttribChange (in unsigned long abCode)
void notifyCardEntryChange (in unsigned long abCode, in nsIAbCard card)
void notifyAnnouncerGoingAway ()

Static Public Member Functions

static nsAddrDatabaseFindInCache (nsFileSpec *dbName)
static void CleanupCache ()

Public Attributes

attribute nsFileSpec dbPath
readonly attribute wstring directoryName
readonly attribute nsIMdbRow newRow
readonly attribute nsIMdbRow newListRow

Protected Member Functions

PRBool MatchDbName (nsFileSpec *dbName)
void YarnToUInt32 (struct mdbYarn *yarn, PRUint32 *pResult)
void GetCharStringYarn (char *str, struct mdbYarn *strYarn)
void GetStringYarn (const nsAString &aStr, struct mdbYarn *strYarn)
void GetIntYarn (PRUint32 nValue, struct mdbYarn *intYarn)
nsresult AddCharStringColumn (nsIMdbRow *cardRow, mdb_column inColumn, const char *str)
nsresult AddStringColumn (nsIMdbRow *aCardRow, mdb_column aInColumn, const nsAString &aStr)
nsresult AddIntColumn (nsIMdbRow *cardRow, mdb_column inColumn, PRUint32 nValue)
nsresult AddBoolColumn (nsIMdbRow *cardRow, mdb_column inColumn, PRBool bValue)
nsresult GetStringColumn (nsIMdbRow *cardRow, mdb_token outToken, nsString &str)
nsresult GetIntColumn (nsIMdbRow *cardRow, mdb_token outToken, PRUint32 *pValue, PRUint32 defaultValue)
nsresult GetBoolColumn (nsIMdbRow *cardRow, mdb_token outToken, PRBool *pValue)
nsresult GetListCardFromDB (nsIAbCard *listCard, nsIMdbRow *listRow)
nsresult GetListFromDB (nsIAbDirectory *newCard, nsIMdbRow *listRow)
nsresult AddRecordKeyColumnToRow (nsIMdbRow *pRow)
nsresult AddAttributeColumnsToRow (nsIAbCard *card, nsIMdbRow *cardRow)
nsresult AddListAttributeColumnsToRow (nsIAbDirectory *list, nsIMdbRow *listRow)
nsresult CreateCard (nsIMdbRow *cardRow, mdb_id listRowID, nsIAbCard **result)
nsresult CreateCardFromDeletedCardsTable (nsIMdbRow *cardRow, mdb_id listRowID, nsIAbCard **result)
nsresult DeleteCardFromListRow (nsIMdbRow *pListRow, mdb_id cardRowID)
void DeleteCardFromAllMailLists (mdb_id cardRowID)
nsresult NotifyListEntryChange (PRUint32 abCode, nsIAbDirectory *dir)
nsresult AddLowercaseColumn (nsIMdbRow *row, mdb_token columnToken, const char *utf8String)
nsresult GetRowFromAttribute (const char *aName, const char *aUTF8Value, PRBool aCaseInsensitive, nsIMdbRow **aCardRow)
nsresult InitExistingDB ()
nsresult InitNewDB ()
nsresult InitMDBInfo ()
nsresult InitPabTable ()
nsresult InitDeletedCardsTable (PRBool aCreate)
nsresult AddRowToDeletedCardsTable (nsIAbCard *card, nsIMdbRow **pCardRow)
nsresult DeleteRowFromDeletedCardsTable (nsIMdbRow *pCardRow)
nsresult InitLastRecorKey ()
nsresult GetDataRow (nsIMdbRow **pDataRow)
nsresult GetLastRecordKey ()
nsresult UpdateLastRecordKey ()
nsresult CheckAndUpdateRecordKey ()
nsresult UpdateLowercaseEmailListName ()
nsresult ConvertAndAddLowercaseColumn (nsIMdbRow *row, mdb_token fromCol, mdb_token toCol)
nsresult AddUnicodeToColumn (nsIMdbRow *row, mdb_token colToken, mdb_token lowerCaseColToken, const PRUnichar *pUnicodeStr)
nsresult CreateCardsForMailList (nsIMdbRow *pListRow, nsIEnumerator **result)
nsresult DeleteRow (nsIMdbTable *dbTable, nsIMdbRow *dbRow)

Static Protected Member Functions

static void AddToCache (nsAddrDatabase *pAddrDB)
static void RemoveFromCache (nsAddrDatabase *pAddrDB)
static PRInt32 FindInCache (nsAddrDatabase *pAddrDB)
static nsVoidArrayGetDBCache ()

Protected Attributes

nsIMdbEnvm_mdbEnv
nsIMdbStorem_mdbStore
nsIMdbTablem_mdbPabTable
nsIMdbTablem_mdbDeletedCardsTable
nsFileSpec m_dbName
PRBool m_mdbTokensInitialized
nsVoidArraym_ChangeListeners
mdb_kind m_PabTableKind
mdb_kind m_MailListTableKind
mdb_kind m_DeletedCardsTableKind
mdb_scope m_CardRowScopeToken
mdb_scope m_ListRowScopeToken
mdb_scope m_DataRowScopeToken
mdb_token m_FirstNameColumnToken
mdb_token m_LastNameColumnToken
mdb_token m_PhoneticFirstNameColumnToken
mdb_token m_PhoneticLastNameColumnToken
mdb_token m_DisplayNameColumnToken
mdb_token m_NickNameColumnToken
mdb_token m_PriEmailColumnToken
mdb_token m_2ndEmailColumnToken
mdb_token m_DefaultEmailColumnToken
mdb_token m_CardTypeColumnToken
mdb_token m_WorkPhoneColumnToken
mdb_token m_HomePhoneColumnToken
mdb_token m_FaxColumnToken
mdb_token m_PagerColumnToken
mdb_token m_CellularColumnToken
mdb_token m_WorkPhoneTypeColumnToken
mdb_token m_HomePhoneTypeColumnToken
mdb_token m_FaxTypeColumnToken
mdb_token m_PagerTypeColumnToken
mdb_token m_CellularTypeColumnToken
mdb_token m_HomeAddressColumnToken
mdb_token m_HomeAddress2ColumnToken
mdb_token m_HomeCityColumnToken
mdb_token m_HomeStateColumnToken
mdb_token m_HomeZipCodeColumnToken
mdb_token m_HomeCountryColumnToken
mdb_token m_WorkAddressColumnToken
mdb_token m_WorkAddress2ColumnToken
mdb_token m_WorkCityColumnToken
mdb_token m_WorkStateColumnToken
mdb_token m_WorkZipCodeColumnToken
mdb_token m_WorkCountryColumnToken
mdb_token m_JobTitleColumnToken
mdb_token m_DepartmentColumnToken
mdb_token m_CompanyColumnToken
mdb_token m_AimScreenNameColumnToken
mdb_token m_AnniversaryYearColumnToken
mdb_token m_AnniversaryMonthColumnToken
mdb_token m_AnniversaryDayColumnToken
mdb_token m_SpouseNameColumnToken
mdb_token m_FamilyNameColumnToken
mdb_token m_DefaultAddressColumnToken
mdb_token m_CategoryColumnToken
mdb_token m_WebPage1ColumnToken
mdb_token m_WebPage2ColumnToken
mdb_token m_BirthYearColumnToken
mdb_token m_BirthMonthColumnToken
mdb_token m_BirthDayColumnToken
mdb_token m_Custom1ColumnToken
mdb_token m_Custom2ColumnToken
mdb_token m_Custom3ColumnToken
mdb_token m_Custom4ColumnToken
mdb_token m_NotesColumnToken
mdb_token m_LastModDateColumnToken
mdb_token m_RecordKeyColumnToken
mdb_token m_LowerPriEmailColumnToken
mdb_token m_MailFormatColumnToken
mdb_token m_PopularityIndexColumnToken
mdb_token m_AllowRemoteContentColumnToken
mdb_token m_AddressCharSetColumnToken
mdb_token m_LastRecordKeyColumnToken
mdb_token m_ListNameColumnToken
mdb_token m_ListNickNameColumnToken
mdb_token m_ListDescriptionColumnToken
mdb_token m_ListTotalColumnToken
mdb_token m_LowerListNameColumnToken
PRUint32 m_LastRecordKey
nsIAbDirectorym_dbDirectory

Static Protected Attributes

static nsVoidArraym_dbCache = NULL

Private Member Functions

nsresult GetRowForCharColumn (const PRUnichar *unicodeStr, mdb_column findColumn, PRBool bIsCard, nsIMdbRow **findRow)
PRBool HasRowButDeletedForCharColumn (const PRUnichar *unicodeStr, mdb_column findColumn, PRBool aIsCard, nsIMdbRow **aFindRow)
nsresult OpenInternal (nsFileSpec *aMabFile, PRBool aCreate, nsIAddrDatabase **pCardDB)
nsresult AlertAboutCorruptMabFile (const PRUnichar *aOldFileName, const PRUnichar *aNewFileName)
nsresult AlertAboutLockedMabFile (const PRUnichar *aFileName)
nsresult DisplayAlert (const PRUnichar *titleName, const PRUnichar *alertStringName, const PRUnichar **formatStrings, PRInt32 numFormatStrings)

Detailed Description

Definition at line 69 of file nsAddrDatabase.h.


Constructor & Destructor Documentation

Definition at line 105 of file nsAddrDatabase.cpp.

    : m_mdbEnv(nsnull), m_mdbStore(nsnull),
      m_mdbPabTable(nsnull), 
      m_mdbDeletedCardsTable(nsnull),
      m_dbName(""), m_mdbTokensInitialized(PR_FALSE), 
      m_ChangeListeners(nsnull),
      m_PabTableKind(0),
      m_MailListTableKind(0),
      m_DeletedCardsTableKind(0),
      m_CardRowScopeToken(0),
      m_FirstNameColumnToken(0),
      m_LastNameColumnToken(0),
      m_PhoneticFirstNameColumnToken(0),
      m_PhoneticLastNameColumnToken(0),
      m_DisplayNameColumnToken(0),
      m_NickNameColumnToken(0),
      m_PriEmailColumnToken(0),
      m_2ndEmailColumnToken(0),
      m_DefaultEmailColumnToken(0),
      m_CardTypeColumnToken(0),
      m_WorkPhoneColumnToken(0),
      m_HomePhoneColumnToken(0),
      m_FaxColumnToken(0),
      m_PagerColumnToken(0),
      m_CellularColumnToken(0),
      m_WorkPhoneTypeColumnToken(0),
      m_HomePhoneTypeColumnToken(0),
      m_FaxTypeColumnToken(0),
      m_PagerTypeColumnToken(0),
      m_CellularTypeColumnToken(0),
      m_HomeAddressColumnToken(0),
      m_HomeAddress2ColumnToken(0),
      m_HomeCityColumnToken(0),
      m_HomeStateColumnToken(0),
      m_HomeZipCodeColumnToken(0),
      m_HomeCountryColumnToken(0),
      m_WorkAddressColumnToken(0),
      m_WorkAddress2ColumnToken(0),
      m_WorkCityColumnToken(0),
      m_WorkStateColumnToken(0),
      m_WorkZipCodeColumnToken(0),
      m_WorkCountryColumnToken(0),
      m_CompanyColumnToken(0),
      m_AimScreenNameColumnToken(0),
      m_AnniversaryYearColumnToken(0),
      m_AnniversaryMonthColumnToken(0),
      m_AnniversaryDayColumnToken(0),
      m_SpouseNameColumnToken(0),
      m_FamilyNameColumnToken(0),
      m_DefaultAddressColumnToken(0),
      m_CategoryColumnToken(0),
      m_WebPage1ColumnToken(0),
      m_WebPage2ColumnToken(0),
      m_BirthYearColumnToken(0),
      m_BirthMonthColumnToken(0),
      m_BirthDayColumnToken(0),
      m_Custom1ColumnToken(0),
      m_Custom2ColumnToken(0),
      m_Custom3ColumnToken(0),
      m_Custom4ColumnToken(0),
      m_NotesColumnToken(0),
      m_LastModDateColumnToken(0),
      m_MailFormatColumnToken(0),
      m_PopularityIndexColumnToken(0),
      m_AllowRemoteContentColumnToken(0),
      m_AddressCharSetColumnToken(0),
      m_LastRecordKey(0),
      m_dbDirectory(nsnull)
{
}

Here is the caller graph for this function:

Definition at line 176 of file nsAddrDatabase.cpp.

{
    Close(PR_FALSE);    // better have already been closed.
    if (m_ChangeListeners)
    {
        // better not be any listeners, because we're going away.
        NS_ASSERTION(m_ChangeListeners->Count() == 0, "shouldn't have any listeners");
        delete m_ChangeListeners;
    }

    RemoveFromCache(this);
}

Here is the call graph for this function:


Member Function Documentation

NS_IMETHOD nsAddrDatabase::Add2ndEmail ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 132 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::add2ndEmail ( in nsIMdbRow  row,
in string  value 
) [inherited]
void nsIAddrDatabase::addAimScreenName ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddAimScreenName ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 225 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 147 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addAnniversaryDay ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddAnniversaryDay ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 234 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addAnniversaryMonth ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddAnniversaryMonth ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 231 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addAnniversaryYear ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddAnniversaryYear ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 228 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::AddAttributeColumnsToRow ( nsIAbCard card,
nsIMdbRow cardRow 
) [protected]

Definition at line 1397 of file nsAddrDatabase.cpp.

{
  nsresult err = NS_OK;
  
  if ((!card && !cardRow) || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;
  
  mdbOid rowOid, tableOid;
  m_mdbPabTable->GetOid(m_mdbEnv, &tableOid);
  cardRow->GetOid(m_mdbEnv, &rowOid);
  
  nsCOMPtr<nsIAbMDBCard> dbcard(do_QueryInterface(card, &err));
  if(NS_SUCCEEDED(err) && dbcard)
  {
    dbcard->SetDbTableID(tableOid.mOid_Id);
    dbcard->SetDbRowID(rowOid.mOid_Id);
  }
  // add the row to the singleton table.
  if (card && cardRow)
  {
    nsXPIDLString unicodeStr;
    card->GetFirstName(getter_Copies(unicodeStr));
    AddFirstName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetLastName(getter_Copies(unicodeStr));
    AddLastName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetPhoneticFirstName(getter_Copies(unicodeStr));
    AddPhoneticFirstName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetPhoneticLastName(getter_Copies(unicodeStr));
    AddPhoneticLastName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetDisplayName(getter_Copies(unicodeStr));
    AddDisplayName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetNickName(getter_Copies(unicodeStr));
    AddNickName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetPrimaryEmail(getter_Copies(unicodeStr));
    if (unicodeStr)
      AddUnicodeToColumn(cardRow, m_PriEmailColumnToken, m_LowerPriEmailColumnToken, unicodeStr);

    card->GetSecondEmail(getter_Copies(unicodeStr));
    Add2ndEmail(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetDefaultEmail(getter_Copies(unicodeStr));
    AddDefaultEmail(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetCardType(getter_Copies(unicodeStr));
    AddCardType(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    PRUint32 format = nsIAbPreferMailFormat::unknown;
    card->GetPreferMailFormat(&format);
    AddPreferMailFormat(cardRow, format);

    PRUint32 popularityIndex = 0;
    card->GetPopularityIndex(&popularityIndex);
    AddPopularityIndex(cardRow, popularityIndex);

    PRBool allowRemoteContent = PR_FALSE;
    card->GetAllowRemoteContent(&allowRemoteContent);
    AddAllowRemoteContent(cardRow, allowRemoteContent);
    
    card->GetWorkPhone(getter_Copies(unicodeStr));
    AddWorkPhone(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetHomePhone(getter_Copies(unicodeStr));
    AddHomePhone(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetFaxNumber(getter_Copies(unicodeStr));
    AddFaxNumber(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetPagerNumber(getter_Copies(unicodeStr));
    AddPagerNumber(cardRow,NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetCellularNumber(getter_Copies(unicodeStr));
    AddCellularNumber(cardRow,NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetWorkPhoneType(getter_Copies(unicodeStr));
    AddWorkPhoneType(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetHomePhoneType(getter_Copies(unicodeStr));
    AddHomePhoneType(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetFaxNumberType(getter_Copies(unicodeStr));
    AddFaxNumberType(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetPagerNumberType(getter_Copies(unicodeStr));
    AddPagerNumberType(cardRow,NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetCellularNumberType(getter_Copies(unicodeStr));
    AddCellularNumberType(cardRow,NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetHomeAddress(getter_Copies(unicodeStr));
    AddHomeAddress(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetHomeAddress2(getter_Copies(unicodeStr)); 
    AddHomeAddress2(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetHomeCity(getter_Copies(unicodeStr)); 
    AddHomeCity(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetHomeState(getter_Copies(unicodeStr)); 
    AddHomeState(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetHomeZipCode(getter_Copies(unicodeStr)); 
    AddHomeZipCode(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetHomeCountry(getter_Copies(unicodeStr)); 
    AddHomeCountry(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetWorkAddress(getter_Copies(unicodeStr));  
    AddWorkAddress(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetWorkAddress2(getter_Copies(unicodeStr)); 
    AddWorkAddress2(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetWorkCity(getter_Copies(unicodeStr)); 
    AddWorkCity(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetWorkState(getter_Copies(unicodeStr)); 
    AddWorkState(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
     
    card->GetWorkZipCode(getter_Copies(unicodeStr)); 
    AddWorkZipCode(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
     
    card->GetWorkCountry(getter_Copies(unicodeStr)); 
    AddWorkCountry(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetJobTitle(getter_Copies(unicodeStr)); 
    AddJobTitle(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetDepartment(getter_Copies(unicodeStr)); 
    AddDepartment(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetCompany(getter_Copies(unicodeStr)); 
    AddCompany(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
     
    // AimScreenName
    card->GetAimScreenName(getter_Copies(unicodeStr)); 
    AddAimScreenName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
     
    card->GetAnniversaryYear(getter_Copies(unicodeStr)); 
    AddAnniversaryYear(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
  
    card->GetAnniversaryMonth(getter_Copies(unicodeStr)); 
    AddAnniversaryMonth(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
  
    card->GetAnniversaryDay(getter_Copies(unicodeStr)); 
    AddAnniversaryDay(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());

    card->GetSpouseName(getter_Copies(unicodeStr)); 
    AddSpouseName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());

    card->GetFamilyName(getter_Copies(unicodeStr)); 
    AddFamilyName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());

    card->GetDefaultAddress(getter_Copies(unicodeStr)); 
    AddDefaultAddress(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());

    card->GetCategory(getter_Copies(unicodeStr)); 
    AddCategory(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());

    card->GetWebPage1(getter_Copies(unicodeStr)); 
    AddWebPage1(cardRow,NS_ConvertUCS2toUTF8(unicodeStr).get());
     
    card->GetWebPage2(getter_Copies(unicodeStr)); 
    AddWebPage2(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
     
    card->GetBirthYear(getter_Copies(unicodeStr)); 
    AddBirthYear(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetBirthMonth(getter_Copies(unicodeStr)); 
    AddBirthMonth(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetBirthDay(getter_Copies(unicodeStr)); 
    AddBirthDay(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetCustom1(getter_Copies(unicodeStr)); 
    AddCustom1(cardRow,NS_ConvertUCS2toUTF8(unicodeStr).get());
     
    card->GetCustom2(getter_Copies(unicodeStr)); 
    AddCustom2(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetCustom3(getter_Copies(unicodeStr)); 
    AddCustom3(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    card->GetCustom4(getter_Copies(unicodeStr)); 
    AddCustom4(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
    
    card->GetNotes(getter_Copies(unicodeStr)); 
    AddNotes(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
      
    PRUint32 lastModDate = 0;
    card->GetLastModifiedDate(&lastModDate);
    AddIntColumn(cardRow, m_LastModDateColumnToken, lastModDate);
      
  }
  return NS_OK;
}

Here is the caller graph for this function:

void nsIAddrDatabase::addBirthDay ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddBirthDay ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 261 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addBirthMonth ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddBirthMonth ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 258 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addBirthYear ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddBirthYear ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 255 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::AddBoolColumn ( nsIMdbRow cardRow,
mdb_column  inColumn,
PRBool  bValue 
) [protected]

Definition at line 2571 of file nsAddrDatabase.cpp.

{
  if (!m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  struct mdbYarn yarn;
  char    yarnBuf[100];

  yarn.mYarn_Buf = (void *) yarnBuf;
  yarn.mYarn_Size = sizeof(yarnBuf);

  GetIntYarn(bValue ? 1 : 0, &yarn);

  mdb_err err = cardRow->AddColumn(m_mdbEnv, inColumn, &yarn);

  return (err == NS_OK) ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2448 of file nsAddrDatabase.cpp.

{
  if (m_mdbPabTable && m_mdbEnv)
  {
    if (m_mdbPabTable->AddRow(m_mdbEnv, newRow) == NS_OK)
    {
      AddRecordKeyColumnToRow(newRow);
      return NS_OK;
    }
    return NS_ERROR_FAILURE;
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

NS_IMETHOD nsAddrDatabase::AddCardType ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 138 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addCardType ( in nsIMdbRow  row,
in string  value 
) [inherited]
void nsIAddrDatabase::addCategory ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddCategory ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 246 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsAddrDatabase::AddCellularNumber ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 162 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addCellularNumber ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddCellularNumberType ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 177 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::AddCharStringColumn ( nsIMdbRow cardRow,
mdb_column  inColumn,
const char *  str 
) [protected]

Definition at line 2529 of file nsAddrDatabase.cpp.

{
  if (!m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  struct mdbYarn yarn;

  GetCharStringYarn((char *) str, &yarn);
  mdb_err err = cardRow->AddColumn(m_mdbEnv,  inColumn, &yarn);

  return (err == NS_OK) ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

void nsIAddrDatabase::addCompany ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddCompany ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 222 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addCustom1 ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddCustom1 ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 264 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addCustom2 ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddCustom2 ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 267 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addCustom3 ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddCustom3 ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 270 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addCustom4 ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddCustom4 ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 273 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addDefaultAddress ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddDefaultAddress ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 243 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsAddrDatabase::AddDefaultEmail ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 135 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addDefaultEmail ( in nsIMdbRow  row,
in string  value 
) [inherited]
void nsIAddrDatabase::addDepartment ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddDepartment ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 219 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsAddrDatabase::AddDisplayName ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 124 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addDisplayName ( in nsIMdbRow  row,
in string  value 
) [inherited]
void nsIAddrDatabase::addFamilyName ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddFamilyName ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 240 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsAddrDatabase::AddFaxNumber ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 156 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addFaxNumber ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddFaxNumberType ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 171 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addFaxNumberType ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddFirstName ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 112 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addFirstName ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddHomeAddress ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 180 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addHomeAddress ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddHomeAddress2 ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 183 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addHomeAddress2 ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddHomeCity ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 186 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addHomeCity ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddHomeCountry ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 195 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addHomeCountry ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddHomePhone ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 153 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addHomePhone ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddHomePhoneType ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 168 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addHomePhoneType ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddHomeState ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 189 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addHomeState ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddHomeZipCode ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 192 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addHomeZipCode ( in nsIMdbRow  row,
in string  value 
) [inherited]
nsresult nsAddrDatabase::AddIntColumn ( nsIMdbRow cardRow,
mdb_column  inColumn,
PRUint32  nValue 
) [protected]

Definition at line 2555 of file nsAddrDatabase.cpp.

{
  if (!m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  struct mdbYarn yarn;
  char    yarnBuf[100];

  yarn.mYarn_Buf = (void *) yarnBuf;
  yarn.mYarn_Size = sizeof(yarnBuf);
  GetIntYarn(nValue, &yarn);
  mdb_err err = cardRow->AddColumn(m_mdbEnv,  inColumn, &yarn);

  return (err == NS_OK) ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsAddrDatabase::AddJobTitle ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 216 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addJobTitle ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddLastName ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 115 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addLastName ( in nsIMdbRow  row,
in string  value 
) [inherited]

Definition at line 2463 of file nsAddrDatabase.cpp.

{
  if (!m_mdbStore || !listRow || !value || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  PRUint32 total = GetListAddressTotal(listRow);
  //add member
  nsCAutoString valueString(value);
  nsCAutoString email;
  PRInt32 emailPos = valueString.Find("mail=");
  emailPos += strlen("mail=");
  valueString.Right(email, valueString.Length() - emailPos);
  nsCOMPtr <nsIMdbRow> cardRow;
  // Please DO NOT change the 3rd param of GetRowFromAttribute() call to 
  // PR_TRUE (ie, case insensitive) without reading bugs #128535 and #121478.
  nsresult rv = GetRowFromAttribute(kPriEmailColumn, email.get(), PR_FALSE /* retain case */, getter_AddRefs(cardRow));
  if (NS_SUCCEEDED(rv) && cardRow)
  {
    mdbOid outOid;
    mdb_id rowID = 0;
    if (cardRow->GetOid(m_mdbEnv, &outOid) == NS_OK)
      rowID = outOid.mOid_Id;

    // start from 1
    total += 1;
    mdb_token listAddressColumnToken;
    char columnStr[COLUMN_STR_MAX];
    PR_snprintf(columnStr, COLUMN_STR_MAX, kMailListAddressFormat, total); 
    m_mdbStore->StringToToken(m_mdbEnv, columnStr, &listAddressColumnToken);

    rv = AddIntColumn(listRow, listAddressColumnToken, rowID);
    NS_ENSURE_SUCCESS(rv, rv);

    SetListAddressTotal(listRow, total);
  }
  return NS_OK;
}

Here is the call graph for this function:

void nsIAddrDatabase::addLdifListMember ( in nsIMdbRow  row,
in string  value 
) [inherited]

Definition at line 1793 of file nsAddrDatabase.cpp.

{
    nsresult    err = NS_OK;

    if ((!list && !listRow) || !m_mdbEnv)
        return NS_ERROR_NULL_POINTER;

    mdbOid rowOid, tableOid;
    m_mdbPabTable->GetOid(m_mdbEnv, &tableOid);
    listRow->GetOid(m_mdbEnv, &rowOid);

    nsCOMPtr<nsIAbMDBDirectory> dblist(do_QueryInterface(list,&err));
    if (NS_SUCCEEDED(err))
        dblist->SetDbRowID(rowOid.mOid_Id);

    // add the row to the singleton table.
    if (NS_SUCCEEDED(err) && listRow)
    {
        nsXPIDLString unicodeStr;

        list->GetDirName(getter_Copies(unicodeStr));
        if (unicodeStr)
            AddUnicodeToColumn(listRow, m_ListNameColumnToken, m_LowerListNameColumnToken, unicodeStr);

        list->GetListNickName(getter_Copies(unicodeStr));
        AddListNickName(listRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
        
        list->GetDescription(getter_Copies(unicodeStr));
        AddListDescription(listRow, NS_ConvertUCS2toUTF8(unicodeStr).get());
            
    // XXX todo, this code has problems if you manually enter duplicate emails.
        nsCOMPtr <nsISupportsArray> pAddressLists;
        list->GetAddressLists(getter_AddRefs(pAddressLists));
        PRUint32 count;
        pAddressLists->Count(&count);

      nsXPIDLString email;
        PRUint32 i, total;
        total = 0;
        for (i = 0; i < count; i++)
        {
            nsCOMPtr<nsIAbCard> pCard(do_QueryElementAt(pAddressLists, i, &err));
            
            if (NS_FAILED(err))
                continue;

            pCard->GetPrimaryEmail(getter_Copies(email));
            PRInt32 emailLength = nsCRT::strlen(email);
            if (email && emailLength)
                total++;
        }
        SetListAddressTotal(listRow, total);

        PRUint32 pos;
        for (i = 0; i < count; i++)
        {
            nsCOMPtr<nsIAbCard> pCard(do_QueryElementAt(pAddressLists, i, &err));
            
            if (NS_FAILED(err))
                continue;

            PRBool listHasCard = PR_FALSE;
            err = list->HasCard(pCard, &listHasCard);

            // start from 1
            pos = i + 1;
            pCard->GetPrimaryEmail(getter_Copies(email));
            PRInt32 emailLength = nsCRT::strlen(email);
            if (email && emailLength)
            {
                nsCOMPtr<nsIAbCard> pNewCard;
                err = AddListCardColumnsToRow(pCard, listRow, pos, getter_AddRefs(pNewCard), listHasCard);
                if (pNewCard)
                    pAddressLists->ReplaceElementAt(pNewCard, i);
            }
        }
    }
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::AddListCardColumnsToRow ( in nsIAbCard  aPCard,
in nsIMdbRow  aPListRow,
in unsigned long  aPos,
out nsIAbCard  aPNewCard,
in boolean  aInMailingList 
) [inherited]

Here is the caller graph for this function:

NS_IMETHODIMP nsAddrDatabase::AddListCardColumnsToRow ( nsIAbCard aPCard,
nsIMdbRow aPListRow,
PRUint32  aPos,
nsIAbCard **  aPNewCard,
PRBool  aInMailingList 
)

Definition at line 1717 of file nsAddrDatabase.cpp.

{
  if (!pCard || !pListRow || !m_mdbStore || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;
  
  nsresult    err = NS_OK;
  nsXPIDLString email;
  pCard->GetPrimaryEmail(getter_Copies(email));
  if (email)
  {
    nsIMdbRow    *pCardRow = nsnull;
    // Please DO NOT change the 3rd param of GetRowFromAttribute() call to 
    // PR_TRUE (ie, case insensitive) without reading bugs #128535 and #121478.
    err = GetRowFromAttribute(kPriEmailColumn, NS_ConvertUCS2toUTF8(email).get(), PR_FALSE /* retain case */, &pCardRow);
    PRBool cardWasAdded = PR_FALSE;
    if (NS_FAILED(err) || !pCardRow)
    {
      //New Email, then add a new row with this email
      err  = GetNewRow(&pCardRow);
      
      if (NS_SUCCEEDED(err) && pCardRow)
      {
        AddPrimaryEmail(pCardRow, NS_ConvertUCS2toUTF8(email).get());
        err = m_mdbPabTable->AddRow(m_mdbEnv, pCardRow);
        // Create a key for this row as well.
        if (NS_SUCCEEDED(err))
          AddRecordKeyColumnToRow(pCardRow);
      }
      
      cardWasAdded = PR_TRUE;
    }
    
    NS_ENSURE_TRUE(pCardRow, NS_ERROR_NULL_POINTER);
    
    nsXPIDLString name;
    pCard->GetDisplayName(getter_Copies(name));
    if (!name.IsEmpty()) {
      AddDisplayName(pCardRow, NS_ConvertUCS2toUTF8(name).get());
      err = m_mdbPabTable->AddRow(m_mdbEnv, pCardRow);
    }

    nsCOMPtr<nsIAbCard> newCard;
    CreateABCard(pCardRow, 0, getter_AddRefs(newCard));
    NS_IF_ADDREF(*pNewCard = newCard);
    
    if (cardWasAdded) {
      NotifyCardEntryChange(AB_NotifyInserted, newCard);
    }
    else if (!aInMailingList) {
      NotifyCardEntryChange(AB_NotifyInserted, pCard);
    }
    else {
      NotifyCardEntryChange(AB_NotifyPropertyChanged, pCard);
    }
    
    //add a column with address row id to the list row
    mdb_token listAddressColumnToken;
    
    char columnStr[COLUMN_STR_MAX];
    PR_snprintf(columnStr, COLUMN_STR_MAX, kMailListAddressFormat, pos);
    m_mdbStore->StringToToken(m_mdbEnv,  columnStr, &listAddressColumnToken);
    
    mdbOid outOid;
    
    if (pCardRow->GetOid(m_mdbEnv, &outOid) == NS_OK)
    {
      //save address row ID to the list row
      err = AddIntColumn(pListRow, listAddressColumnToken, outOid.mOid_Id);
    }
    NS_RELEASE(pCardRow);

  }
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addListDescription ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddListDescription ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 284 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3736 of file nsAddrDatabase.cpp.

{
    nsresult rv = NS_OK;

    nsCOMPtr<nsIProxyObjectManager> proxyMgr = 
             do_GetService(NS_XPCOMPROXY_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

  static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
    NS_WITH_PROXIED_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, NS_UI_THREAD_EVENTQ, &rv);
    if (NS_SUCCEEDED(rv)) 
    {
        nsCOMPtr<nsIRDFResource>    parentResource;

        char* file = m_dbName.GetLeafName();
        char *parentUri = PR_smprintf("%s%s", kMDBDirectoryRoot, file);
        rv = rdfService->GetResource(nsDependentCString(parentUri), getter_AddRefs(parentResource));
        nsCOMPtr<nsIAbDirectory> parentDir;
        rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID( nsIAbDirectory),
                                    parentResource, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( parentDir));
        if (parentDir)
        {
            m_dbDirectory = parentDir;
            nsCOMPtr<nsIAbDirectory> mailList;
            rv = CreateABList(listRow, getter_AddRefs(mailList));
            if (mailList)
            {
                nsCOMPtr<nsIAbMDBDirectory> dbparentDir(do_QueryInterface(parentDir, &rv));
                if(NS_SUCCEEDED(rv))
                    dbparentDir->NotifyDirItemAdded(mailList);
            }
        }
        if (parentUri)
            PR_smprintf_free(parentUri);
        if (file)
            nsCRT::free(file);
    }
    return rv;
}

Here is the call graph for this function:

void nsIAddrDatabase::addListName ( in nsIMdbRow  row,
in string  value 
) [inherited]

Definition at line 2701 of file nsAddrDatabase.cpp.

Here is the call graph for this function:

void nsIAddrDatabase::addListNickName ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddListNickName ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 281 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::AddLowercaseColumn ( nsIMdbRow row,
mdb_token  columnToken,
const char *  utf8String 
) [protected]

Definition at line 2718 of file nsAddrDatabase.cpp.

{
  nsresult rv = NS_OK;
  if (columnValue)
  {
    NS_ConvertUTF8toUCS2 newUnicodeString(columnValue);
    ToLowerCase(newUnicodeString);
    rv = AddCharStringColumn(row, columnToken, NS_ConvertUCS2toUTF8(newUnicodeString).get());   
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsAddrDatabase::AddNickName ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 127 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addNickName ( in nsIMdbRow  row,
in string  value 
) [inherited]
void nsIAddrDatabase::addNotes ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddNotes ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 276 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsAddrDatabase::AddPagerNumber ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 159 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addPagerNumber ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddPagerNumberType ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 174 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addPagerNumberType ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddPhoneticFirstName ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 118 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addPhoneticFirstName ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddPhoneticLastName ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 121 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addPhoneticLastName ( in nsIMdbRow  row,
in string  value 
) [inherited]

Definition at line 144 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addPopularityIndex ( in nsIMdbRow  row,
in unsigned long  value 
) [inherited]

Definition at line 141 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addPreferMailFormat ( in nsIMdbRow  row,
in unsigned long  value 
) [inherited]

Definition at line 2688 of file nsAddrDatabase.cpp.

Here is the call graph for this function:

void nsIAddrDatabase::addPrimaryEmail ( in nsIMdbRow  row,
in string  value 
) [inherited]

Definition at line 1382 of file nsAddrDatabase.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::AddRowToDeletedCardsTable ( nsIAbCard card,
nsIMdbRow **  pCardRow 
) [protected]

Definition at line 960 of file nsAddrDatabase.cpp.

{
  if (!m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsresult rv = NS_OK;
  if (!m_mdbDeletedCardsTable)
    rv = InitDeletedCardsTable(PR_TRUE);
  if (NS_SUCCEEDED(rv)) {
    // lets first purge old records if there are more than PURGE_CUTOFF_COUNT records
    PurgeDeletedCardTable();
    nsCOMPtr<nsIMdbRow> cardRow;
    rv = GetNewRow(getter_AddRefs(cardRow));
    if (NS_SUCCEEDED(rv) && cardRow) {
      mdb_err merror = m_mdbDeletedCardsTable->AddRow(m_mdbEnv, cardRow);
      if (merror != NS_OK) return NS_ERROR_FAILURE;
      nsXPIDLString unicodeStr;
      card->GetFirstName(getter_Copies(unicodeStr));
      AddFirstName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());

      card->GetLastName(getter_Copies(unicodeStr));
      AddLastName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());

      card->GetDisplayName(getter_Copies(unicodeStr));
      AddDisplayName(cardRow, NS_ConvertUCS2toUTF8(unicodeStr).get());

      card->GetPrimaryEmail(getter_Copies(unicodeStr));
      if (unicodeStr)
        AddUnicodeToColumn(cardRow, m_PriEmailColumnToken, m_LowerPriEmailColumnToken, unicodeStr);

      PRUint32 nowInSeconds;
      PRTime now = PR_Now();
      PRTime2Seconds(now, &nowInSeconds);
      AddIntColumn(cardRow, m_LastModDateColumnToken, nowInSeconds);

      nsXPIDLString value;
      GetCardValue(card, CARD_ATTRIB_PALMID, getter_Copies(value));
      if (value)
      {
        nsCOMPtr<nsIAbCard> addedCard;
        rv = CreateCardFromDeletedCardsTable(cardRow, 0, getter_AddRefs(addedCard));
        if (NS_SUCCEEDED(rv))
          SetCardValue(addedCard, CARD_ATTRIB_PALMID, value, PR_FALSE);
      }
      NS_IF_ADDREF(*pCardRow = cardRow);
    }
    Commit(nsAddrDBCommitType::kLargeCommit);
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addRowValue ( in nsIMdbRow  aRow,
in ACString  aLDIFAttributeName,
in AString  aColValue 
) [inherited]

used for adding a string attributes to a row.

used during LDIF and addressbook import.

Parameters:
aRowThe row we're adding the column to
aLDIFAttributeNameThe column name (examples: mozillaCategory, mozilla_AimScreenName)
aColValueThe column value (example: jabroni316)
NS_IMETHODIMP nsAddrDatabase::AddRowValue ( nsIMdbRow aRow,
const nsACString &  aLDIFAttributeName,
const nsAString &  aColValue 
)

Definition at line 3709 of file nsAddrDatabase.cpp.

{
  PRInt32 i;
  for (i = 0; i < EXPORT_ATTRIBUTES_TABLE_COUNT; i++) {
    // need strcasecmp, LDIF is case insensitive
    if (nsCRT::strcasecmp(EXPORT_ATTRIBUTES_TABLE[i].ldapPropertyName, PromiseFlatCString(aLDIFAttributeName).get()) == 0) {
      mdb_token token;
      m_mdbStore->StringToToken(GetEnv(), EXPORT_ATTRIBUTES_TABLE[i].abColName, &token);
      nsresult rv = AddStringColumn(aRow, token, aColValue);
      NS_ENSURE_SUCCESS(rv,rv);
      return NS_OK;
    }
  }
  NS_ASSERTION(0, "failed to map LDIF attribute to column");
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

void nsIAddrDatabase::addSpouseName ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddSpouseName ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 237 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::AddStringColumn ( nsIMdbRow aCardRow,
mdb_column  aInColumn,
const nsAString &  aStr 
) [protected]

Definition at line 2542 of file nsAddrDatabase.cpp.

{
  if (!m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  struct mdbYarn yarn;

  GetStringYarn(aStr, &yarn);
  mdb_err err = aCardRow->AddColumn(m_mdbEnv, aInColumn, &yarn);

  return (err == NS_OK) ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void nsAddrDatabase::AddToCache ( nsAddrDatabase pAddrDB) [inline, static, protected]

Definition at line 334 of file nsAddrDatabase.h.

{GetDBCache()->AppendElement(pAddrDB);}

Here is the call graph for this function:

nsresult nsAddrDatabase::AddUnicodeToColumn ( nsIMdbRow row,
mdb_token  colToken,
mdb_token  lowerCaseColToken,
const PRUnichar pUnicodeStr 
) [protected]

Definition at line 1280 of file nsAddrDatabase.cpp.

{
  nsresult rv = AddCharStringColumn(row, aColToken, NS_ConvertUCS2toUTF8(aUnicodeStr).get());
  NS_ENSURE_SUCCESS(rv,rv);

  rv = AddLowercaseColumn(row, aLowerCaseColToken, NS_ConvertUCS2toUTF8(aUnicodeStr).get());
  NS_ENSURE_SUCCESS(rv,rv);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addWebPage1 ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddWebPage1 ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 249 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addWebPage2 ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddWebPage2 ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 252 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsAddrDatabase::AddWorkAddress ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 198 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addWorkAddress ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddWorkAddress2 ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 201 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addWorkAddress2 ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddWorkCity ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 204 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addWorkCity ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddWorkCountry ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 213 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addWorkCountry ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddWorkPhone ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 150 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addWorkPhone ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddWorkPhoneType ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 165 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addWorkPhoneType ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddWorkState ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 207 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addWorkState ( in nsIMdbRow  row,
in string  value 
) [inherited]
NS_IMETHOD nsAddrDatabase::AddWorkZipCode ( nsIMdbRow row,
const char *  value 
) [inline]

Definition at line 210 of file nsAddrDatabase.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::addWorkZipCode ( in nsIMdbRow  row,
in string  value 
) [inherited]
nsresult nsAddrDatabase::AlertAboutCorruptMabFile ( const PRUnichar aOldFileName,
const PRUnichar aNewFileName 
) [private]

Definition at line 690 of file nsAddrDatabase.cpp.

{
  const PRUnichar *formatStrings[] = { aOldFileName, aOldFileName, aNewFileName };
  return DisplayAlert(NS_LITERAL_STRING("corruptMabFileTitle").get(),
    NS_LITERAL_STRING("corruptMabFileAlert").get(), formatStrings, 3);
}

Here is the call graph for this function:

Definition at line 697 of file nsAddrDatabase.cpp.

{
  const PRUnichar *formatStrings[] = { aFileName };
  return DisplayAlert(NS_LITERAL_STRING("lockedMabFileTitle").get(),
    NS_LITERAL_STRING("lockedMabFileAlert").get(), formatStrings, 1);
}

Here is the call graph for this function:

Definition at line 1158 of file nsAddrDatabase.cpp.

{
  if (!m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsresult err = NS_OK;
  nsIMdbTableRowCursor* rowCursor = nsnull;
  nsIMdbRow* findRow = nsnull;
  mdb_pos rowPos = 0;

  mdb_err merror = m_mdbPabTable->GetTableRowCursor(m_mdbEnv, -1, &rowCursor);

  if (!(merror == NS_OK && rowCursor))
    return NS_ERROR_FAILURE;

  nsCOMPtr <nsIMdbRow> pDataRow;
  err = GetDataRow(getter_AddRefs(pDataRow));
  if (NS_FAILED(err))
    InitLastRecorKey();

  do
  {  //add key to each card and mailing list row
    merror = rowCursor->NextRow(m_mdbEnv, &findRow, &rowPos);
    if (merror == NS_OK && findRow)
    {
      mdbOid rowOid;

      if (findRow->GetOid(GetEnv(), &rowOid) == NS_OK)
      {
        if (!IsDataRowScopeToken(rowOid.mOid_Scope))
        {
          m_LastRecordKey++;
          err = AddIntColumn(findRow, m_RecordKeyColumnToken, m_LastRecordKey);
        }
      }
    }
  } while (findRow);

  UpdateLastRecordKey();
  Commit(nsAddrDBCommitType::kLargeCommit);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 364 of file nsAddrDatabase.cpp.

{
    if (m_dbCache) // clean up memory leak
    {
        PRInt32 i;
        for (i = 0; i < GetDBCache()->Count(); i++)
        {
            nsAddrDatabase* pAddrDB = NS_STATIC_CAST(nsAddrDatabase*, GetDBCache()->ElementAt(i));
            if (pAddrDB)
            {
                pAddrDB->ForceClosed();
                i--;    // back up array index, since closing removes db from cache.
            }
        }
//        NS_ASSERTION(GetNumInCache() == 0, "some msg dbs left open");    // better not be any open db's.
        delete m_dbCache;
    }
    m_dbCache = nsnull; // Need to reset to NULL since it's a
              // static global ptr and maybe referenced 
              // again in other places.
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 942 of file nsAddrDatabase.cpp.

{
    return CloseMDB(forceCommit);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::close ( in boolean  forceCommit) [inherited]

Definition at line 854 of file nsAddrDatabase.cpp.

{
    if (commit)
        Commit(nsAddrDBCommitType::kSessionCommit);
//???    RemoveFromCache(this);  // if we've closed it, better not leave it in the cache.
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::closeMDB ( in boolean  commit) [inherited]

Definition at line 882 of file nsAddrDatabase.cpp.

{
  nsresult err = NS_OK;
  nsIMdbThumb *commitThumb = nsnull;

  if (commitType == nsAddrDBCommitType::kLargeCommit ||
      commitType == nsAddrDBCommitType::kSessionCommit)
  {
    mdb_percent outActualWaste = 0;
    mdb_bool outShould;
    if (m_mdbStore && m_mdbEnv)
    {
      // check how much space would be saved by doing a compress commit.
      // If it's more than 30%, go for it.
      // N.B. - I'm not sure this calls works in Mork for all cases.
      err = m_mdbStore->ShouldCompress(m_mdbEnv, 30, &outActualWaste, &outShould);
      if (NS_SUCCEEDED(err) && outShould)
      {
        commitType = nsAddrDBCommitType::kCompressCommit;
      }
    }
  }

  if (m_mdbStore && m_mdbEnv)
  {
    switch (commitType)
    {
      case nsAddrDBCommitType::kSmallCommit:
        err = m_mdbStore->SmallCommit(m_mdbEnv);
        break;
      case nsAddrDBCommitType::kLargeCommit:
        err = m_mdbStore->LargeCommit(m_mdbEnv, &commitThumb);
        break;
      case nsAddrDBCommitType::kSessionCommit:
        // comment out until persistence works.
        err = m_mdbStore->SessionCommit(m_mdbEnv, &commitThumb);
        break;
      case nsAddrDBCommitType::kCompressCommit:
        err = m_mdbStore->CompressCommit(m_mdbEnv, &commitThumb);
        break;
    }
  }
  if (commitThumb && m_mdbEnv)
  {
    mdb_count outTotal = 0;    // total somethings to do in operation
    mdb_count outCurrent = 0;  // subportion of total completed so far
    mdb_bool outDone = PR_FALSE;      // is operation finished?
    mdb_bool outBroken = PR_FALSE;     // is operation irreparably dead and broken?
    while (!outDone && !outBroken && err == NS_OK)
    {
      err = commitThumb->DoMore(m_mdbEnv, &outTotal, &outCurrent, &outDone, &outBroken);
    }
    NS_RELEASE(commitThumb);
  }
  // ### do something with error, but clear it now because mork errors out on commits.
  if (m_mdbEnv)
    m_mdbEnv->ClearErrors();
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::commit ( in unsigned long  commitType) [inherited]

Definition at line 2315 of file nsAddrDatabase.cpp.

{
    if (!card || !m_mdbPabTable || !m_mdbEnv)
        return NS_ERROR_NULL_POINTER;

    nsresult err = NS_OK;
    mdb_bool hasOid;
    mdbOid rowOid;
    PRBool bIsMailList;

    card->GetIsMailList(&bIsMailList);
    
    if (bIsMailList)
        rowOid.mOid_Scope = m_ListRowScopeToken;
    else
        rowOid.mOid_Scope = m_CardRowScopeToken;

    nsCOMPtr<nsIAbMDBCard> dbcard(do_QueryInterface(card, &err));
    NS_ENSURE_SUCCESS(err, err);
    dbcard->GetDbRowID((PRUint32*)&rowOid.mOid_Id);

    err = m_mdbPabTable->HasOid(m_mdbEnv, &rowOid, &hasOid);
    if (NS_SUCCEEDED(err))
    {
        *hasCard = hasOid;
    }

    return err;
}

Here is the call graph for this function:

Definition at line 2410 of file nsAddrDatabase.cpp.

{
    if (!mailList || !m_mdbPabTable || !m_mdbEnv)
        return NS_ERROR_NULL_POINTER;

    mdb_err err = NS_OK;
    mdb_bool hasOid;
    mdbOid rowOid;

    rowOid.mOid_Scope = m_ListRowScopeToken;

    nsCOMPtr<nsIAbMDBDirectory> dbmailList(do_QueryInterface(mailList,&err));
    NS_ENSURE_SUCCESS(err, err);
    dbmailList->GetDbRowID((PRUint32*)&rowOid.mOid_Id);

    err = m_mdbPabTable->HasOid(m_mdbEnv, &rowOid, &hasOid);
    if (err == NS_OK)
        *hasList = hasOid;

    return (err == NS_OK) ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Definition at line 1267 of file nsAddrDatabase.cpp.

{
    nsAutoString colString;

    nsresult rv = GetStringColumn(row, fromCol, colString);
    if (!colString.IsEmpty())
    {
        rv = AddLowercaseColumn(row, toCol, NS_ConvertUCS2toUTF8(colString).get());
    }
    return rv;
}

Here is the caller graph for this function:

nsresult nsAddrDatabase::CreateABCard ( nsIMdbRow cardRow,
mdb_id  listRowID,
nsIAbCard **  result 
)

Definition at line 3532 of file nsAddrDatabase.cpp.

{
    return CreateCard(cardRow, listRowID, result);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3591 of file nsAddrDatabase.cpp.

{
    nsresult rv = NS_OK; 

    if (!listRow || !m_mdbEnv || !result)
        return NS_ERROR_NULL_POINTER;

    mdbOid outOid;
    mdb_id rowID=0;

    if (listRow->GetOid(m_mdbEnv, &outOid) == NS_OK)
        rowID = outOid.mOid_Id;

    char* listURI = nsnull;
    char* file = nsnull;

    file = m_dbName.GetLeafName();
    listURI = PR_smprintf("%s%s/MailList%ld", kMDBDirectoryRoot, file, rowID);

    nsCOMPtr<nsIAbDirectory> mailList;
    nsCOMPtr<nsIAbMDBDirectory> dbm_dbDirectory(do_QueryInterface(m_dbDirectory, &rv));
    if(NS_SUCCEEDED(rv) && dbm_dbDirectory)
    {
        rv = dbm_dbDirectory->AddDirectory(listURI, getter_AddRefs(mailList));

        nsCOMPtr<nsIAbMDBDirectory> dbmailList (do_QueryInterface(mailList, &rv));

        if (mailList) 
        {
            // if we are using turbo, and we "exit" and restart with the same profile
            // the current mailing list will still be in memory, so when we do
            // GetResource() and QI, we'll get it again.
            // in that scenario, the mailList that we pass in will already be
            // be a mailing list, with a valid row and all the entries
            // in that scenario, we can skip GetListFromDB(), which would have
            // have added all the cards to the list again.
            // see bug #134743
            mdb_id existingID;
            dbmailList->GetDbRowID(&existingID);
            if (existingID != rowID) {
              GetListFromDB(mailList, listRow);
              dbmailList->SetDbRowID(rowID);
              mailList->SetIsMailList(PR_TRUE);
            }

            dbm_dbDirectory->AddMailListToDirectory(mailList);
            NS_IF_ADDREF(*result = mailList);
        }
    }

    if (file)
        nsCRT::free(file);
    if (listURI)
        PR_smprintf_free(listURI);

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3538 of file nsAddrDatabase.cpp.

{
  if (!listRow || !m_mdbEnv || !result)
    return NS_ERROR_NULL_POINTER;

    nsresult rv = NS_OK; 

    mdbOid outOid;
    mdb_id rowID=0;

    if (listRow->GetOid(m_mdbEnv, &outOid) == NS_OK)
        rowID = outOid.mOid_Id;

    char* listURI = nsnull;
    char* file = nsnull;
    file = m_dbName.GetLeafName();
    listURI = PR_smprintf("%s%s/MailList%ld", kMDBDirectoryRoot, file, rowID);

    nsCOMPtr<nsIAbCard> personCard;
    nsCOMPtr<nsIAbMDBDirectory> dbm_dbDirectory(do_QueryInterface(m_dbDirectory, &rv));
    if(NS_SUCCEEDED(rv) && dbm_dbDirectory)
    {
    personCard = do_CreateInstance(NS_ABMDBCARD_CONTRACTID, &rv);
        NS_ENSURE_SUCCESS(rv,rv);

        if (personCard)
        {
            GetListCardFromDB(personCard, listRow);
            mdbOid tableOid;
            m_mdbPabTable->GetOid(m_mdbEnv, &tableOid);
    
            nsCOMPtr<nsIAbMDBCard> dbpersonCard(do_QueryInterface(personCard, &rv));
      if (NS_SUCCEEDED(rv) && dbpersonCard)
      {
              dbpersonCard->SetDbTableID(tableOid.mOid_Id);
              dbpersonCard->SetDbRowID(rowID);
              dbpersonCard->SetAbDatabase(this);
      }
            personCard->SetIsMailList(PR_TRUE);
            personCard->SetMailListURI(listURI);
        }
        
        NS_IF_ADDREF(*result = personCard);
    }
    if (file)
        nsCRT::free(file);
    if (listURI)
        PR_smprintf_free(listURI);

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::CreateCard ( nsIMdbRow cardRow,
mdb_id  listRowID,
nsIAbCard **  result 
) [protected]

Definition at line 3494 of file nsAddrDatabase.cpp.

{
  if (!cardRow || !m_mdbEnv || !result)
    return NS_ERROR_NULL_POINTER;

    nsresult rv = NS_OK; 

    mdbOid outOid;
    mdb_id rowID=0;

    if (cardRow->GetOid(m_mdbEnv, &outOid) == NS_OK)
        rowID = outOid.mOid_Id;

    if(NS_SUCCEEDED(rv))
    {
        nsCOMPtr<nsIAbCard> personCard;
      personCard = do_CreateInstance(NS_ABMDBCARD_CONTRACTID, &rv);
      NS_ENSURE_SUCCESS(rv,rv);

        nsCOMPtr<nsIAbMDBCard> dbpersonCard (do_QueryInterface(personCard, &rv));

        if (NS_SUCCEEDED(rv) && dbpersonCard)
        {
            InitCardFromRow(personCard, cardRow);
            mdbOid tableOid;
            m_mdbPabTable->GetOid(m_mdbEnv, &tableOid);

            dbpersonCard->SetDbTableID(tableOid.mOid_Id);
            dbpersonCard->SetDbRowID(rowID);
            dbpersonCard->SetAbDatabase(this);
        }

        NS_IF_ADDREF(*result = personCard);
    }

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::CreateCardFromDeletedCardsTable ( nsIMdbRow cardRow,
mdb_id  listRowID,
nsIAbCard **  result 
) [protected]

Definition at line 3456 of file nsAddrDatabase.cpp.

{
  if (!cardRow || !m_mdbEnv || !result)
    return NS_ERROR_NULL_POINTER;

    nsresult rv = NS_OK; 

    mdbOid outOid;
    mdb_id rowID=0;

    if (cardRow->GetOid(m_mdbEnv, &outOid) == NS_OK)
        rowID = outOid.mOid_Id;

    if(NS_SUCCEEDED(rv))
    {
        nsCOMPtr<nsIAbCard> personCard;
        personCard = do_CreateInstance(NS_ABMDBCARD_CONTRACTID, &rv);
        NS_ENSURE_SUCCESS(rv,rv);

        nsCOMPtr<nsIAbMDBCard> dbpersonCard (do_QueryInterface(personCard, &rv));

        if (NS_SUCCEEDED(rv) && dbpersonCard)
        {
            InitCardFromRow(personCard, cardRow);
            mdbOid tableOid;
            m_mdbDeletedCardsTable->GetOid(m_mdbEnv, &tableOid);

            dbpersonCard->SetDbTableID(tableOid.mOid_Id);
            dbpersonCard->SetDbRowID(rowID);
            dbpersonCard->SetAbDatabase(this);
        }

        NS_IF_ADDREF(*result = personCard);
    }

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::CreateCardsForMailList ( nsIMdbRow pListRow,
nsIEnumerator **  result 
) [protected]

Definition at line 1911 of file nsAddrDatabase.cpp.

{
    nsresult    err = NS_OK;
    nsIMdbRow    *listRow;

    if (!newList || !m_mdbPabTable || !m_mdbEnv)
        return NS_ERROR_NULL_POINTER;
    
    err  = GetNewListRow(&listRow);

    if (NS_SUCCEEDED(err) && listRow)
    {
        AddListAttributeColumnsToRow(newList, listRow);
        AddRecordKeyColumnToRow(listRow);
        mdb_err merror = m_mdbPabTable->AddRow(m_mdbEnv, listRow);
        if (merror != NS_OK) return NS_ERROR_FAILURE;

        nsCOMPtr<nsIAbCard> listCard;
        CreateABListCard(listRow, getter_AddRefs(listCard));
        NotifyCardEntryChange(AB_NotifyInserted, listCard);

        NS_RELEASE(listRow);
        return NS_OK;
    }
    else 
        return NS_ERROR_FAILURE;

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3926 of file nsAddrDatabase.cpp.

{
  NS_ENSURE_ARG_POINTER(key);

  *key = 0;
  nsresult rv = CreateMailListAndAddToDB(newList, notify);
  if (NS_SUCCEEDED(rv))
    *key = m_LastRecordKey;
  return rv;
}

Here is the call graph for this function:

Definition at line 1599 of file nsAddrDatabase.cpp.

{
  nsCOMPtr <nsIMdbRow> cardRow;
  
  if (!newCard || !m_mdbPabTable || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;
  
  nsresult rv = GetNewRow(getter_AddRefs(cardRow));
  if (NS_SUCCEEDED(rv) && cardRow)
  {
    AddAttributeColumnsToRow(newCard, cardRow);
    AddRecordKeyColumnToRow(cardRow);
    
    // we need to do this for dnd
    PRUint32 key = 0;
    rv = GetIntColumn(cardRow, m_RecordKeyColumnToken, &key, 0);
    if (NS_SUCCEEDED(rv)) {
      nsCOMPtr<nsIAbMDBCard> dbnewCard = do_QueryInterface(newCard);
      if (dbnewCard)
        dbnewCard->SetKey(key);
    }
    
    mdb_err merror = m_mdbPabTable->AddRow(m_mdbEnv, cardRow);
    if (merror != NS_OK) return NS_ERROR_FAILURE;
    
  }
  else
    return rv;
  
  //  do notification
  if (notify)
  {
    NotifyCardEntryChange(AB_NotifyInserted, newCard);
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAddrDatabase::createNewCardAndAddToDB ( in nsIAbCard  newCard,
in boolean  aNotify 
) [inherited]

Definition at line 1636 of file nsAddrDatabase.cpp.

{
  nsresult    err = NS_OK;
  *key = 0;

  err = CreateNewCardAndAddToDB(newCard, notify);
  if (NS_SUCCEEDED(err))
    *key = m_LastRecordKey;

  return err;
}

Here is the call graph for this function:

void nsIAddrDatabase::createNewCardAndAddToDBWithKey ( in nsIAbCard  newCard,
in boolean  aNotify,
out unsigned long  key 
) [inherited]

Definition at line 1648 of file nsAddrDatabase.cpp.

{
  if (!newCard || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsIMdbRow* pListRow = nsnull;
  mdbOid listRowOid;
  listRowOid.mOid_Scope = m_ListRowScopeToken;
  listRowOid.mOid_Id = listRowID;
  nsresult rv = m_mdbStore->GetRow(m_mdbEnv, &listRowOid, &pListRow);
  NS_ENSURE_SUCCESS(rv,rv);

  if (!pListRow)
    return NS_OK;

  nsCOMPtr <nsISupportsArray> addressList;
  rv = aList->GetAddressLists(getter_AddRefs(addressList));
  NS_ENSURE_SUCCESS(rv,rv);

  PRUint32 count;
    addressList->Count(&count);

  nsXPIDLString newEmail;
  rv = newCard->GetPrimaryEmail(getter_Copies(newEmail));
  NS_ENSURE_SUCCESS(rv,rv);

    PRUint32 i;
  for (i = 0; i < count; i++) {
    nsCOMPtr<nsIAbCard> currentCard = do_QueryElementAt(addressList, i, &rv);
    NS_ENSURE_SUCCESS(rv,rv);

    PRBool equals;
    rv = newCard->Equals(currentCard, &equals);
    NS_ENSURE_SUCCESS(rv,rv);

    if (equals) {
      // card is already in list, bail out.
      // this can happen when dropping a card on a mailing list from the directory that contains the mailing list
      return NS_OK;
    }

    nsXPIDLString currentEmail;
    rv = currentCard->GetPrimaryEmail(getter_Copies(currentEmail));
    NS_ENSURE_SUCCESS(rv,rv);

    if (!nsCRT::strcmp(newEmail.get(), currentEmail.get())) {
      // card is already in list, bail out
      // this can happen when dropping a card on a mailing list from another directory (not the one that contains the mailing list
      // or if you have multiple cards on a directory, with the same primary email address.
      return NS_OK;
    }
  }  
    
  // start from 1
  PRUint32 totalAddress = GetListAddressTotal(pListRow) + 1;
  SetListAddressTotal(pListRow, totalAddress);
  nsCOMPtr<nsIAbCard> pNewCard;
  rv = AddListCardColumnsToRow(newCard, pListRow, totalAddress, getter_AddRefs(pNewCard), PR_TRUE /* aInMailingList */);
  NS_ENSURE_SUCCESS(rv,rv);

  addressList->AppendElement(newCard);

  if (notify)
    NotifyCardEntryChange(AB_NotifyInserted, newCard); 

    return rv;
}

Here is the call graph for this function:

void nsIAddrDatabase::createNewListCardAndAddToDB ( in nsIAbDirectory  list,
in unsigned long  listRowID,
in nsIAbCard  newCard,
in boolean  aNotify 
) [inherited]

Definition at line 1970 of file nsAddrDatabase.cpp.

{
  if (!card || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsresult err = NS_OK;
  PRBool bIsMailList = PR_FALSE;
  card->GetIsMailList(&bIsMailList);

  // get the right row
  nsIMdbRow* pCardRow = nsnull;
  mdbOid rowOid;

  rowOid.mOid_Scope = bIsMailList ? m_ListRowScopeToken : m_CardRowScopeToken;

  nsCOMPtr<nsIAbMDBCard> dbcard(do_QueryInterface(card, &err));
  NS_ENSURE_SUCCESS(err, err);

  dbcard->GetDbRowID((PRUint32*)&rowOid.mOid_Id);

  err = m_mdbStore->GetRow(m_mdbEnv, &rowOid, &pCardRow);
  NS_ENSURE_SUCCESS(err,err);
  if (!pCardRow)
    return NS_OK;

  // Add the deleted card to the deletedcards table
  nsCOMPtr <nsIMdbRow> cardRow;
  AddRowToDeletedCardsTable(card, getter_AddRefs(cardRow));
  err = DeleteRow(m_mdbPabTable, pCardRow);
  
  //delete the person card from all mailing list
  if (!bIsMailList)
    DeleteCardFromAllMailLists(rowOid.mOid_Id);
    
  if (NS_SUCCEEDED(err)) {
    if (notify) 
      NotifyCardEntryChange(AB_NotifyDeleted, card);
  }
  else
    DeleteRowFromDeletedCardsTable(cardRow);

  NS_RELEASE(pCardRow);
  return NS_OK;
}

Here is the call graph for this function:

void nsIAddrDatabase::deleteCard ( in nsIAbCard  card,
in boolean  aNotify 
) [inherited]

Definition at line 1940 of file nsAddrDatabase.cpp.

{
  if (!m_mdbEnv)
    return;

    nsCOMPtr <nsIMdbTableRowCursor> rowCursor;
    m_mdbPabTable->GetTableRowCursor(m_mdbEnv, -1, getter_AddRefs(rowCursor));

    if (rowCursor)
    {
        nsCOMPtr <nsIMdbRow> pListRow;
        mdb_pos rowPos;
        do 
        {
            mdb_err err = rowCursor->NextRow(m_mdbEnv, getter_AddRefs(pListRow), &rowPos);

            if (err == NS_OK && pListRow)
            {
                mdbOid rowOid;

                if (pListRow->GetOid(m_mdbEnv, &rowOid) == NS_OK)
                {
                    if (IsListRowScopeToken(rowOid.mOid_Scope))
                        DeleteCardFromListRow(pListRow, cardRowID);
                }
            }
        } while (pListRow);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::DeleteCardFromListRow ( nsIMdbRow pListRow,
mdb_id  cardRowID 
) [protected]

Definition at line 2015 of file nsAddrDatabase.cpp.

{
  NS_ENSURE_ARG_POINTER(pListRow);
  if (!m_mdbStore || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsresult err = NS_OK;

  PRUint32 totalAddress = GetListAddressTotal(pListRow);

  PRUint32 pos;
  for (pos = 1; pos <= totalAddress; pos++)
  {
    mdb_token listAddressColumnToken;
    mdb_id rowID;

    char columnStr[COLUMN_STR_MAX];
    PR_snprintf(columnStr, COLUMN_STR_MAX, kMailListAddressFormat, pos);
    m_mdbStore->StringToToken(m_mdbEnv, columnStr, &listAddressColumnToken);

    err = GetIntColumn(pListRow, listAddressColumnToken, (PRUint32*)&rowID, 0);

    if (cardRowID == rowID)
    {
      if (pos == totalAddress)
        err = pListRow->CutColumn(m_mdbEnv, listAddressColumnToken);
      else
      {
        //replace the deleted one with the last one and delete the last one
        mdb_id lastRowID;
        mdb_token lastAddressColumnToken;
        PR_snprintf(columnStr, COLUMN_STR_MAX, kMailListAddressFormat, totalAddress);
        m_mdbStore->StringToToken(m_mdbEnv, columnStr, &lastAddressColumnToken);

        err = GetIntColumn(pListRow, lastAddressColumnToken, (PRUint32*)&lastRowID, 0);
        NS_ENSURE_SUCCESS(err, err);

        err = AddIntColumn(pListRow, listAddressColumnToken, lastRowID);
        NS_ENSURE_SUCCESS(err, err);

        err = pListRow->CutColumn(m_mdbEnv, lastAddressColumnToken);
        NS_ENSURE_SUCCESS(err, err);
      }

      // Reset total count after the card has been deleted.
      SetListAddressTotal(pListRow, totalAddress-1);
      break;
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2067 of file nsAddrDatabase.cpp.

{
  if (!card || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsresult err = NS_OK;

  // get the right row
  nsIMdbRow* pListRow = nsnull;
  mdbOid listRowOid;
  listRowOid.mOid_Scope = m_ListRowScopeToken;

  nsCOMPtr<nsIAbMDBDirectory> dbmailList(do_QueryInterface(mailList,&err));
  NS_ENSURE_SUCCESS(err, err);

  dbmailList->GetDbRowID((PRUint32*)&listRowOid.mOid_Id);

  err = m_mdbStore->GetRow(m_mdbEnv, &listRowOid, &pListRow);
  NS_ENSURE_SUCCESS(err,err);
  if (!pListRow)
    return NS_OK;

  PRUint32 cardRowID;
    
  nsCOMPtr<nsIAbMDBCard> dbcard(do_QueryInterface(card, &err));
  if(NS_FAILED(err) || !dbcard)
    return NS_ERROR_NULL_POINTER;
  dbcard->GetDbRowID(&cardRowID);
    
  err = DeleteCardFromListRow(pListRow, cardRowID);
  if (NS_SUCCEEDED(err) && aNotify) {            
    NotifyCardEntryChange(AB_NotifyDeleted, card);
  }
  NS_RELEASE(pListRow);
  return NS_OK;
}

Here is the call graph for this function:

void nsIAddrDatabase::deleteCardFromMailList ( in nsIAbDirectory  mailList,
in nsIAbCard  card,
in boolean  aNotify 
) [inherited]

Definition at line 2345 of file nsAddrDatabase.cpp.

{
  if (!mailList || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsresult err = NS_OK;

  // get the row
  nsIMdbRow* pListRow = nsnull;
  mdbOid rowOid;
  rowOid.mOid_Scope = m_ListRowScopeToken;

  nsCOMPtr<nsIAbMDBDirectory> dbmailList(do_QueryInterface(mailList,&err));
  NS_ENSURE_SUCCESS(err, err);
  dbmailList->GetDbRowID((PRUint32*)&rowOid.mOid_Id);

  err = m_mdbStore->GetRow(m_mdbEnv, &rowOid, &pListRow);
  NS_ENSURE_SUCCESS(err,err);

  if (!pListRow)
    return NS_OK;

  err = DeleteRow(m_mdbPabTable, pListRow);
  NS_RELEASE(pListRow);
  return err;
}

Here is the call graph for this function:

void nsIAddrDatabase::deleteMailList ( in nsIAbDirectory  mailList,
in boolean  aNotify 
) [inherited]
nsresult nsAddrDatabase::DeleteRow ( nsIMdbTable dbTable,
nsIMdbRow dbRow 
) [protected]

Definition at line 3915 of file nsAddrDatabase.cpp.

{
  if (!m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  mdb_err err = dbRow->CutAllColumns(m_mdbEnv);
  err = dbTable->CutRow(m_mdbEnv, dbRow);

  return (err == NS_OK) ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1011 of file nsAddrDatabase.cpp.

{
  if (!m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  mdb_err merror = NS_OK;
  if (m_mdbDeletedCardsTable) {
    pCardRow->CutAllColumns(m_mdbEnv);
    merror = m_mdbDeletedCardsTable->CutRow(m_mdbEnv, pCardRow);
  }
  return merror;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAddrDatabase::DisplayAlert ( const PRUnichar titleName,
const PRUnichar alertStringName,
const PRUnichar **  formatStrings,
PRInt32  numFormatStrings 
) [private]

Definition at line 664 of file nsAddrDatabase.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsIStringBundle> bundle;
  rv = bundleService->CreateBundle("chrome://messenger/locale/addressbook/addressBook.properties", getter_AddRefs(bundle));
  NS_ENSURE_SUCCESS(rv, rv);
  
  nsXPIDLString alertMessage;
  rv = bundle->FormatStringFromName(alertStringName, formatStrings, numFormatStrings,
    getter_Copies(alertMessage));
  NS_ENSURE_SUCCESS(rv, rv);

  nsXPIDLString alertTitle;
  rv = bundle->GetStringFromName(titleName, getter_Copies(alertTitle));
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsIPromptService> prompter =
      do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  return prompter->Alert(nsnull /* we don't know the parent window */, alertTitle.get(), alertMessage.get());
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2280 of file nsAddrDatabase.cpp.

{
  // XXX make sure this isn't getting called when we're just editing one or two well known fields
  if (!card || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;
  
  nsresult err = NS_OK;
  
  nsCOMPtr <nsIMdbRow> cardRow;
  mdbOid rowOid;
  rowOid.mOid_Scope = m_CardRowScopeToken;
  
  PRUint32 nowInSeconds;
  PRTime now = PR_Now();
  PRTime2Seconds(now, &nowInSeconds);
  card->SetLastModifiedDate(nowInSeconds);
  nsCOMPtr<nsIAbMDBCard> dbcard(do_QueryInterface(card, &err));
  NS_ENSURE_SUCCESS(err, err);
  dbcard->GetDbRowID((PRUint32*)&rowOid.mOid_Id);
  
  err = m_mdbStore->GetRow(m_mdbEnv, &rowOid, getter_AddRefs(cardRow));
  NS_ENSURE_SUCCESS(err, err);
  
  if (!cardRow)
    return NS_OK;
  
  err = AddAttributeColumnsToRow(card, cardRow);
  NS_ENSURE_SUCCESS(err, err);
  
  if (notify) 
    NotifyCardEntryChange(AB_NotifyPropertyChanged, card);
  
  return NS_OK;
}

Here is the call graph for this function:

void nsIAddrDatabase::editCard ( in nsIAbCard  card,
in boolean  aNotify 
) [inherited]
NS_IMETHODIMP nsAddrDatabase::EditMailList ( nsIAbDirectory mailList,
nsIAbCard listCard,
PRBool  notify 
)

Definition at line 2372 of file nsAddrDatabase.cpp.

{
  if (!mailList || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsresult err = NS_OK;

  nsIMdbRow* pListRow = nsnull;
  mdbOid rowOid;
  rowOid.mOid_Scope = m_ListRowScopeToken;

  nsCOMPtr<nsIAbMDBDirectory> dbmailList(do_QueryInterface(mailList,&err));
  NS_ENSURE_SUCCESS(err, err);
  dbmailList->GetDbRowID((PRUint32*)&rowOid.mOid_Id);

  err = m_mdbStore->GetRow(m_mdbEnv, &rowOid, &pListRow);
  NS_ENSURE_SUCCESS(err, err);

  if (!pListRow)
    return NS_OK;

  err = AddListAttributeColumnsToRow(mailList, pListRow);
  NS_ENSURE_SUCCESS(err, err);

  if (notify)
  {
    NotifyListEntryChange(AB_NotifyPropertyChanged, mailList);

    if (listCard)
    {
      NotifyCardEntryChange(AB_NotifyPropertyChanged, listCard);
    }
  }

  NS_RELEASE(pListRow);
  return NS_OK;
}

Here is the call graph for this function:

void nsIAddrDatabase::editMailList ( in nsIAbDirectory  mailList,
in nsIAbCard  listCard,
in boolean  aNotify 
) [inherited]

Definition at line 3382 of file nsAddrDatabase.cpp.

{
    nsAddrDBEnumerator* e = new nsAddrDBEnumerator(this);
    m_dbDirectory = directory;
    if (!e)
        return NS_ERROR_OUT_OF_MEMORY;
    NS_ADDREF(e);
    *result = e;
    return NS_OK;
}

Here is the call graph for this function:

Definition at line 3435 of file nsAddrDatabase.cpp.

{
    nsresult rv = NS_OK; 
    mdb_id rowID;

    nsCOMPtr<nsIAbMDBDirectory> dbdirectory(do_QueryInterface(directory,&rv));
    
    if(NS_SUCCEEDED(rv))
    {
    dbdirectory->GetDbRowID((PRUint32*)&rowID);

    nsListAddressEnumerator* e = new nsListAddressEnumerator(this, rowID);
    m_dbDirectory = directory;
    if (!e)
        return NS_ERROR_OUT_OF_MEMORY;
    NS_ADDREF(e);
    *result = e;
    }
    return rv;
}

Here is the call graph for this function:

Definition at line 389 of file nsAddrDatabase.cpp.

{
    PRInt32 i;
    for (i = 0; i < GetDBCache()->Count(); i++)
    {
        nsAddrDatabase* pAddrDB = NS_STATIC_CAST(nsAddrDatabase*, GetDBCache()->ElementAt(i));
        if (pAddrDB->MatchDbName(dbName))
        {
            NS_ADDREF(pAddrDB);
            return pAddrDB;
        }
    }
    return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsAddrDatabase::FindInCache ( nsAddrDatabase pAddrDB) [static, protected]

Definition at line 407 of file nsAddrDatabase.cpp.

{
    PRInt32 i;
    for (i = 0; i < GetDBCache()->Count(); i++)
    {
        if (GetDBCache()->ElementAt(i) == pAddrDB)
        {
            return(i);
        }
    }
    return(-1);
}

Here is the call graph for this function:

PRBool nsIAddrDatabase::findMailListbyUnicodeName ( in wstring  listName) [inherited]

Definition at line 3776 of file nsAddrDatabase.cpp.

{
  nsAutoString unicodeString(listName);
  ToLowerCase(unicodeString);
  
  nsCOMPtr <nsIMdbRow> listRow;
  nsresult rv = GetRowForCharColumn(unicodeString.get(), m_LowerListNameColumnToken, PR_FALSE, getter_AddRefs(listRow));
  *exist = (NS_SUCCEEDED(rv) && listRow);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1885 of file nsAddrDatabase.cpp.

{
    nsXPIDLString primaryEmail;
    aCard->GetPrimaryEmail(getter_Copies(primaryEmail));
    return GetRowForCharColumn(primaryEmail, m_PriEmailColumnToken, PR_TRUE, aRow);
}

Here is the call graph for this function:

Definition at line 865 of file nsAddrDatabase.cpp.

{
    nsresult    err = NS_OK;
    nsCOMPtr<nsIAddrDatabase> aDb(do_QueryInterface(this, &err));

    // make sure someone has a reference so object won't get deleted out from under us.
    AddRef();    
    NotifyAnnouncerGoingAway();
    // OK, remove from cache first and close the store.
    RemoveFromCache(this);

    err = CloseMDB(PR_FALSE);    // since we're about to delete it, no need to commit.
    NS_IF_RELEASE(m_mdbStore);
    Release();
    return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1892 of file nsAddrDatabase.cpp.

{
  if (!m_mdbStore || !listRow || !cardRow || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  mdb_token listAddressColumnToken;

  char columnStr[COLUMN_STR_MAX];
  PR_snprintf(columnStr, COLUMN_STR_MAX, kMailListAddressFormat, pos);
  m_mdbStore->StringToToken(m_mdbEnv, columnStr, &listAddressColumnToken);

  nsAutoString tempString;
  mdb_id rowID;
  nsresult err = GetIntColumn(listRow, listAddressColumnToken, (PRUint32*)&rowID, 0);
  NS_ENSURE_SUCCESS(err, err);

  return GetCardRowByRowID(rowID, cardRow);
}

Here is the call graph for this function:

nsresult nsAddrDatabase::GetBoolColumn ( nsIMdbRow cardRow,
mdb_token  outToken,
PRBool pValue 
) [protected]

Definition at line 2661 of file nsAddrDatabase.cpp.

{
  NS_ENSURE_ARG_POINTER(pValue);

    nsresult    err = NS_ERROR_NULL_POINTER;
    nsIMdbCell    *cardCell;
    PRUint32 nValue = 0;

    if (cardRow && m_mdbEnv)
    {
        err = cardRow->GetCell(m_mdbEnv, outToken, &cardCell);
        if (err == NS_OK && cardCell)
        {
            struct mdbYarn yarn;
            cardCell->AliasYarn(m_mdbEnv, &yarn);
            YarnToUInt32(&yarn, &nValue);
            cardCell->Release();
        }
        else
            err = NS_ERROR_FAILURE;
    }

    *pValue = nValue ? PR_TRUE : PR_FALSE;
    return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3787 of file nsAddrDatabase.cpp.

{    
    mdb_err rv;
    mdb_count c;
    rv = m_mdbPabTable->GetCount(m_mdbEnv, &c);
    if (rv == NS_OK)
        *count = c - 1;  // Don't count LastRecordKey 

    return rv;
}

Here is the call graph for this function:

NS_IMETHODIMP nsAddrDatabase::GetCardFromAttribute ( nsIAbDirectory directory,
const char *  aName,
const char *  aValue,
PRBool  aCaseInsensitive,
nsIAbCard **  card 
)

Definition at line 3692 of file nsAddrDatabase.cpp.

{
  NS_ENSURE_ARG_POINTER(aCardResult);
  
  m_dbDirectory = aDirectory;
  nsCOMPtr <nsIMdbRow> cardRow;
  nsresult rv = GetRowFromAttribute(aName, aUTF8Value, aCaseInsensitive, getter_AddRefs(cardRow));
  if (NS_SUCCEEDED(rv) && cardRow)
    rv = CreateABCard(cardRow, 0, aCardResult);
  else 
  {
    *aCardResult = nsnull;
    rv = NS_OK;
  }
  return rv;
}

Here is the call graph for this function:

nsIAbCard nsIAddrDatabase::getCardFromAttribute ( in nsIAbDirectory  directory,
in string  aName,
in string  aUTF8Value,
in boolean  caseInsensitive 
) [inherited]

aUTF8Value needs to be in UTF-8

Definition at line 3649 of file nsAddrDatabase.cpp.

{
  if (!m_mdbStore || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  mdbOid rowOid;
  rowOid.mOid_Scope = m_CardRowScopeToken;
  rowOid.mOid_Id = rowID;

  return m_mdbStore->GetRow(m_mdbEnv, &rowOid, dbRow);
}

Here is the call graph for this function:

Here is the caller graph for this function:

wstring nsIAddrDatabase::getCardValue ( in nsIAbCard  card,
in string  name 
) [inherited]
NS_IMETHODIMP nsAddrDatabase::GetCardValue ( nsIAbCard card,
const char *  name,
PRUnichar **  value 
)

Definition at line 2138 of file nsAddrDatabase.cpp.

{
  if (!m_mdbStore || !card || !name || !value || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsresult rv = NS_OK;
  
  nsCOMPtr <nsIMdbRow> cardRow;
  mdbOid rowOid;
  rowOid.mOid_Scope = m_CardRowScopeToken;
  
  // XXX todo
  // it might be that the caller always has a nsIAbMDBCard
  nsCOMPtr<nsIAbMDBCard> dbcard = do_QueryInterface(card, &rv);
  NS_ENSURE_SUCCESS(rv, rv);
  dbcard->GetDbRowID((PRUint32*)&rowOid.mOid_Id);
  
  rv = m_mdbStore->GetRow(m_mdbEnv, &rowOid, getter_AddRefs(cardRow));
  NS_ENSURE_SUCCESS(rv, rv);
  
  if (!cardRow) {
    *value = nsnull;
    // this can happen when adding cards when editing a mailing list
    return NS_OK;
  }
  
  mdb_token token;
  m_mdbStore->StringToToken(m_mdbEnv, name, &token);
  
  // XXX fix me
  // avoid extra copying and allocations (did dmb already do this on the trunk?)
  nsAutoString tempString;
  rv = GetStringColumn(cardRow, token, tempString);
  if (NS_FAILED(rv)) {
    // not all cards are going this column
    *value = nsnull;
    return NS_OK;
  }
  
  *value = nsCRT::strdup(tempString.get());
  if (!*value) 
    return NS_ERROR_OUT_OF_MEMORY;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsAddrDatabase::GetCharStringYarn ( char *  str,
struct mdbYarn strYarn 
) [protected]

Definition at line 2502 of file nsAddrDatabase.cpp.

{
    strYarn->mYarn_Grow = nsnull;
    strYarn->mYarn_Buf = str;
    strYarn->mYarn_Size = PL_strlen((const char *) strYarn->mYarn_Buf) + 1;
    strYarn->mYarn_Fill = strYarn->mYarn_Size - 1;
    strYarn->mYarn_Form = 0;
}

Here is the caller graph for this function:

nsresult nsAddrDatabase::GetDataRow ( nsIMdbRow **  pDataRow) [protected]

Definition at line 1082 of file nsAddrDatabase.cpp.

{
  if (!m_mdbStore || !m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsIMdbRow *pRow = nsnull;
  mdbOid dataRowOid;
  dataRowOid.mOid_Scope = m_DataRowScopeToken;
  dataRowOid.mOid_Id = DATAROW_ROWID;
  m_mdbStore->GetRow(m_mdbEnv, &dataRowOid, &pRow);
  *pDataRow = pRow;

  return pRow ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsVoidArray * nsAddrDatabase::GetDBCache ( ) [static, protected]

Definition at line 354 of file nsAddrDatabase.cpp.

{
    if (!m_dbCache)
        m_dbCache = new nsVoidArray();

    return m_dbCache;
    
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 528 of file nsAddrDatabase.cpp.

{
    if (!aDbPath)
        return NS_ERROR_NULL_POINTER;

    nsFileSpec* pFilePath = new nsFileSpec();
    if (!pFilePath)
        return NS_ERROR_OUT_OF_MEMORY;
    *pFilePath = m_dbName;
    *aDbPath = pFilePath;
    return NS_OK;
}

Here is the call graph for this function:

Definition at line 2229 of file nsAddrDatabase.cpp.

{
    // initialize count first
    *aCount = 0;
    InitDeletedCardsTable(PR_FALSE);
    if (m_mdbDeletedCardsTable)
      return m_mdbDeletedCardsTable->GetCount(m_mdbEnv, aCount);
    return NS_OK;
}

Here is the call graph for this function:

void nsIAddrDatabase::getDeletedCardCount ( out unsigned long  count) [inherited]

Definition at line 2183 of file nsAddrDatabase.cpp.

{
  if (!m_mdbEnv)
    return NS_ERROR_NULL_POINTER;

  nsCOMPtr<nsISupportsArray> resultCardArray;
  nsresult rv = NS_NewISupportsArray(getter_AddRefs(resultCardArray));
  if (NS_FAILED(rv)) return rv;
  *aCount = 0;
  // make sure the member is set properly
  InitDeletedCardsTable(PR_FALSE);
  if (m_mdbDeletedCardsTable)
  {
    nsCOMPtr<nsIMdbTableRowCursor>      rowCursor;
    mdb_pos                             rowPos;
    PRBool                              done = PR_FALSE;
    nsCOMPtr<nsIMdbRow>                 currentRow;

    m_mdbDeletedCardsTable->GetTableRowCursor(m_mdbEnv, -1, getter_AddRefs(rowCursor));
    if (!rowCursor)
        return NS_ERROR_FAILURE;
    while (!done)
    {
      nsresult rv = rowCursor->NextRow(m_mdbEnv, getter_AddRefs(currentRow), &rowPos);
      if (currentRow && NS_SUCCEEDED(rv))
      {
        mdbOid rowOid;
        if (currentRow->GetOid(m_mdbEnv, &rowOid) == NS_OK)
        {
          nsCOMPtr<nsIAbCard>    card;
          rv = CreateCardFromDeletedCardsTable(currentRow, 0, getter_AddRefs(card));
          if (NS_SUCCEEDED(rv)) {
            (*aCount) += 1;
            resultCardArray->AppendElement(card);
          }
        }
      }
      else
          done = PR_TRUE;
    }
    if (*aCount > 0)
      NS_IF_ADDREF(*aDeletedList = resultCardArray);
  }
  return NS_OK;
}

Here is the call graph for this function:

void nsIAddrDatabase::getDeletedCardList ( out unsigned long  aCount,
out nsISupportsArray  aDeletedList 
) [inherited]

Definition at line 3726 of file nsAddrDatabase.cpp.

{
    if (m_dbDirectory && name)
    {
        return m_dbDirectory->GetDirName(name);
    }
    else
        return NS_ERROR_FAILURE;
}

Definition at line 305 of file nsAddrDatabase.h.

{return m_mdbEnv;}

Here is the caller graph for this function: