Bug 287832 Clean up nsDirPrefs.cpp. Part 2 - stop LDAP Change log using old nsDirPrefs attribute map stuff r/sr=dmose

This commit is contained in:
bugzilla%standard8.demon.co.uk 2006-01-02 20:38:57 +00:00
Родитель e51d40d2cb
Коммит 4ffe607f1c
1 изменённых файлов: 16 добавлений и 9 удалений

Просмотреть файл

@ -121,15 +121,20 @@ NS_IMETHODIMP nsAbLDAPChangeLogQuery::QueryAuthDN(const nsACString & aValueUsedT
if(!mInitialized)
return NS_ERROR_NOT_INITIALIZED;
nsresult rv = NS_OK;
nsresult rv = NS_OK;
nsCOMPtr<nsIAbLDAPAttributeMapService> mapSvc =
do_GetService("@mozilla.org/addressbook/ldap-attribute-map-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAbLDAPAttributeMap> attrMap;
rv = mapSvc->GetMapForPrefBranch(nsDependentCString(mDirServer->prefName), getter_AddRefs(attrMap));
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString filter;
rv = attrMap->GetFirstAttribute(NS_LITERAL_CSTRING("PrimaryEmail"), filter);
NS_ENSURE_SUCCESS(rv, rv);
CharPtrArrayGuard attributes;
*attributes.GetSizeAddr() = 2;
*attributes.GetArrayAddr() = NS_STATIC_CAST(char **, nsMemory::Alloc((*attributes.GetSizeAddr()) * sizeof(char *)));
attributes.GetArray()[0] = ToNewCString(nsDependentCString(DIR_GetFirstAttributeString(mDirServer, cn)));
attributes.GetArray()[1] = nsnull;
nsCAutoString filter(DIR_GetFirstAttributeString(mDirServer, auth));
filter += '=';
filter += aValueUsedToFindDn;
@ -141,8 +146,10 @@ NS_IMETHODIMP nsAbLDAPChangeLogQuery::QueryAuthDN(const nsACString & aValueUsedT
rv = CreateNewLDAPOperation();
NS_ENSURE_SUCCESS(rv, rv);
// XXX We really should be using LDAP_NO_ATTRS here once its exposed via
// the XPCOM layer of the directory code.
return mOperation->SearchExt(dn, nsILDAPURL::SCOPE_SUBTREE, filter,
attributes.GetSize(), attributes.GetArray(),
0, nsnull,
0, 0);
}