powered by Jive Software

jpegPhoto for ldap vCard provider

Hi!

LDAP vCard provider in its current state does not map any binary data such as jpegPhoto. Here is quick and dirty workaround - only for jpegPhoto attribute.

— src/java/org/jivesoftware/wildfire/ldap/LdapVCardProvider.java Sat Feb 11 14:29:16 2006

+++ src/java/org/jivesoftware/wildfire/ldap/LdapVCardProvider.java.new Sat Feb 11 15:15:19 2006

@@ -31,6 +31,8 @@

import org.jivesoftware.util.NotFoundException;

import org.xmpp.packet.JID;

+import org.jivesoftware.whack.util.StringUtils;

/**

  • Read-only LDAP provider for vCards.Configuration consists of adding a provider:

@@ -144,7 +146,12 @@

value = “”;

}

else {

  •                value = (String) attrs.get(attribute).get();
    
  •               if(attribute.compareToIgnoreCase("jpegPhoto") == 0) {
    
  •                   value = (String) StringUtils.encodeBase64((byte[]) attrs.get(attribute).get());
    
  •               }
    
  •               else {
    
  •                   value = (String) attrs.get(attribute).get();
    
  •               }
    

}

Log.debug(“Ldap attribute ‘’” + attribute + “’’=>’’” + value + “’’”);

map.put(attribute, value);

/code