Back to index

lightning-sunbird  0.9+nobinonly
nsIAddrDatabase.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Seth Spitzer <sspitzer@netscape.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 /* nsFileSpec is declared in nsIAbDirectory.idl */
00040 #include "nsIAddrDBAnnouncer.idl"
00041 #include "nsIAbCard.idl"
00042 #include "nsIAbDirectory.idl"
00043 
00044 interface nsIFile;
00045 interface nsIMdbTableRowCursor;
00046 interface nsIMdbEnv;
00047 interface nsIMdbRow;
00048 
00049 %{C++
00050 // this is the prefix we for attributes that are specific
00051 // to the mozilla addressbook, and weren't in 4.x and aren't specified in
00052 // RFC 2789.  used when exporting and import LDIF
00053 // see nsTextAddress.cpp, nsAddressBook.cpp
00054 #define MOZ_AB_LDIF_PREFIX "mozilla"
00055 
00056 // note, GeneratedName is not a real column
00057 // if you change any of this, make sure to change 
00058 // Get / Set CardValue in nsAbCardProperty.cpp
00059 #define kFirstNameColumn          "FirstName"
00060 #define kLastNameColumn           "LastName"
00061 #define kPhoneticFirstNameColumn  "PhoneticFirstName"
00062 #define kPhoneticLastNameColumn   "PhoneticLastName"
00063 #define kPhoneticNameColumn       "_PhoneticName"
00064 #define kDisplayNameColumn        "DisplayName"
00065 #define kNicknameColumn           "NickName"
00066 #define kPriEmailColumn           "PrimaryEmail"
00067 #define k2ndEmailColumn           "SecondEmail"
00068 #define kDefaultEmailColumn       "DefaultEmail"
00069 #define kCardTypeColumn           "CardType"
00070 #define kPreferMailFormatColumn   "PreferMailFormat"
00071 #define kPopularityIndexColumn    "PopularityIndex"
00072 #define kAllowRemoteContentColumn "AllowRemoteContent"
00073 #define kWorkPhoneColumn          "WorkPhone"
00074 #define kHomePhoneColumn          "HomePhone"
00075 #define kFaxColumn                "FaxNumber"
00076 #define kPagerColumn              "PagerNumber"
00077 #define kCellularColumn           "CellularNumber"
00078 #define kWorkPhoneTypeColumn      "WorkPhoneType"
00079 #define kHomePhoneTypeColumn      "HomePhoneType"
00080 #define kFaxTypeColumn            "FaxNumberType"
00081 #define kPagerTypeColumn          "PagerNumberType"
00082 #define kCellularTypeColumn       "CellularNumberType"
00083 #define kHomeAddressColumn        "HomeAddress"
00084 #define kHomeAddress2Column       "HomeAddress2"
00085 #define kHomeCityColumn           "HomeCity"
00086 #define kHomeStateColumn          "HomeState"
00087 #define kHomeZipCodeColumn        "HomeZipCode"
00088 #define kHomeCountryColumn        "HomeCountry"
00089 #define kWorkAddressColumn        "WorkAddress"
00090 #define kWorkAddress2Column       "WorkAddress2"
00091 #define kWorkCityColumn           "WorkCity"
00092 #define kWorkStateColumn          "WorkState"
00093 #define kWorkZipCodeColumn        "WorkZipCode"
00094 #define kWorkCountryColumn        "WorkCountry"
00095 #define kJobTitleColumn           "JobTitle"
00096 #define kDepartmentColumn         "Department"
00097 #define kCompanyColumn            "Company"
00098 #define kAimScreenNameColumn      "_AimScreenName"
00099 #define kAnniversaryYearColumn    "AnniversaryYear"
00100 #define kAnniversaryMonthColumn   "AnniversaryMonth"
00101 #define kAnniversaryDayColumn     "AnniversaryDay"
00102 #define kSpouseNameColumn         "SpouseName"
00103 #define kFamilyNameColumn         "FamilyName"
00104 #define kDefaultAddressColumn     "DefaultAddress"
00105 #define kCategoryColumn           "Category"
00106 // webPage1 is work web page
00107 #define kWebPage1Column           "WebPage1"
00108 // webPage2 is home web page
00109 #define kWebPage2Column           "WebPage2"
00110 #define kBirthYearColumn          "BirthYear"
00111 #define kBirthMonthColumn         "BirthMonth"
00112 #define kBirthDayColumn           "BirthDay"
00113 #define kCustom1Column            "Custom1"
00114 #define kCustom2Column            "Custom2"
00115 #define kCustom3Column            "Custom3"
00116 #define kCustom4Column            "Custom4"
00117 #define kNotesColumn              "Notes"
00118 #define kLastModifiedDateColumn   "LastModifiedDate"
00119 #define kAddressCharSetColumn     "AddrCharSet"
00120 #define kMailListName             "ListName"
00121 #define kMailListNickName         "ListNickName"
00122 #define kMailListDescription      "ListDescription"
00123 #define kMailListTotalAddresses   "ListTotalAddresses"
00124 // not shown in the UI
00125 #define kLowerPriEmailColumn      "LowercasePrimaryEmail"
00126 
00127 // Palm Integration
00128 #define  CARD_ATTRIB_PALMID "PalmRecId"
00129 #define  CARD_ATTRIB_DISPLAY "DisplayName"
00130 
00131 %}
00132 
00133 [scriptable, uuid(ca536e0e-1dd1-11b2-951a-e02b86e4f60e)]
00134 interface nsAddrDBCommitType 
00135 {
00136   const long kSmallCommit = 0;
00137   const long kLargeCommit = 1;
00138   const long kSessionCommit = 2;
00139   const long kCompressCommit = 3;
00140 };
00141 
00142 [scriptable, uuid(E59ABE11-1E97-46ec-A1C4-500971BBC4B4)]
00143 interface nsIAddrDatabase : nsIAddrDBAnnouncer {
00144 
00145        [noscript] attribute nsFileSpec dbPath;
00146        nsIAddrDatabase open(in nsIFile dbFile, in boolean create, in boolean upgrading);
00147              
00148        void close(in boolean forceCommit);
00149        [noscript] void openMDB(in nsFileSpec dbName, in boolean create);
00150        void closeMDB(in boolean commit);
00151 
00152        void commit(in unsigned long commitType);
00153        void forceClosed();
00154 
00155        void createNewCardAndAddToDB(in nsIAbCard newCard, in boolean aNotify);
00156        void createNewCardAndAddToDBWithKey(in nsIAbCard newCard, in boolean aNotify, out unsigned long key);    
00157        void createNewListCardAndAddToDB(in nsIAbDirectory list, in unsigned long listRowID, in nsIAbCard newCard, in boolean aNotify);
00158        void createMailListAndAddToDB(in nsIAbDirectory newList, in boolean aNotify);
00159   void createMailListAndAddToDBWithKey(in nsIAbDirectory newList, in boolean aNotify, out PRUint32 key);
00160        nsIEnumerator enumerateCards(in nsIAbDirectory directory);
00161        nsIEnumerator enumerateListAddresses(in nsIAbDirectory directory);
00162        void getMailingListsFromDB(in nsIAbDirectory parentDir);
00163        void deleteCard(in nsIAbCard card, in boolean aNotify);
00164        void editCard(in nsIAbCard card, in boolean aNotify);
00165        boolean containsCard(in nsIAbCard card);
00166        void deleteMailList(in nsIAbDirectory mailList, in boolean aNotify);
00167        void editMailList(in nsIAbDirectory mailList, in nsIAbCard listCard, in boolean aNotify);
00168        boolean containsMailList(in nsIAbDirectory mailList);
00169        void deleteCardFromMailList(in nsIAbDirectory mailList, in nsIAbCard card, in boolean aNotify);
00170        readonly attribute wstring directoryName;
00171 
00175        nsIAbCard getCardFromAttribute(in nsIAbDirectory directory, in string aName, in string aUTF8Value, in boolean caseInsensitive);
00176 
00177        PRBool findMailListbyUnicodeName(in wstring listName);
00178 
00179        void getCardCount(out PRUint32 count);
00180 
00181        [noscript] readonly attribute nsIMdbRow newRow;
00182        [noscript] readonly attribute nsIMdbRow newListRow;
00183        [noscript] void addCardRowToDB(in nsIMdbRow newRow);
00184        [noscript] void addLdifListMember(in nsIMdbRow row, in string value);
00185        [noscript] void addFirstName(in nsIMdbRow row, in string value);
00186        [noscript] void addLastName(in nsIMdbRow row, in string value);
00187        [noscript] void addPhoneticFirstName(in nsIMdbRow row, in string value);
00188        [noscript] void addPhoneticLastName(in nsIMdbRow row, in string value);
00189        [noscript] void addDisplayName(in nsIMdbRow row, in string value);
00190        [noscript] void addNickName(in nsIMdbRow row, in string value);
00191        [noscript] void addPrimaryEmail(in nsIMdbRow row, in string value);
00192        [noscript] void add2ndEmail(in nsIMdbRow row, in string value);
00193   [noscript] void addDefaultEmail(in nsIMdbRow row, in string value);
00194   [noscript] void addCardType(in nsIMdbRow row, in string value);
00195        [noscript] void addWorkPhone(in nsIMdbRow row, in string value);
00196        [noscript] void addHomePhone(in nsIMdbRow row, in string value);
00197        [noscript] void addFaxNumber(in nsIMdbRow row, in string value);
00198        [noscript] void addPagerNumber(in nsIMdbRow row, in string value);
00199        [noscript] void addCellularNumber(in nsIMdbRow row, in string value);
00200   [noscript] void addWorkPhoneType(in nsIMdbRow row, in string value);
00201   [noscript] void addHomePhoneType(in nsIMdbRow row, in string value);
00202   [noscript] void addFaxNumberType(in nsIMdbRow row, in string value);
00203   [noscript] void addPagerNumberType(in nsIMdbRow row, in string value);
00204   [noscript] void addCellularNumberType(in nsIMdbRow row, in string value);
00205        [noscript] void addHomeAddress(in nsIMdbRow row, in string value);
00206        [noscript] void addHomeAddress2(in nsIMdbRow row, in string value);
00207        [noscript] void addHomeCity(in nsIMdbRow row, in string value);
00208        [noscript] void addHomeState(in nsIMdbRow row, in string value);
00209        [noscript] void addHomeZipCode(in nsIMdbRow row, in string value);
00210        [noscript] void addHomeCountry(in nsIMdbRow row, in string value);
00211        [noscript] void addWorkAddress(in nsIMdbRow row, in string value);
00212        [noscript] void addWorkAddress2(in nsIMdbRow row, in string value);
00213        [noscript] void addWorkCity(in nsIMdbRow row, in string value);
00214        [noscript] void addWorkState(in nsIMdbRow row, in string value);
00215        [noscript] void addWorkZipCode(in nsIMdbRow row, in string value);
00216        [noscript] void addWorkCountry(in nsIMdbRow row, in string value);
00217        [noscript] void addJobTitle(in nsIMdbRow row, in string value);
00218        [noscript] void addDepartment(in nsIMdbRow row, in string value);
00219        [noscript] void addCompany(in nsIMdbRow row, in string value);
00220   [noscript] void addAimScreenName(in nsIMdbRow row, in string value);
00221   [noscript] void addAnniversaryYear(in nsIMdbRow row, in string value);
00222   [noscript] void addAnniversaryMonth(in nsIMdbRow row, in string value);
00223   [noscript] void addAnniversaryDay(in nsIMdbRow row, in string value);
00224   [noscript] void addSpouseName(in nsIMdbRow row, in string value);
00225   [noscript] void addFamilyName(in nsIMdbRow row, in string value);
00226   [noscript] void addDefaultAddress(in nsIMdbRow row, in string value);
00227   [noscript] void addCategory(in nsIMdbRow row, in string value);
00228        [noscript] void addWebPage1(in nsIMdbRow row, in string value);
00229        [noscript] void addWebPage2(in nsIMdbRow row, in string value);
00230        [noscript] void addBirthYear(in nsIMdbRow row, in string value);
00231        [noscript] void addBirthMonth(in nsIMdbRow row, in string value);
00232        [noscript] void addBirthDay(in nsIMdbRow row, in string value);
00233        [noscript] void addCustom1(in nsIMdbRow row, in string value);
00234        [noscript] void addCustom2(in nsIMdbRow row, in string value);
00235        [noscript] void addCustom3(in nsIMdbRow row, in string value);
00236        [noscript] void addCustom4(in nsIMdbRow row, in string value);
00237        [noscript] void addNotes(in nsIMdbRow row, in string value);
00238        [noscript] void addPreferMailFormat(in nsIMdbRow row, in unsigned long value);
00239        [noscript] void addPopularityIndex(in nsIMdbRow row, in unsigned long value);
00240   [noscript] void addAllowRemoteContent(in nsIMdbRow row, in boolean value);
00241 
00242        [noscript] void addListName(in nsIMdbRow row, in string value);
00243        [noscript] void addListNickName(in nsIMdbRow row, in string value);
00244        [noscript] void addListDescription(in nsIMdbRow row, in string value);
00245        [noscript] void addListDirNode(in nsIMdbRow listRow);
00246 
00251     void setCardValue(in nsIAbCard card, in string name, in wstring value, in boolean notify);
00252     wstring getCardValue(in nsIAbCard card, in string name);
00253 
00254     void getDeletedCardList(out unsigned long aCount, out nsISupportsArray aDeletedList); 
00255     void getDeletedCardCount(out unsigned long count); 
00256 
00269     [noscript] void addRowValue(in nsIMdbRow aRow, in ACString aLDIFAttributeName, in AString aColValue);
00270 
00271     void AddListCardColumnsToRow(in nsIAbCard aPCard,
00272                                             in nsIMdbRow aPListRow,
00273                                             in unsigned long aPos,
00274                                             out nsIAbCard aPNewCard,
00275                                             in boolean aInMailingList);
00276     void InitCardFromRow(in nsIAbCard aNewCard,in nsIMdbRow aCardRow);
00277     void SetListAddressTotal(in nsIMdbRow aListRow, in PRUint32 aTotal);
00278     nsIMdbRow FindRowByCard(in nsIAbCard aCard);
00279 
00280 };