From 119f224de60b714120b2064be8352ddec6f4e651 Mon Sep 17 00:00:00 2001 From: mguessan Date: Thu, 19 Mar 2009 11:40:22 +0000 Subject: [PATCH] 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 --- src/java/davmail/ldap/LdapConnection.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/java/davmail/ldap/LdapConnection.java b/src/java/davmail/ldap/LdapConnection.java index a54cdda8..3c4d5735 100644 --- a/src/java/davmail/ldap/LdapConnection.java +++ b/src/java/davmail/ldap/LdapConnection.java @@ -639,6 +639,7 @@ public class LdapConnection extends AbstractConnection { */ protected void sendPersons(int currentMessageId, String baseContext, Map> persons, Set returningAttributes) throws IOException { boolean needObjectClasses = returningAttributes.contains("objectclass") || returningAttributes.size() == 0; + boolean iCalSearch = returningAttributes.contains("apple-serviceslocator"); boolean returnAllAttributes = returningAttributes.size() == 0; for (Map 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 entry : STATIC_ATTRIBUTE_MAP.entrySet()) {