зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
69b1b826f6
Коммит
0c0a6a4e75
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче