1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-11-12 04:15:08 -05:00

LDAP: improve iCal autocomplete performance: do not lookup details

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@462 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-03-19 11:40:22 +00:00
parent 69cc508651
commit 119f224de6

View File

@ -639,6 +639,7 @@ public class LdapConnection extends AbstractConnection {
*/
protected void sendPersons(int currentMessageId, String baseContext, Map<String, Map<String, String>> persons, Set<String> returningAttributes) throws IOException {
boolean needObjectClasses = returningAttributes.contains("objectclass") || returningAttributes.size() == 0;
boolean iCalSearch = returningAttributes.contains("apple-serviceslocator");
boolean returnAllAttributes = returningAttributes.size() == 0;
for (Map<String, String> person : persons.values()) {
boolean needDetails = returnAllAttributes;
@ -650,6 +651,10 @@ public class LdapConnection extends AbstractConnection {
}
}
}
// iCal search, do not lookup details
if (iCalSearch) {
needDetails = false;
}
// add detailed information
if (needDetails) {
@ -671,6 +676,11 @@ public class LdapConnection extends AbstractConnection {
ldapPerson.put(ldapAttribute, value);
}
}
// iCal: copy cn to sn
if (iCalSearch && ldapPerson.get("cn") != null) {
ldapPerson.put("sn", ldapPerson.get("cn"));
}
// Process all attributes which have static mappings
for (Map.Entry<String, String> entry : STATIC_ATTRIBUTE_MAP.entrySet()) {