--- directory/xpcom/base/public/nsILDAPConnection.idl Fri Sep 27 12:13:01 2002 +++ directory.patch/xpcom/base/public/nsILDAPConnection.idl Fri Sep 27 11:38:54 2002 @@ -69,7 +69,7 @@ * @exception NS_ERROR_FAILURE * @exception NS_ERROR_UNEXPECTED internal error */ - void init(in string aHost, in short aPort, in boolean aSSL, + void init(in string aHost, in long aPort, in boolean aSSL, in wstring aBindName, in nsILDAPMessageListener aMessageListener); --- directory/xpcom/base/src/nsLDAPConnection.cpp Wed Apr 10 06:55:50 2002 +++ directory.patch/xpcom/base/src/nsLDAPConnection.cpp Fri Oct 4 10:32:12 2002 @@ -169,7 +169,7 @@ NS_IMETHODIMP -nsLDAPConnection::Init(const char *aHost, PRInt16 aPort, PRBool aSSL, +nsLDAPConnection::Init(const char *aHost, PRInt32 aPort, PRBool aSSL, const PRUnichar *aBindName, nsILDAPMessageListener *aMessageListener) { @@ -256,7 +256,8 @@ return NS_ERROR_FAILURE; } rv = pDNSService->Lookup(aHost, - selfProxy, + //selfProxy, + this, // SDBC change nsnull, getter_AddRefs(mDNSRequest)); --- directory/xpcom/base/src/nsLDAPConnection.h Fri Sep 27 12:12:33 2002 +++ directory.patch/xpcom/base/src/nsLDAPConnection.h Fri Sep 27 11:38:02 2002 @@ -119,7 +119,7 @@ nsSupportsHashtable *mPendingOperations; // keep these around for callbacks nsLDAPConnectionLoop *mRunnable; // nsIRunnable object - PRInt16 mPort; // The LDAP port we're binding to + PRInt32 mPort; // The LDAP port we're binding to PRBool mSSL; // the options nsCString mResolvedIP; // Preresolved list of host IPs --- mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp Thu May 23 16:50:31 2002 +++ mailnews.patch/addrbook/src/nsAbBoolExprToLDAPFilter.cpp Thu May 23 17:10:38 2002 @@ -39,10 +39,37 @@ #include "nsAbBoolExprToLDAPFilter.h" #include "nsAbLDAPProperties.h" #include "nsXPIDLString.h" +#include "nsAbUtils.h" +#include "nsCRT.h" const int nsAbBoolExprToLDAPFilter::TRANSLATE_CARD_PROPERTY = 1 << 0 ; const int nsAbBoolExprToLDAPFilter::ALLOW_NON_CONVERTABLE_CARD_PROPERTY = 1 << 1 ; +static nsresult SetSingleArrayGuard( const char* aLDAPProperty, PRUint32 *aAttrCount, char * **aAttributes) +{ + NS_ENSURE_ARG_POINTER(aAttrCount); + NS_ENSURE_ARG_POINTER(aAttributes); + + nsresult rv = NS_OK; + + *aAttributes = 0; + *aAttrCount = 0; + + *aAttributes = NS_STATIC_CAST(char **, nsMemory::Alloc(sizeof(char *))); + if (!*aAttributes) + return NS_ERROR_OUT_OF_MEMORY; + + (*aAttributes)[0] = nsCRT::strdup(aLDAPProperty); + if (!(*aAttributes)[0]) + { + nsMemory::Free(*aAttributes); + return NS_ERROR_OUT_OF_MEMORY; + } + *aAttrCount = 1; + + return rv; +} + nsresult nsAbBoolExprToLDAPFilter::Convert ( nsIAbBooleanExpression* expression, nsCString& filter, @@ -80,6 +107,35 @@ if (count == 0) return NS_OK; + /* + * 3rd party query integration with Mozilla is achieved + * by calling nsAbLDAPDirectoryQuery::DoQuery(). Thus + * we can arrive here with a query asking for all the + * ldap attributes using the card:nsIAbCard interface. + * + * So we need to check that we are not creating a condition + * filter against this otherwise we can end an + * invalid filter equal to "(|)". + */ + + if (count == 1 ) + { + nsCOMPtr item; + rv = childExpressions->GetElementAt (0, getter_AddRefs (item)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr childCondition(do_QueryInterface(item, &rv)); + if (NS_SUCCEEDED(rv)) + { + nsXPIDLCString name; + rv = childCondition->GetName (getter_Copies (name)); + NS_ENSURE_SUCCESS(rv, rv); + + if(name.Equals("card:nsIAbCard")) + return NS_OK; + } + } + filter += NS_LITERAL_CSTRING("("); switch (operation) { @@ -102,6 +158,7 @@ } filter += NS_LITERAL_CSTRING(")"); + return rv; } @@ -158,12 +215,27 @@ NS_ENSURE_SUCCESS(rv, rv); const char* ldapProperty = name.get (); + PRUint32 attrMatchCount = 1; + CharPtrArrayGuard attrs; if (flags & TRANSLATE_CARD_PROPERTY) { const MozillaLdapPropertyRelation* p = MozillaLdapPropertyRelator::findLdapPropertyFromMozilla (name.get ()); if (p) + { ldapProperty = p->ldapProperty; + attrMatchCount = p->ldapAttrMatchCount; + if(attrMatchCount > 1) + { + rv = MozillaLdapPropertyRelator::getAllLDAPAttrsFromMozilla (p->mozillaProperty,attrMatchCount, attrs.GetSizeAddr(), attrs.GetArrayAddr() ); + NS_ENSURE_SUCCESS(rv, rv); + } + else + { + rv = SetSingleArrayGuard (ldapProperty, attrs.GetSizeAddr(), attrs.GetArrayAddr() ); + NS_ENSURE_SUCCESS(rv, rv); + } + } else if (!(flags & ALLOW_NON_CONVERTABLE_CARD_PROPERTY)) return NS_OK; } @@ -173,86 +245,126 @@ NS_ENSURE_SUCCESS(rv, rv); NS_ConvertUCS2toUTF8 vUTF8 (value); + if(attrMatchCount > 1) + filter += NS_LITERAL_CSTRING("(|"); + + PRUint32 i = 0; + switch (conditionType) { case nsIAbBooleanConditionTypes::DoesNotExist: - filter += NS_LITERAL_CSTRING("(!(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(!(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING("=*))"); + } break; case nsIAbBooleanConditionTypes::Exists: - filter += NS_LITERAL_CSTRING("(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING("=*)"); + } break; case nsIAbBooleanConditionTypes::Contains: - filter += NS_LITERAL_CSTRING("(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING("=*") + vUTF8 + NS_LITERAL_CSTRING("*)"); + } break; case nsIAbBooleanConditionTypes::DoesNotContain: - filter += NS_LITERAL_CSTRING("(!(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(!(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING("=*") + vUTF8 + NS_LITERAL_CSTRING("*))"); + } break; case nsIAbBooleanConditionTypes::Is: - filter += NS_LITERAL_CSTRING("(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING("=") + vUTF8 + NS_LITERAL_CSTRING(")"); + } break; case nsIAbBooleanConditionTypes::IsNot: - filter += NS_LITERAL_CSTRING("(!(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(!(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING("=") + vUTF8 + NS_LITERAL_CSTRING("))"); + } break; case nsIAbBooleanConditionTypes::BeginsWith: - filter += NS_LITERAL_CSTRING("(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING("=") + vUTF8 + NS_LITERAL_CSTRING("*)"); + } break; case nsIAbBooleanConditionTypes::EndsWith: - filter += NS_LITERAL_CSTRING("(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING("=*") + vUTF8 + NS_LITERAL_CSTRING(")"); + } break; case nsIAbBooleanConditionTypes::LessThan: - filter += NS_LITERAL_CSTRING("(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING("<=") + vUTF8 + NS_LITERAL_CSTRING(")"); + } break; case nsIAbBooleanConditionTypes::GreaterThan: - filter += NS_LITERAL_CSTRING("(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING(">=") + vUTF8 + NS_LITERAL_CSTRING(")"); + } break; case nsIAbBooleanConditionTypes::SoundsLike: - filter += NS_LITERAL_CSTRING("(") + - nsDependentCString(ldapProperty) + + for (i = 0; i < attrs.GetSize(); i++) + { + filter += NS_LITERAL_CSTRING("(") + + nsDependentCString(attrs.GetArray()[i]) + NS_LITERAL_CSTRING("~=") + vUTF8 + NS_LITERAL_CSTRING(")"); + } break; case nsIAbBooleanConditionTypes::RegExp: break; default: break; } + if(attrMatchCount > 1) + filter += NS_LITERAL_CSTRING(")"); return rv; } --- mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp Wed Sep 11 15:08:24 2002 +++ mailnews.patch/addrbook/src/nsAbLDAPDirectoryQuery.cpp Wed Sep 11 15:07:11 2002 @@ -46,6 +46,7 @@ #include "nsILDAPErrors.h" #include "nsILDAPOperation.h" #include "nsAbUtils.h" +#include "nsAbLDAPCard.h" #include "nsIAuthPrompt.h" #include "nsIStringBundle.h" @@ -107,6 +108,9 @@ nsCOMPtr mSearchOperation; PRLock* mLock; + +private: + nsAbLDAPCard mResultCard ; }; @@ -385,6 +389,7 @@ do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); +#if 0 nsCOMPtr proxyListener; rv = NS_GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsILDAPMessageListener), @@ -393,6 +398,10 @@ getter_AddRefs(proxyListener)); rv = ldapOperation->Init(mConnection, proxyListener); +#endif +#if 1 + rv = ldapOperation->Init(mConnection, this); +#endif NS_ENSURE_SUCCESS(rv, rv); // Bind @@ -446,6 +455,7 @@ mSearchOperation = do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); +#if 0 nsCOMPtr proxyMgr = do_GetService(NS_XPCOMPROXY_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); @@ -456,6 +466,10 @@ NS_ENSURE_SUCCESS(rv, rv); rv = mSearchOperation->Init (mConnection, proxyListener); +#endif +#if 1 + rv = mSearchOperation->Init (mConnection, this); +#endif NS_ENSURE_SUCCESS(rv, rv); nsXPIDLCString dn; @@ -541,9 +555,28 @@ if (!p) continue; + const MozillaLdapPropertyRelation* relation ; + for (PRUint32 j = 0; j < attrs.GetSize(); j++) { - if (nsCRT::strcasecmp (p->ldapProperty, attrs[j]) == 0) + relation = MozillaLdapPropertyRelator::findMozillaPropertyFromLdap (attrs[j]); + if (!relation) + continue; + /* + * This change is necessary due to a side effect of #124022. The list of + * requested attributes is created in reverse order than how they appear + * in nsAbLDAPProperties.cpp. Thus while "surname" and "sn" both map to + * LastName, "sn" will be returned by findLdapPropertyFromMozilla() as it + * appears first in the hash table but "surname" will be returned by the + * request. + * + * Rather than simply reversing the order, an alternative is to compare + * the mapped Mozilla attributes where a one to one match exists. + * The issue of multiple ldap attributes was also raised in #126749 and + * probably needs a more overall solution. + */ + + if (nsCRT::strcasecmp (relation->mozillaProperty, n.get()) == 0) { PRUnicharPtrArrayGuard vals; rv = aMessage->GetValues (attrs[j], vals.GetSizeAddr(), vals.GetArrayAddr()); @@ -552,7 +585,15 @@ if (vals.GetSize() == 0) break; - _propertyValue = new nsAbDirectoryQueryPropertyValue(n.get (), vals[0]); + rv = mResultCard.SetCardValue(n.get(), vals[0]) ; + NS_ENSURE_SUCCESS(rv, rv); + + nsXPIDLString mozillaValue ; + rv = mResultCard.GetCardValue(n.get(), getter_Copies(mozillaValue)) ; + NS_ENSURE_SUCCESS(rv, rv); + + _propertyValue = new nsAbDirectoryQueryPropertyValue(n.get (), mozillaValue.get()); + if (_propertyValue == NULL) return NS_ERROR_OUT_OF_MEMORY; break; @@ -685,6 +726,20 @@ rv = nsAbBoolExprToLDAPFilter::Convert (expression, filter); NS_ENSURE_SUCCESS(rv, rv); + /* + * Mozilla itself cannot arrive here with a blank filter + * as the nsAbLDAPDirectory::StartSearch() disallows it. + * But 3rd party LDAP query integration with Mozilla begins here. + * + * Default the filter string if blank otherwise it gets + * set to (objectclass=*) which will return + * everything from the LDAP server instead of + * focussing on the address entries. + */ + if(filter.Equals("")) + { + filter += NS_LITERAL_CSTRING("(|(mail=*))"); + } // Set up the search ldap url rv = GetLDAPURL (getter_AddRefs (mDirectoryUrl)); --- mailnews/addrbook/src/nsAbLDAPProperties.cpp Wed Apr 10 04:02:48 2002 +++ mailnews.patch/addrbook/src/nsAbLDAPProperties.cpp Wed May 1 15:56:06 2002 @@ -39,6 +39,7 @@ #include "nsAbLDAPProperties.h" #include "nsAbUtils.h" +#include "nsCRT.h" #include "nsCOMPtr.h" #include "nsString.h" @@ -71,111 +72,117 @@ mozilla code that imported from ldif files, comments above each table row indicate which class of ldap object the property belongs. + + Add a numeric field to indicate whether we have + a 1:1 mapping from Mozilla to LDAP attribute + names. Where we have a multi Mozilla mapping + indicate the total number of mappings on all + attribute names. */ static MozillaLdapPropertyRelation mozillaLdapPropertyTable[] = { // inetOrgPerson - {MozillaProperty_String, "FirstName", "givenname"}, + {MozillaProperty_String, "FirstName", "givenname", 1}, // person - {MozillaProperty_String, "LastName", "sn"}, + {MozillaProperty_String, "LastName", "sn", 2}, // person - {MozillaProperty_String, "LastName", "surname"}, + {MozillaProperty_String, "LastName", "surname", 2}, // person - {MozillaProperty_String, "DisplayName", "cn"}, + {MozillaProperty_String, "DisplayName", "cn", 3}, // person - {MozillaProperty_String, "DisplayName", "commonname"}, + {MozillaProperty_String, "DisplayName", "commonname", 3}, // inetOrfPerson - {MozillaProperty_String, "DisplayName", "displayname"}, + {MozillaProperty_String, "DisplayName", "displayname", 3}, // mozilla specific - {MozillaProperty_String, "NickName", "xmozillanickname"}, + {MozillaProperty_String, "NickName", "xmozillanickname", 1}, // inetOrfPerson - {MozillaProperty_String, "PrimaryEmail", "mail"}, + {MozillaProperty_String, "PrimaryEmail", "mail", 1}, // mozilla specific - {MozillaProperty_String, "SecondEmail", "xmozillasecondemail"}, + {MozillaProperty_String, "SecondEmail", "xmozillasecondemail", 1}, // person - {MozillaProperty_String, "WorkPhone", "telephonenumber"}, + {MozillaProperty_String, "WorkPhone", "telephonenumber", 1}, // inetOrgPerson - {MozillaProperty_String, "HomePhone", "homephone"}, + {MozillaProperty_String, "HomePhone", "homephone", 1}, // ? - {MozillaProperty_String, "FaxNumber", "fax"}, + {MozillaProperty_String, "FaxNumber", "fax", 2}, // organizationalPerson - {MozillaProperty_String, "FaxNumber", "facsimiletelephonenumber"}, + {MozillaProperty_String, "FaxNumber", "facsimiletelephonenumber", 2}, // inetOrgPerson - {MozillaProperty_String, "PagerNumber", "pager"}, + {MozillaProperty_String, "PagerNumber", "pager", 2}, // ? - {MozillaProperty_String, "PagerNumber", "pagerphone"}, + {MozillaProperty_String, "PagerNumber", "pagerphone", 2}, // inetOrgPerson - {MozillaProperty_String, "CellularNumber", "mobile"}, + {MozillaProperty_String, "CellularNumber", "mobile", 3}, // ? - {MozillaProperty_String, "CellularNumber", "cellphone"}, + {MozillaProperty_String, "CellularNumber", "cellphone", 3}, // ? - {MozillaProperty_String, "CellularNumber", "carphone"}, + {MozillaProperty_String, "CellularNumber", "carphone", 3}, // No Home* properties defined yet // organizationalPerson - {MozillaProperty_String, "WorkAddress", "postofficebox"}, + {MozillaProperty_String, "WorkAddress", "postofficebox", 2}, // ? - {MozillaProperty_String, "WorkAddress", "streetaddress"}, + {MozillaProperty_String, "WorkAddress", "streetaddress", 2}, // ? - {MozillaProperty_String, "WorkCity", "l"}, + {MozillaProperty_String, "WorkCity", "l", 2}, // ? - {MozillaProperty_String, "WorkCity", "locality"}, + {MozillaProperty_String, "WorkCity", "locality", 2}, // ? - {MozillaProperty_String, "WorkState", "st"}, + {MozillaProperty_String, "WorkState", "st", 2}, // ? - {MozillaProperty_String, "WorkState", "region"}, + {MozillaProperty_String, "WorkState", "region", 2}, // organizationalPerson - {MozillaProperty_String, "WorkZipCode", "postalcode"}, + {MozillaProperty_String, "WorkZipCode", "postalcode", 2}, // ? - {MozillaProperty_String, "WorkZipCode", "zip"}, + {MozillaProperty_String, "WorkZipCode", "zip", 2}, // ? - {MozillaProperty_String, "WorkCountry", "countryname"}, + {MozillaProperty_String, "WorkCountry", "countryname", 1}, // organizationalPerson - {MozillaProperty_String, "JobTitle", "title"}, + {MozillaProperty_String, "JobTitle", "title", 1}, // ? - {MozillaProperty_String, "Department", "ou"}, + {MozillaProperty_String, "Department", "ou", 4}, // ? - {MozillaProperty_String, "Department", "orgunit"}, + {MozillaProperty_String, "Department", "orgunit", 4}, // ? - {MozillaProperty_String, "Department", "department"}, + {MozillaProperty_String, "Department", "department", 4}, // ? - {MozillaProperty_String, "Department", "departmentnumber"}, + {MozillaProperty_String, "Department", "departmentnumber", 4}, // inetOrgPerson - {MozillaProperty_String, "Company", "o"}, + {MozillaProperty_String, "Company", "o", 2}, // ? - {MozillaProperty_String, "Company", "company"}, + {MozillaProperty_String, "Company", "company", 2}, // ? - {MozillaProperty_String, "WorkCountry", "countryname"}, + {MozillaProperty_String, "WorkCountry", "countryname", 1}, // ? - {MozillaProperty_String, "WebPage1", "workurl"}, + {MozillaProperty_String, "WebPage1", "workurl", 1}, // ? - {MozillaProperty_String, "WebPage2", "homeurl"}, + {MozillaProperty_String, "WebPage2", "homeurl", 1}, // ? - {MozillaProperty_String, "BirthYear", "birthyear"}, + {MozillaProperty_String, "BirthYear", "birthyear", 1}, // ? - {MozillaProperty_String, "Custom1", "custom1"}, + {MozillaProperty_String, "Custom1", "custom1", 1}, // ? - {MozillaProperty_String, "Custom2", "custom2"}, + {MozillaProperty_String, "Custom2", "custom2", 1}, // ? - {MozillaProperty_String, "Custom3", "custom3"}, + {MozillaProperty_String, "Custom3", "custom3", 1}, // ? - {MozillaProperty_String, "Custom4", "custom4"}, + {MozillaProperty_String, "Custom4", "custom4", 1}, // ? - {MozillaProperty_String, "Notes", "notes"}, + {MozillaProperty_String, "Notes", "notes", 2}, // person - {MozillaProperty_String, "Notes", "description"}, + {MozillaProperty_String, "Notes", "description", 2}, // mozilla specfic - {MozillaProperty_Int, "PreferMailFormat", "xmozillausehtmlmail"}, + {MozillaProperty_Int, "PreferMailFormat", "xmozillausehtmlmail", 1}, // ? - {MozillaProperty_Int, "LastModifiedDate", "modifytimestamp"} + {MozillaProperty_Int, "LastModifiedDate", "modifytimestamp", 1} }; const MozillaLdapPropertyRelation* MozillaLdapPropertyRelator::table = mozillaLdapPropertyTable; @@ -286,5 +293,36 @@ } } + return rv; +} +nsresult MozillaLdapPropertyRelator::getAllLDAPAttrsFromMozilla (const char* aMozillaProperty, const int aAttrMatch, PRUint32 *aAttrCount, char * **aAttributes) +{ + NS_ENSURE_ARG_POINTER(aAttrCount); + NS_ENSURE_ARG_POINTER(aAttributes); + + nsresult rv = NS_OK; + + *aAttributes = 0; + *aAttrCount = 0; + + *aAttributes = NS_STATIC_CAST(char **, nsMemory::Alloc(aAttrMatch * sizeof(char *))); + if (!*aAttributes) + return NS_ERROR_OUT_OF_MEMORY; + + PRInt32 j = 0; + for (int i = 0; i < tableSize && j < aAttrMatch; i++) + { + if (nsCRT::strcasecmp (aMozillaProperty, table[i].mozillaProperty) == 0) + { + (*aAttributes)[j] = nsCRT::strdup(table[i].ldapProperty); + if (!(*aAttributes)[j]) + { + nsMemory::Free(*aAttributes); + return NS_ERROR_OUT_OF_MEMORY; + } + j++; + *aAttrCount += 1; + } + } return rv; } --- mailnews/addrbook/src/nsAbLDAPProperties.h Wed Apr 10 04:02:48 2002 +++ mailnews.patch/addrbook/src/nsAbLDAPProperties.h Wed May 1 15:56:03 2002 @@ -60,6 +60,7 @@ MozillaPropertyType mozillaPropertyType; const char* mozillaProperty; const char* ldapProperty; + PRUint32 ldapAttrMatchCount; }; class MozillaLdapPropertyRelator @@ -85,6 +86,7 @@ static nsresult createCardPropertyFromLDAPMessage (nsILDAPMessage* message, nsIAbCard* card, PRBool* hasSetCardProperty); + static nsresult getAllLDAPAttrsFromMozilla (const char* aMozillaProperty, const int aAttrMatch, PRUint32 *aAttrCount, char * **aAttributes); }; #endif --- mailnews/addrbook/src/nsAbOutlookDirectory.cpp Wed Feb 6 22:50:22 2002 +++ mailnews.patch/addrbook/src/nsAbOutlookDirectory.cpp Thu Apr 18 20:06:27 2002 @@ -1105,14 +1105,19 @@ nsCAutoString entryId ; nsCAutoString uriName ; nsCOMPtr resource ; - + nsCOMPtr childCard; + for (ULONG card = 0 ; card < cardEntries.mNbEntries ; ++ card) { cardEntries.mEntries [card].ToString(entryId) ; buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ; uriName.Append(entryId) ; - retCode = gRDFService->GetResource(uriName.get(), getter_AddRefs(resource)) ; + childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode); + NS_ENSURE_SUCCESS(retCode, retCode) ; + resource = do_QueryInterface(childCard, &retCode) ; NS_ENSURE_SUCCESS(retCode, retCode) ; - cards->AppendElement(resource) ; + retCode = resource->Init(uriName.get()) ; + NS_ENSURE_SUCCESS(retCode, retCode) ; + cards->AppendElement(childCard) ; } *aCards = cards ; NS_ADDREF(*aCards) ; @@ -1291,10 +1296,11 @@ uri.Append(entryString) ; nsCOMPtr resource ; - retCode = gRDFService->GetResource(uri.get(), getter_AddRefs(resource)) ; + nsCOMPtr newCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode); NS_ENSURE_SUCCESS(retCode, retCode) ; - nsCOMPtr newCard(do_QueryInterface(resource, &retCode)) ; - + resource = do_QueryInterface(newCard, &retCode) ; + NS_ENSURE_SUCCESS(retCode, retCode) ; + retCode = resource->Init(uri.get()) ; NS_ENSURE_SUCCESS(retCode, retCode) ; if (!didCopy) { retCode = newCard->Copy(aData) ; --- mailnews/addrbook/src/nsAbWinHelper.cpp Tue Feb 19 08:41:59 2002 +++ mailnews.patch/addrbook/src/nsAbWinHelper.cpp Thu Apr 18 20:06:55 2002 @@ -431,7 +431,7 @@ ULONG i = 0 ; for (i = 0 ; i < valueCount ; ++ i) { - if (values [i].ulPropTag == aPropertyTags [i]) { + if (PROP_ID(values [i].ulPropTag) == PROP_ID(aPropertyTags [i])) { if (PROP_TYPE(values [i].ulPropTag) == PT_STRING8) { nsAutoString temp ; --- profile/src/nsProfile.cpp Fri Jun 21 15:52:12 2002 +++ profile/src/nsProfile.cpp.new Fri Jun 21 15:51:24 2002 @@ -555,6 +555,7 @@ rv = curProfileDir->Exists(&exists); if (NS_FAILED(rv) || !exists) profileURLStr = PROFILE_MANAGER_URL; +#if 0 if (exists) { // If the profile is locked, we need the UI @@ -564,6 +565,7 @@ if (NS_FAILED(rv)) profileURLStr = PROFILE_MANAGER_URL; } +#endif } else profileURLStr = PROFILE_SELECTION_URL; @@ -1200,6 +1202,7 @@ else isSwitch = PR_FALSE; +#if 0 nsProfileLock localLock; nsCOMPtr localProfileDir(do_QueryInterface(profileDir, &rv)); if (NS_FAILED(rv)) return rv; @@ -1209,6 +1212,7 @@ NS_ERROR("Could not get profile directory lock."); return rv; } +#endif nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1", &rv); @@ -1244,7 +1248,9 @@ gProfileDataAccess->SetCurrentProfile(aCurrentProfile); gProfileDataAccess->mProfileDataChanged = PR_TRUE; gProfileDataAccess->UpdateRegistry(nsnull); +#if 0 mCurrentProfileLock = localLock; +#endif if (NS_FAILED(rv)) return rv; mCurrentProfileAvailable = PR_TRUE; @@ -1331,7 +1337,9 @@ UpdateCurrentProfileModTime(PR_TRUE); mCurrentProfileAvailable = PR_FALSE; mCurrentProfileName.Truncate(0); +#if 0 mCurrentProfileLock.Unlock(); +#endif return NS_OK; }