diff --git a/mail/base/content/editContactOverlay.js b/mail/base/content/editContactOverlay.js index f6836f1b37..7bce69a0cb 100644 --- a/mail/base/content/editContactOverlay.js +++ b/mail/base/content/editContactOverlay.js @@ -117,8 +117,7 @@ var editContactInlineUI = { var bundle = document.getElementById("bundle_editContact"); // Is this address book writeable? - this._writeable = this._cardDetails.book.operations & - Components.interfaces.nsIAbDirectory.opWrite; + this._writeable = !this._cardDetails.book.readOnly; var type = this._writeable ? "edit" : "view"; // Update the labels accordingly. diff --git a/mail/base/content/msgHdrViewOverlay.js b/mail/base/content/msgHdrViewOverlay.js index 3f29ee1249..4d564d13d1 100644 --- a/mail/base/content/msgHdrViewOverlay.js +++ b/mail/base/content/msgHdrViewOverlay.js @@ -1141,8 +1141,7 @@ function setupEmailAddressPopup(emailAddressNode) if (emailAddressNode.cardDetails.card) { document.getElementById('addToAddressBookItem').setAttribute('hidden', true); - if (emailAddressNode.cardDetails.book.operations & - Components.interfaces.nsIAbDirectory.opWrite) { + if (!emailAddressNode.cardDetails.book.readOnly) { document.getElementById('editContactItem').removeAttribute('hidden'); document.getElementById('viewContactItem').setAttribute('hidden', true); } diff --git a/mail/components/addrbook/content/abCardOverlay.js b/mail/components/addrbook/content/abCardOverlay.js index b6598ae6b3..eb7ff0efe2 100644 --- a/mail/components/addrbook/content/abCardOverlay.js +++ b/mail/components/addrbook/content/abCardOverlay.js @@ -120,7 +120,7 @@ function OnLoadNewCard() if (parentURI) gEditCard.selectedAB = parentURI; } - else if (directory.operations & directory.opWrite) + else if (!directory.readOnly) gEditCard.selectedAB = window.arguments[0].selectedAB; } @@ -266,7 +266,7 @@ function OnLoadEditCard() var abURI = window.arguments[0].abURI; var directory = GetDirectoryFromURI(abURI); - if (!(directory.operations & directory.opWrite)) + if (directory.readOnly) { // Set all the editable vcard fields to read only for (var i = kVcardFields.length; i-- > 0; ) diff --git a/mail/components/addrbook/content/abCommon.js b/mail/components/addrbook/content/abCommon.js index 75074e6839..578376db15 100644 --- a/mail/components/addrbook/content/abCommon.js +++ b/mail/components/addrbook/content/abCommon.js @@ -100,8 +100,7 @@ var DirPaneController = // If the directory is a mailing list, and it is read-only, return // false. var abDir = GetDirectoryFromURI(selectedDir); - if (abDir.isMailList && - ~abDir.operations & abDir.opWrite) + if (abDir.isMailList && abDir.readOnly) return false; // If the selected directory is an ldap directory diff --git a/mailnews/addrbook/public/Makefile.in b/mailnews/addrbook/public/Makefile.in index 4842518e77..9409062913 100644 --- a/mailnews/addrbook/public/Makefile.in +++ b/mailnews/addrbook/public/Makefile.in @@ -47,9 +47,10 @@ MODULE = addrbook XPIDLSRCS = \ nsIAbListener.idl \ - nsIAbDirectory.idl \ nsIAbItem.idl \ + nsIAbCollection.idl \ nsIAbCard.idl \ + nsIAbDirectory.idl \ nsIAbMDBDirectory.idl \ nsIAddrDBAnnouncer.idl \ nsIAddrDBListener.idl \ diff --git a/mailnews/addrbook/public/nsIAbCollection.idl b/mailnews/addrbook/public/nsIAbCollection.idl new file mode 100644 index 0000000000..789e11eb47 --- /dev/null +++ b/mailnews/addrbook/public/nsIAbCollection.idl @@ -0,0 +1,108 @@ +/* -*- 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 + * Mozilla Messaging Corporation. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Mark Banner + * Joshua Cranmer + * + * 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 ***** */ + +#include "nsISupports.idl" +#include "nsIAbItem.idl" + +interface nsIAbCard; + +/** + * A collection of address book items. + */ +[scriptable, uuid(e6f97fdb-2e3e-46ad-974d-50f1388953c0)] +interface nsIAbCollection : nsIAbItem { + + /** + * Returns true if this collection is read-only. + */ + readonly attribute boolean readOnly; + + /** + * Returns true if this collection is accessed over a network connection. + */ + readonly attribute boolean isRemote; + + /** + * Returns true if this collection is accessed over a secure connection. + * + * If isRemote returns false, then this value MUST be false as well. + */ + readonly attribute boolean isSecure; + + /** + * Returns an address book card for the specified email address if found. + * + * If there are multiple cards with the given email address, this method will + * return one of these cards in an implementation-defined manner. + * + * This method performs a synchronous operation. If the collection cannot do + * the search in such a manner, then it should throw NS_ERROR_NOT_IMPLEMENTED. + * + * @param emailAddress The email address to find in any of the email address + * fields. If emailAddress is empty, the database won't + * be searched and the function will return as if no card + * was found. + * @return An nsIAbCard if one was found, else returns NULL. + * @exception NS_ERROR_NOT_IMPLEMENTED If the collection cannot do this. + */ + nsIAbCard cardForEmailAddress(in AUTF8String emailAddress); + + /** + * Returns an address book card for the specified property if found. + * + * If there are multiple cards with the given value for the property, this + * method will return one of these cards in an implementation-defined manner. + * + * This method performs a synchronous operation. If the collection cannot do + * the search in such a manner, then it should throw NS_ERROR_NOT_IMPLEMENTED. + * + * If the property is not natively a string, it can still be searched for + * using the string-encoded value of the property, e.g. "0". See + * nsIAbCard::getPropertyAsAUTF8String for more information. Empty values will + * return no match, to prevent spurious results. + * + * @param aProperty The property to look for. + * @param aValue The value to search for. + * @param aCaseSensitive True if matching should be done case-sensitively. + * @result An nsIAbCard if one was found, else returns NULL. + * @exception NS_ERROR_NOT_IMPLEMENTED If the collection cannot do this. + */ + nsIAbCard getCardFromProperty(in string aProperty, in AUTF8String aValue, + in boolean aCaseSensitive); +}; diff --git a/mailnews/addrbook/public/nsIAbDirectory.idl b/mailnews/addrbook/public/nsIAbDirectory.idl index 6389633e3b..60db300b28 100644 --- a/mailnews/addrbook/public/nsIAbDirectory.idl +++ b/mailnews/addrbook/public/nsIAbDirectory.idl @@ -38,7 +38,7 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsISupports.idl" +#include "nsIAbCollection.idl" #include "nsIAbCard.idl" interface nsISimpleEnumerator; @@ -60,8 +60,8 @@ interface nsIMutableArray; #define kABFileName_CurrentSuffix ".mab" /* v3 address book extension */ %} -[scriptable, uuid(1b2637fb-194e-442b-992a-17fe7c068fd4)] -interface nsIAbDirectory : nsISupports { +[scriptable, uuid(5ee48561-aff9-447c-802d-93384d524f53)] +interface nsIAbDirectory : nsIAbCollection { /** * The chrome URI to use for bringing up a dialog to edit this directory. @@ -71,21 +71,6 @@ interface nsIAbDirectory : nsISupports { */ readonly attribute ACString propertiesChromeURI; - // Types of operation - // Perform linear reading of directory card - // content - const long opRead = 0x1; - // Perform modification and deletion on a - // directories content - const long opWrite = 0x2; - // Perform searching on a directory card - // content via the uri format: - // scheme://path?query - const long opSearch = 0x4; - - // The supported operations - readonly attribute long operations; - /** * The description of the directory. If this directory is not a mailing list, * then setting this attribute will send round a "DirName" update via @@ -164,16 +149,6 @@ interface nsIAbDirectory : nsISupports { void dropCard(in nsIAbCard card, in boolean needToCopyCard); - /** - * directory is local (example, mork based) or remote (example, LDAP) - */ - readonly attribute boolean isRemote; - - /** - * directory is secure (as in LDAP over SSL) - */ - readonly attribute boolean isSecure; - /** * Whether or not the directory should be searched when doing autocomplete, * (currently by using GetChildCards); LDAP does not support this in online @@ -308,45 +283,4 @@ interface nsIAbDirectory : nsISupports { void setStringValue(in string aName, in ACString aValue); void setLocalizedStringValue(in string aName, in AUTF8String aValue); //@} - - /** - * Returns an address book card for the specified email address if found. - * - * If there are multiple cards with the given email address, this method will - * return one of these cards in an implementation-defined manner. - * - * If the address book type does not know how to find a card, it will throw - * NS_ERROR_NOT_IMPLEMENTED. Core address book types do throw this exception, - * so beware when calling this method. - * - * @param emailAddress The email address to find in either the primary or - * secondary email address fields. If email address is - * empty, the database won't be searched and the function - * will return as if no card was found. - * @return An nsIAbCard if one was found, else returns NULL. - */ - nsIAbCard cardForEmailAddress(in AUTF8String emailAddress); - - /** - * Returns an address book card for the specified property if found. - * - * If there are multiple cards with the given value for the property, this - * method will return one of these cards in an implementation-defined manner. - * - * If the address book type does not know how to do this, it will throw - * NS_ERROR_NOT_IMPLEMENTED. Core address book types do throw this exception, - * so beware when calling this method. - * - * If the property is not natively a string, it can still be searched for - * using the string-encoded value of the property, e.g. "0". See - * nsIAbCard::getPropertyAsAUTF8String for more information. Empty values will - * return no match, to prevent spurious results. - * - * @param aProperty The property to look for. - * @param aValue The value to search for. - * @param aCaseSensitive True if matching should be done case-senstively. - * @result An nsIAbCard if one was found, else returns NULL. - */ - nsIAbCard getCardFromProperty(in string aProperty, in AUTF8String aValue, - in boolean aCaseSensitive); }; diff --git a/mailnews/addrbook/resources/content/abCardOverlay.js b/mailnews/addrbook/resources/content/abCardOverlay.js index 0cc47c82ed..dfde8c1be7 100644 --- a/mailnews/addrbook/resources/content/abCardOverlay.js +++ b/mailnews/addrbook/resources/content/abCardOverlay.js @@ -120,7 +120,7 @@ function OnLoadNewCard() if (parentURI) gEditCard.selectedAB = parentURI; } - else if (directory.operations & directory.opWrite) + else if (!directory.readOnly) gEditCard.selectedAB = window.arguments[0].selectedAB; } @@ -266,7 +266,7 @@ function OnLoadEditCard() var abURI = window.arguments[0].abURI; var directory = GetDirectoryFromURI(abURI); - if (!(directory.operations & directory.opWrite)) + if (directory.readOnly) { // Set all the editable vcard fields to read only for (var i = kVcardFields.length; i-- > 0; ) diff --git a/mailnews/addrbook/resources/content/abCommon.js b/mailnews/addrbook/resources/content/abCommon.js index 1a3b228c6a..59e7b9672c 100644 --- a/mailnews/addrbook/resources/content/abCommon.js +++ b/mailnews/addrbook/resources/content/abCommon.js @@ -98,8 +98,7 @@ var DirPaneController = // If the directory is a mailing list, and it is read-only, return // false. var abDir = GetDirectoryFromURI(selectedDir); - if (abDir.isMailList && - ~abDir.operations & abDir.opWrite) + if (abDir.isMailList && abDir.readOnly) return false; // If the selected directory is an ldap directory diff --git a/mailnews/addrbook/resources/content/abDragDrop.js b/mailnews/addrbook/resources/content/abDragDrop.js index 20ed203cb9..331311c3d2 100644 --- a/mailnews/addrbook/resources/content/abDragDrop.js +++ b/mailnews/addrbook/resources/content/abDragDrop.js @@ -55,7 +55,7 @@ var abResultsPaneObserver = { var srcDirectory = GetDirectoryFromURI(GetSelectedDirectory()); // The default allowable actions are copy, move and link, so we need // to restrict them here. - if ((srcDirectory.operations & srcDirectory.opWrite)) + if (!srcDirectory.readOnly) // Only allow copy & move from read-write directories. aDragAction.action = Components.interfaces. nsIDragService.DRAGDROP_ACTION_COPY | @@ -137,7 +137,7 @@ var abDirTreeObserver = { // e.g. LDAP is readonly currently var targetDirectory = GetDirectoryFromURI(targetURI); - if (!(targetDirectory.operations & targetDirectory.opWrite)) + if (targetDirectory.readOnly) return false; var dragSession = dragService.getCurrentSession(); @@ -157,7 +157,7 @@ var abDirTreeObserver = { var srcDirectory = GetDirectoryFromURI(srcURI); // Only allow copy from read-only directories. - if (!(srcDirectory.operations & srcDirectory.opWrite) && + if (srcDirectory.readOnly && dragSession.dragAction != Components.interfaces. nsIDragService.DRAGDROP_ACTION_COPY) return false; diff --git a/mailnews/addrbook/resources/content/abMailListDialog.js b/mailnews/addrbook/resources/content/abMailListDialog.js index 4bfafb83c4..e8d7ad434a 100644 --- a/mailnews/addrbook/resources/content/abMailListDialog.js +++ b/mailnews/addrbook/resources/content/abMailListDialog.js @@ -220,7 +220,7 @@ function OnLoadNewMailList() selectedAB = parentURI; } } - else if (!(directory.operations & directory.opWrite)) { + else if (directory.readOnly) { selectedAB = kPersonalAddressbookURI; } @@ -309,7 +309,7 @@ function OnLoadEditList() // Is this directory read-only? If so, we now need to set all the fields to // read-only. - if (~gEditList.operations & gEditList.opWrite) { + if (gEditList.readOnly) { const kMailListFields = [ 'ListName', 'ListNickName', 'ListDescription' ]; for (var i = 0; i < kMailListFields.length; ++i) diff --git a/mailnews/addrbook/resources/content/abResultsPane.js b/mailnews/addrbook/resources/content/abResultsPane.js index 7aef894b13..10ae88c47e 100644 --- a/mailnews/addrbook/resources/content/abResultsPane.js +++ b/mailnews/addrbook/resources/content/abResultsPane.js @@ -381,7 +381,7 @@ var ResultsPaneController = var enabled = false; if (gAbView && gAbView.selection) { if (gAbView.directory) - enabled = gAbView.directory.operations & gAbView.directory.opWrite; + enabled = !gAbView.directory.readOnly; numSelected = gAbView.selection.count; } else diff --git a/mailnews/addrbook/resources/content/addrbookWidgets.xml b/mailnews/addrbook/resources/content/addrbookWidgets.xml index d6f75414e7..af09ccf911 100644 --- a/mailnews/addrbook/resources/content/addrbookWidgets.xml +++ b/mailnews/addrbook/resources/content/addrbookWidgets.xml @@ -183,11 +183,10 @@ ioService = - do_GetService(NS_IOSERVICE_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv,rv); - - rv = ioService->GetOffline(&offline); - NS_ENSURE_SUCCESS(rv,rv); - - if (!offline) - *aOperations |= nsIAbDirectory::opWrite; -#endif - - return NS_OK; -} - NS_IMETHODIMP nsAbLDAPDirectory::GetChildNodes(nsISimpleEnumerator* *aResult) { return NS_NewEmptyEnumerator(aResult); @@ -457,6 +429,36 @@ NS_IMETHODIMP nsAbLDAPDirectory::GetSupportsMailingLists(PRBool *aSupportsMailin return NS_OK; } +NS_IMETHODIMP nsAbLDAPDirectory::GetReadOnly(PRBool *aReadOnly) +{ + NS_ENSURE_ARG_POINTER(aReadOnly); + + *aReadOnly = PR_TRUE; + +#ifdef MOZ_EXPERIMENTAL_WRITEABLE_LDAP + PRBool readOnly; + nsresult rv = GetBoolValue("readonly", PR_FALSE, &readOnly); + NS_ENSURE_SUCCESS(rv, rv); + + if (readOnly) + return NS_OK; + + // when online, we'll allow writing as well + PRBool offline; + nsCOMPtr ioService = + do_GetService(NS_IOSERVICE_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv,rv); + + rv = ioService->GetOffline(&offline); + NS_ENSURE_SUCCESS(rv,rv); + + if (!offline) + *aReadOnly = PR_FALSE; +#endif + + return NS_OK; +} + NS_IMETHODIMP nsAbLDAPDirectory::GetIsRemote(PRBool *aIsRemote) { NS_ENSURE_ARG_POINTER(aIsRemote); diff --git a/mailnews/addrbook/src/nsAbLDAPDirectory.h b/mailnews/addrbook/src/nsAbLDAPDirectory.h index efc0e4f3b8..78f2f80b0d 100644 --- a/mailnews/addrbook/src/nsAbLDAPDirectory.h +++ b/mailnews/addrbook/src/nsAbLDAPDirectory.h @@ -69,11 +69,11 @@ public: // nsIAbDirectory methods NS_IMETHOD GetPropertiesChromeURI(nsACString &aResult); NS_IMETHOD GetURI(nsACString &aURI); - NS_IMETHOD GetOperations(PRInt32 *aOperations); NS_IMETHOD GetChildNodes(nsISimpleEnumerator* *result); NS_IMETHOD GetChildCards(nsISimpleEnumerator* *result); NS_IMETHOD HasCard(nsIAbCard *cards, PRBool *hasCard); NS_IMETHOD GetSupportsMailingLists(PRBool *aSupportsMailingsLists); + NS_IMETHOD GetReadOnly(PRBool *aReadOnly); NS_IMETHOD GetIsRemote(PRBool *aIsRemote); NS_IMETHOD GetIsSecure(PRBool *aIsRemote); NS_IMETHOD UseForAutocomplete(const nsACString &aIdentityKey, PRBool *aResult); diff --git a/mailnews/addrbook/src/nsAbOSXDirectory.h b/mailnews/addrbook/src/nsAbOSXDirectory.h index 2b10c9b634..a19822fddc 100644 --- a/mailnews/addrbook/src/nsAbOSXDirectory.h +++ b/mailnews/addrbook/src/nsAbOSXDirectory.h @@ -93,7 +93,7 @@ public: NS_IMETHOD Init(const char *aUri); // nsAbDirProperty methods - NS_IMETHOD GetOperations(PRInt32 *aOperations); + NS_IMETHOD GetReadOnly(PRBool *aReadOnly); NS_IMETHOD GetChildCards(nsISimpleEnumerator **aCards); NS_IMETHOD GetChildNodes(nsISimpleEnumerator **aNodes); NS_IMETHOD HasCard(nsIAbCard *aCard, PRBool *aHasCard); diff --git a/mailnews/addrbook/src/nsAbOSXDirectory.mm b/mailnews/addrbook/src/nsAbOSXDirectory.mm index bc43b9502e..a0ae998540 100644 --- a/mailnews/addrbook/src/nsAbOSXDirectory.mm +++ b/mailnews/addrbook/src/nsAbOSXDirectory.mm @@ -522,11 +522,11 @@ nsAbOSXDirectory::GetURI(nsACString &aURI) } NS_IMETHODIMP -nsAbOSXDirectory::GetOperations(PRInt32 *aOperations) +nsAbOSXDirectory::GetReadOnly(PRBool *aReadOnly) { - *aOperations = nsIAbDirectory::opRead | - nsIAbDirectory::opSearch; - + NS_ENSURE_ARG_POINTER(aReadOnly); + + *aReadOnly = PR_TRUE; return NS_OK; } diff --git a/mailnews/addrbook/src/nsDirectoryDataSource.cpp b/mailnews/addrbook/src/nsDirectoryDataSource.cpp index 3b1fca5328..94d419567c 100644 --- a/mailnews/addrbook/src/nsDirectoryDataSource.cpp +++ b/mailnews/addrbook/src/nsDirectoryDataSource.cpp @@ -494,11 +494,11 @@ nsresult nsAbDirectoryDataSource::createDirectoryIsWriteableNode(nsIAbDirectory* directory, nsIRDFNode **target) { - PRBool isWriteable; - nsresult rv = directory->GetOperations(&isWriteable); + PRBool isReadOnly; + nsresult rv = directory->GetReadOnly(&isReadOnly); NS_ENSURE_SUCCESS(rv, rv); - NS_IF_ADDREF(*target = ((isWriteable & nsIAbDirectory::opWrite) ? kTrueLiteral : kFalseLiteral)); + NS_IF_ADDREF(*target = (isReadOnly ? kFalseLiteral : kTrueLiteral)); return NS_OK; } diff --git a/mailnews/addrbook/test/resources/abSetup.js b/mailnews/addrbook/test/resources/abSetup.js index 4bc0866b0e..d3def161b8 100644 --- a/mailnews/addrbook/test/resources/abSetup.js +++ b/mailnews/addrbook/test/resources/abSetup.js @@ -19,9 +19,7 @@ var kPABData = dirName: "Personal Address Book", dirType: 2, dirPrefID: "ldap_2.servers.pab", - operations: Components.interfaces.nsIAbDirectory.opRead | - Components.interfaces.nsIAbDirectory.opWrite | - Components.interfaces.nsIAbDirectory.opSearch, + readOnly: false, position: 1 }; @@ -33,9 +31,7 @@ var kCABData = dirName: "Collected Addresses", dirType: 2, dirPrefID: "ldap_2.servers.history", - operations: Components.interfaces.nsIAbDirectory.opRead | - Components.interfaces.nsIAbDirectory.opWrite | - Components.interfaces.nsIAbDirectory.opSearch, + readOnly: false, position: 2 }; @@ -47,8 +43,7 @@ var kOSXData = dirName: "Mac OS X Address Book", dirType: 3, dirPrefID: "ldap_2.servers.osx", - operations: Components.interfaces.nsIAbDirectory.opRead | - Components.interfaces.nsIAbDirectory.opSearch, + readOnly: true, position: 1 }; diff --git a/mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js b/mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js index 9ee8972bcd..eadd3df731 100644 --- a/mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js +++ b/mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js @@ -44,8 +44,9 @@ function check_ab(abConfig) { // Test - Check attributes + do_check_eq(AB.generateName(0), abConfig.dirName); do_check_eq(AB.propertiesChromeURI, kNormalPropertiesURI); - do_check_eq(AB.operations, abConfig.operations); + do_check_eq(AB.readOnly, abConfig.readOnly); do_check_eq(AB.dirName, abConfig.dirName); do_check_eq(AB.dirType, abConfig.dirType); do_check_eq(AB.fileName, abConfig.fileName); diff --git a/mailnews/addrbook/test/unit/test_ldap1.js b/mailnews/addrbook/test/unit/test_ldap1.js index 4a18e28ff5..ac25e301cd 100644 --- a/mailnews/addrbook/test/unit/test_ldap1.js +++ b/mailnews/addrbook/test/unit/test_ldap1.js @@ -26,6 +26,7 @@ function run_test() { // Test - Check various fields do_check_eq(abDir.dirName, "test"); do_check_eq(abDir.lDAPURL.spec, kLDAPTestSpec); + do_check_true(abDir.readOnly); // Test - Write a UTF-8 Auth DN and check it abDir.authDn = "test\u00D0"; diff --git a/mailnews/compose/src/nsMsgCompose.cpp b/mailnews/compose/src/nsMsgCompose.cpp index ed5e857cc9..c97c152d10 100644 --- a/mailnews/compose/src/nsMsgCompose.cpp +++ b/mailnews/compose/src/nsMsgCompose.cpp @@ -4652,13 +4652,13 @@ nsMsgCompose::CheckAndPopulateRecipients(PRBool aPopulateMailList, if (NS_SUCCEEDED(rv)) recipient.mProcessed = PR_TRUE; - PRInt32 isWriteable; - rv = abDirectory->GetOperations(&isWriteable); + PRBool readOnly; + rv = abDirectory->GetReadOnly(&readOnly); NS_ENSURE_SUCCESS(rv,rv); // bump the popularity index for this card since we are about to send e-mail to it PRUint32 popularityIndex = 0; - if ((isWriteable & nsIAbDirectory::opWrite) && NS_SUCCEEDED(existingCard->GetPropertyAsUint32( + if (!readOnly && NS_SUCCEEDED(existingCard->GetPropertyAsUint32( kPopularityIndexProperty, &popularityIndex))) {