LDAP vCard Avatar v1.0.4


NOTICE: Are you looking for the latest release of the plugin? The go to its new home at http://www.eyecraft.ch/coding/ldapvcardavatar


Hi Community,

I am the developer of the LDAP vCard Avatar Plugin (see http://www.igniterealtime.org/issues/browse/JM-460). The plugin allows the users to define an avatar in their profile while using LDAP vCards. This is achieved using a “proxy” provider, which combines the functionalities of the DefaultLdapVCardProvider and LdapVCardProvider.

You may download the latest version using the following links:

  • Plugin

  • Source

Changes in this version

In this version, you don’‘t have to manually copy the plugin-ldapvcardavatar.jar into wildfires lib directory anymore. The classpath is extended at runtime to include the required jar automatically. Additionally, you don’'t have to change the vCard provider in wildfire.xml in order to use the custom provider. The provider is now automatically activated when the plugin is installed. On plugin removal, the original LdapVCardProvider is restored.

Future plans

My plans are to extend this plugin to allow the administrator to define which fields are used from the LDAP or the default DB vCard. The problem is, that vCards don’'t have a limited set of fields and other clients might use other field combinations than Spark.

In order to handle this, the administrator could define a set of fields in the admin interface using XPath expressions matching one or more elements of the vCard. When a user creates/updates his profile, the vCard is stored in the DB as is using the DefaultVCardProvider. On vCard retrieval, the generated LDAP vCard is used as a “base” vCard. Each XPath expression is then matched against the DB vCard. If one or more element matches the expression, the matched element(s) are merged into the “base” vCard according rules defined by the admin (add, replace, replace if empty etc.). When replacing, the same XPath expression could be used to select the elements in the “base” vCard which are to be replaced. Then the resulting vCard is sent to the client.

Another approach would be to use an XSLT Template but this seems to be more complicated and I am not sure if this is possible.

What do you think about this approach? Thanks in advance for any comment!

  • Hannes

Message was edited by: hannes (Changed links and title to 1.0.4, since it was a little hard to find the links below in the thread)

Message was edited by: hannes

Is this the most recent version?

Yes it is. There will be a release for Openfire soon…

I am trying to install your plugin, but I can’'t seem to get it to load on the latest version of Wildfire (3.2.4) here is the error I am getting in my errorlog.


at org.jivesoftware.wildfire.container.PluginManager$PluginMonitor.run(PluginManag er.java:920)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)

at java.util.concurrent.FutureTask.runAndReset(Unknown Source)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101 (Unknown Source)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(Unknown Source)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknow n Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

2007.04.12 16:58:57 org.jivesoftware.wildfire.container.PluginManager.loadPlugin(PluginManager.java: 466) Error loading plugin

java.lang.ClassNotFoundException: ch.eyecraft.wildfire.plugin.LdapVCardAvatarPlugin

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at org.jivesoftware.wildfire.container.PluginClassLoader.loadClass(PluginClassLoad er.java:156)

at org.jivesoftware.wildfire.container.PluginManager.loadPlugin(PluginManager.java :345)

at org.jivesoftware.wildfire.container.PluginManager.access$200(PluginManager.java :46)

at org.jivesoftware.wildfire.container.PluginManager$PluginMonitor.run(PluginManag er.java:920)


Message was edited by: iradi8

My bad, I found the problem. I was installing both the directory from the zip AND the jar file. Dinna’’ work so well. Removed the directory and then life was good. Sorry.

I can’'t seem to get an animated gif to work with the plugin when using Spark though, is that a known limitation?

If there is a limitation, it might be in spark - and not in the plugin. The plugin doesn’'t care what kind of avatar you have.

Btw, I ported the plugin (1.0.4) to Openfire: Plugin Source

  • Hannes

I was sure I had seen animated avatar in Spark when I was doing testing (before LDAP) but it appears that you are correct. The problem does seem to be in Spark.

Thanks!

I just installed this plugin, and it looks like it is working great.

I have all my users corporate photos in a shared network location. The images are all named .jpg. How do I assign the image to each users vCard without having to log in as each user?

Thanks

Hi Shimon,

This is not very easy, but if you have many users, you could create a script which creates an entry in the database table jiveVCard for every user. The table has a ‘‘user’’ and a ‘‘value’’ field. The value contains the XML vCard (http://www.xmpp.org/extensions/xep-0054.html).

Since only the avatar is used by the plugin, you could use the following minimalistic vCard:

<vCard xmlns=“vcard-temp”>

<PHOTO>

<TYPE>image/jpeg</TYPE>

<BINVAL>… Base64-Encoded Image Data … </BINVAL>

</PHOTO>

</vCard>

This question is not really related to my plugin, but I hope this helps you anyway.

  • hannes

Seems the latest version won’'t work with Openfire 3.3.0. Any update available. Are there are alternates to display LDAP user contact images …

Hi sarose

Version 1.0.4 works with Openfire 3.3.0. Why do you think it doesn’'t?

  • hannes

Excellent work! You’'ve made for some happy folks here.

Thanks its working. Will it work with 3.3.1 …! Anyone tested against this version.

Yes it works with 3.3.1. I just tested it with this version.

  • hannes

I’'m using Wildfire 3.1.1 on a Windows box and the plugin does not seem to be working. I placed the jar file in the plugins directory, but yet it does not show up as an installed plugin in the admin console. Also, you get the “Server does not support vcards” error when adding an avatar to your profile. Am I missing something?

Hi dscheck,

Do you see any error messages in the logfiles when you install the plugin?

  • hannes

There is some kind of bug I’'ve discovered!

LDAP vCard Avatar v.1.0.4

OpenFire v.3.3.1

Spark clients v.2.5.2

OpenFire server (based on Windows 2003 R2 SP1) connects to DC server (based on Windows 2003 R2 SP1), which also stores OpenFire DB in MS SQL Server 2000. Clients running Windows 2000 and Windows XP machines.

Everything seem to work smoothly, until one day a user tried to add a picture:

dog.JPG

120x90

11,5KB

After this operation the OpenFire server crashed! Other users add their avatars, but sometimes I notice that server crashes.

And there is another issue, is there some kind of configurable parameter to limit the picture size, because some users take WALLPAPERS as avatars!

Thank you for your answers!

Hi Vader

Do you see any exceptions in the error log of openfire? I’'m not sure whats wrong with dog.JPG… but the wallpapers might be the cause for the other crashes. Openfire/MSSQL uses an NTEXT field to store the vCard XML in the database. There are others having troubles with NTEXT (data truncated after 32k) but this is only speculation…

I think it would be a good idea to limit the image size (or resize). But this should be done in the offical DefaultVCardProvider and not in my plugin. Since my plugin uses the DefaultVCardProvider as vCard storage backend, this would be fixed in both the default provider and my ldap vcard provider. There is no big deal with my plugin - it just combines the functionality of the default and ldap provider. most of the work is still done by them.

But some logs would be nice anyway. Thanks!

  • hannes

This is what I have discovered in error log of OpenFire. This is the username (ponamoreva) that was causing error. Is SQL Exception what I think it is?

2007.06.08 08:07:34 [org.jivesoftware.openfire.vcard.DefaultVCardProvider.createVCard(DefaultVCardP rovider.java:113)

] Error creating vCard for username: ponamoreva

java.sql.SQLException: Violation of PRIMARY KEY constraint ‘‘JiveVCard_pk’’. Cannot insert duplicate key in object ‘‘jiveVCard’’.

Hey vader,

Do you have the full stack trace of that exception?

Thanks,

Alex