fix for #124022. improve LDAP addressbook performance by only asking

the server for the attributes that we can handle,
to reduce network traffic.  r=dmose,sr=bienvenu,a=shaver
This commit is contained in:
sspitzer%netscape.com 2002-03-12 05:37:21 +00:00
Родитель 69b1b826f6
Коммит 0c0a6a4e75
3 изменённых файлов: 15 добавлений и 2 удалений

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

@ -680,7 +680,8 @@ nsresult nsAbLDAPDirectoryQuery::getLdapReturnAttributes (
// Meta property
// require all attributes
//
returnAttributes = "";
rv = MozillaLdapPropertyRelator::GetAllSupportedLDAPAttributes(returnAttributes);
NS_ASSERTION(NS_SUCCEEDED(rv), "GetAllSupportedLDAPAttributes failed");
break;
}

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

@ -198,6 +198,18 @@ void MozillaLdapPropertyRelator::Initialize(void)
IsInitialized = PR_TRUE;
}
nsresult MozillaLdapPropertyRelator::GetAllSupportedLDAPAttributes(nsCString &aResult)
{
if (tableSize < 1)
return NS_ERROR_UNEXPECTED;
for (int i = tableSize - 1 ; i != 0 ; i--)
aResult += nsDependentCString(table[i].ldapProperty) + NS_LITERAL_CSTRING(",");
aResult += table[0].ldapProperty;
return NS_OK;
}
const MozillaLdapPropertyRelation* MozillaLdapPropertyRelator::findMozillaPropertyFromLdap (const char* ldapProperty)
{
Initialize();

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

@ -75,7 +75,7 @@ public:
static const MozillaLdapPropertyRelation* findMozillaPropertyFromLdap (const char* ldapProperty);
static const MozillaLdapPropertyRelation* findLdapPropertyFromMozilla (const char* mozillaProperty);
static void Initialize(void);
static nsresult GetAllSupportedLDAPAttributes(nsCString &aResult);
static nsresult createCardPropertyFromLDAPMessage (nsILDAPMessage* message,
nsIAbCard* card,
PRBool* hasSetCardProperty);