DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 1998
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Seth Spitzer <sspitzer@netscape.com>
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either of the GNU General Public License Version 2 or later (the "GPL"),
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

/* nsFileSpec is declared in nsIAbDirectory.idl */
#include "nsIAddrDBAnnouncer.idl"
#include "nsIAbCard.idl"
#include "nsIAbDirectory.idl"

interface nsIFile;
interface nsIMdbTableRowCursor;
interface nsIMdbEnv;
interface nsIMdbRow;

%{C++
// this is the prefix we for attributes that are specific
// to the mozilla addressbook, and weren't in 4.x and aren't specified in
// RFC 2789.  used when exporting and import LDIF
// see nsTextAddress.cpp, nsAddressBook.cpp
#define MOZ_AB_LDIF_PREFIX "mozilla"

// note, GeneratedName is not a real column
// if you change any of this, make sure to change 
// Get / Set CardValue in nsAbCardProperty.cpp
#define kFirstNameColumn          "FirstName"
#define kLastNameColumn           "LastName"
#define kPhoneticFirstNameColumn  "PhoneticFirstName"
#define kPhoneticLastNameColumn   "PhoneticLastName"
#define kPhoneticNameColumn       "_PhoneticName"
#define kDisplayNameColumn        "DisplayName"
#define kNicknameColumn           "NickName"
#define kPriEmailColumn           "PrimaryEmail"
#define k2ndEmailColumn           "SecondEmail"
#define kDefaultEmailColumn       "DefaultEmail"
#define kCardTypeColumn           "CardType"
#define kPreferMailFormatColumn   "PreferMailFormat"
#define kPopularityIndexColumn    "PopularityIndex"
#define kAllowRemoteContentColumn "AllowRemoteContent"
#define kWorkPhoneColumn          "WorkPhone"
#define kHomePhoneColumn          "HomePhone"
#define kFaxColumn                "FaxNumber"
#define kPagerColumn              "PagerNumber"
#define kCellularColumn           "CellularNumber"
#define kWorkPhoneTypeColumn      "WorkPhoneType"
#define kHomePhoneTypeColumn      "HomePhoneType"
#define kFaxTypeColumn            "FaxNumberType"
#define kPagerTypeColumn          "PagerNumberType"
#define kCellularTypeColumn       "CellularNumberType"
#define kHomeAddressColumn        "HomeAddress"
#define kHomeAddress2Column       "HomeAddress2"
#define kHomeCityColumn           "HomeCity"
#define kHomeStateColumn          "HomeState"
#define kHomeZipCodeColumn        "HomeZipCode"
#define kHomeCountryColumn        "HomeCountry"
#define kWorkAddressColumn        "WorkAddress"
#define kWorkAddress2Column       "WorkAddress2"
#define kWorkCityColumn           "WorkCity"
#define kWorkStateColumn          "WorkState"
#define kWorkZipCodeColumn        "WorkZipCode"
#define kWorkCountryColumn        "WorkCountry"
#define kJobTitleColumn           "JobTitle"
#define kDepartmentColumn         "Department"
#define kCompanyColumn            "Company"
#define kAimScreenNameColumn      "_AimScreenName"
#define kAnniversaryYearColumn    "AnniversaryYear"
#define kAnniversaryMonthColumn   "AnniversaryMonth"
#define kAnniversaryDayColumn     "AnniversaryDay"
#define kSpouseNameColumn         "SpouseName"
#define kFamilyNameColumn         "FamilyName"
#define kDefaultAddressColumn     "DefaultAddress"
#define kCategoryColumn           "Category"
// webPage1 is work web page
#define kWebPage1Column           "WebPage1"
// webPage2 is home web page
#define kWebPage2Column           "WebPage2"
#define kBirthYearColumn          "BirthYear"
#define kBirthMonthColumn         "BirthMonth"
#define kBirthDayColumn           "BirthDay"
#define kCustom1Column            "Custom1"
#define kCustom2Column            "Custom2"
#define kCustom3Column            "Custom3"
#define kCustom4Column            "Custom4"
#define kNotesColumn              "Notes"
#define kLastModifiedDateColumn   "LastModifiedDate"
#define kAddressCharSetColumn     "AddrCharSet"
#define kMailListName             "ListName"
#define kMailListNickName         "ListNickName"
#define kMailListDescription      "ListDescription"
#define kMailListTotalAddresses   "ListTotalAddresses"
// not shown in the UI
#define kLowerPriEmailColumn      "LowercasePrimaryEmail"

// Palm Integration
#define  CARD_ATTRIB_PALMID "PalmRecId"
#define  CARD_ATTRIB_DISPLAY "DisplayName"

%}

[scriptable, uuid(ca536e0e-1dd1-11b2-951a-e02b86e4f60e)]
interface nsAddrDBCommitType 
{
  const long kSmallCommit = 0;
  const long kLargeCommit = 1;
  const long kSessionCommit = 2;
  const long kCompressCommit = 3;
};

[scriptable, uuid(E59ABE11-1E97-46ec-A1C4-500971BBC4B4)]
interface nsIAddrDatabase : nsIAddrDBAnnouncer {

	[noscript] attribute nsFileSpec dbPath;
	nsIAddrDatabase open(in nsIFile dbFile, in boolean create, in boolean upgrading);
             
	void close(in boolean forceCommit);
	[noscript] 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);
	readonly attribute wstring directoryName;

    /**
	 * aUTF8Value needs to be in UTF-8
	 */
	nsIAbCard getCardFromAttribute(in nsIAbDirectory directory, in string aName, in string aUTF8Value, in boolean caseInsensitive);

	PRBool findMailListbyUnicodeName(in wstring listName);

	void getCardCount(out PRUint32 count);

	[noscript] readonly attribute nsIMdbRow newRow;
	[noscript] readonly attribute nsIMdbRow newListRow;
	[noscript] void addCardRowToDB(in nsIMdbRow newRow);
	[noscript] void addLdifListMember(in nsIMdbRow row, in string value);
	[noscript] void addFirstName(in nsIMdbRow row, in string value);
	[noscript] void addLastName(in nsIMdbRow row, in string value);
	[noscript] void addPhoneticFirstName(in nsIMdbRow row, in string value);
	[noscript] void addPhoneticLastName(in nsIMdbRow row, in string value);
	[noscript] void addDisplayName(in nsIMdbRow row, in string value);
	[noscript] void addNickName(in nsIMdbRow row, in string value);
	[noscript] void addPrimaryEmail(in nsIMdbRow row, in string value);
	[noscript] void add2ndEmail(in nsIMdbRow row, in string value);
  [noscript] void addDefaultEmail(in nsIMdbRow row, in string value);
  [noscript] void addCardType(in nsIMdbRow row, in string value);
	[noscript] void addWorkPhone(in nsIMdbRow row, in string value);
	[noscript] void addHomePhone(in nsIMdbRow row, in string value);
	[noscript] void addFaxNumber(in nsIMdbRow row, in string value);
	[noscript] void addPagerNumber(in nsIMdbRow row, in string value);
	[noscript] void addCellularNumber(in nsIMdbRow row, in string value);
  [noscript] void addWorkPhoneType(in nsIMdbRow row, in string value);
  [noscript] void addHomePhoneType(in nsIMdbRow row, in string value);
  [noscript] void addFaxNumberType(in nsIMdbRow row, in string value);
  [noscript] void addPagerNumberType(in nsIMdbRow row, in string value);
  [noscript] void addCellularNumberType(in nsIMdbRow row, in string value);
	[noscript] void addHomeAddress(in nsIMdbRow row, in string value);
	[noscript] void addHomeAddress2(in nsIMdbRow row, in string value);
	[noscript] void addHomeCity(in nsIMdbRow row, in string value);
	[noscript] void addHomeState(in nsIMdbRow row, in string value);
	[noscript] void addHomeZipCode(in nsIMdbRow row, in string value);
	[noscript] void addHomeCountry(in nsIMdbRow row, in string value);
	[noscript] void addWorkAddress(in nsIMdbRow row, in string value);
	[noscript] void addWorkAddress2(in nsIMdbRow row, in string value);
	[noscript] void addWorkCity(in nsIMdbRow row, in string value);
	[noscript] void addWorkState(in nsIMdbRow row, in string value);
	[noscript] void addWorkZipCode(in nsIMdbRow row, in string value);
	[noscript] void addWorkCountry(in nsIMdbRow row, in string value);
	[noscript] void addJobTitle(in nsIMdbRow row, in string value);
	[noscript] void addDepartment(in nsIMdbRow row, in string value);
	[noscript] void addCompany(in nsIMdbRow row, in string value);
  [noscript] void addAimScreenName(in nsIMdbRow row, in string value);
  [noscript] void addAnniversaryYear(in nsIMdbRow row, in string value);
  [noscript] void addAnniversaryMonth(in nsIMdbRow row, in string value);
  [noscript] void addAnniversaryDay(in nsIMdbRow row, in string value);
  [noscript] void addSpouseName(in nsIMdbRow row, in string value);
  [noscript] void addFamilyName(in nsIMdbRow row, in string value);
  [noscript] void addDefaultAddress(in nsIMdbRow row, in string value);
  [noscript] void addCategory(in nsIMdbRow row, in string value);
	[noscript] void addWebPage1(in nsIMdbRow row, in string value);
	[noscript] void addWebPage2(in nsIMdbRow row, in string value);
	[noscript] void addBirthYear(in nsIMdbRow row, in string value);
	[noscript] void addBirthMonth(in nsIMdbRow row, in string value);
	[noscript] void addBirthDay(in nsIMdbRow row, in string value);
	[noscript] void addCustom1(in nsIMdbRow row, in string value);
	[noscript] void addCustom2(in nsIMdbRow row, in string value);
	[noscript] void addCustom3(in nsIMdbRow row, in string value);
	[noscript] void addCustom4(in nsIMdbRow row, in string value);
	[noscript] void addNotes(in nsIMdbRow row, in string value);
	[noscript] void addPreferMailFormat(in nsIMdbRow row, in unsigned long value);
	[noscript] void addPopularityIndex(in nsIMdbRow row, in unsigned long value);
  [noscript] void addAllowRemoteContent(in nsIMdbRow row, in boolean value);

	[noscript] void addListName(in nsIMdbRow row, in string value);
	[noscript] void addListNickName(in nsIMdbRow row, in string value);
	[noscript] void addListDescription(in nsIMdbRow row, in string value);
	[noscript] void addListDirNode(in nsIMdbRow listRow);

    /**
     * use for getting and setting generic string attributes
     * like _AimScreenName
     */
    void setCardValue(in nsIAbCard card, in string name, in wstring value, in boolean notify);
    wstring getCardValue(in nsIAbCard card, in string name);

    void getDeletedCardList(out unsigned long aCount, out nsISupportsArray aDeletedList); 
    void getDeletedCardCount(out unsigned long count); 

    /**
     * used for adding a string attributes to a row.
     * used during LDIF and addressbook import.
     *
     * @param aRow
     *        The row we're adding the column to
     * @param aLDIFAttributeName
     *        The column name  (examples: mozillaCategory, 
     *                                    mozilla_AimScreenName)
     * @param aColValue
     *        The column value (example: jabroni316)
     */
    [noscript] void addRowValue(in nsIMdbRow aRow, in ACString aLDIFAttributeName, in AString aColValue);

    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);

};