Web based vCard service

The source is for Openfire 3.6.5 / 3.7 as it uses log4j for logging. You need to compile it. The old version is available here http://www.igniterealtime.org/projects/openfire/plugins-beta.jsp

Overview

**Warning: ** This is beta software. Don’t expect everything to be implemented or to work fine. Some things may be striked as they are not implemented or yet available. If you feel the need to post a comment or feature report please use the Community Plugins forum.

This is a very basic web frontend for Openfire which allows to display vCards. It does not contain any security so everyone who has access to the server can view the vCards.

Use /plugins/webvcard/vcard?user=foo to view the vCard of user foo.

Use /plugins/webvcard/img?user=foo to view the image of user foo.

Installation

Copy the jar file into the plugins directory of your Openfire installation. The plugin will then be automatically deployed. To upgrade to a new version, copy the new jar file over the existing one.

Configuration

No web page is available at the moment. One can set these System Properties.

Properties

Name
Default
Description
plugin.webvcard.templateFileHead
./template.head.html
contains the HTML header
plugin.webvcard.templateFileFoot
./template.foot.html
contains the HTML footer
plugin.webvcard.templateFileBody
./template.body.html
contains the HTML body
plugin.webvcard.templateFileUserNotFound
./template.user.not.found.html
contains the HTML body for user-not-found
plugin.webvcard.templateFileGenericError
./template.generic.error.html
contains the HTML body for generic errors
plugin.webvcard.separatorStart
{{
Mark start of entry to replace. As it is used as a regular expression make sure to escape it properly when specifying something else like “\{\-” for “{-”.
plugin.webvcard.separatorEnd
}}
Mark end of entry to replace.
plugin.webvcard.proxyType
DIRECT
sets the proxy type if one is used, either ot HTTP os SOCKS (SOCKS not tested)
plugin.webvcard.proxyName
127.0.0.1
set the proxy server name or IP
plugin.webvcard.proxyPort
8080
set the proxy port
plugin.webvcard.proxyUsername

set a name for “Basic” proxy authentication (not tested, NTLM is not supported)
plugin.webvcard.proxyPassword

set a password for “Basic” proxy authentication (not tested, NTLM is not supported)

You may want to create your own template files which match your design. Every value within a vCard can be used in the template.body.html file. There it will be replaced with the content depending on the user.

Customization

A default example template.body.html file is stored in this directory. You need to create your own one and set plugin.vcard.templateFileBody to its location in the file system.

After changing a template file or a system property you need to reload the plugin to activate the changes.

vCard pseudo image entries

To make the creation of a vCard containing an image a little bit more easy one can use one of these pseudo values one time in the template.body.html file.

Values

Name
Meaning
/vCard/embeddedPhoto
always embeds the photo as base 64 in the html page. If EXTVAL is used within the vCard it will download the photo to embed it.
/vCard/internalPhoto
always returns a link to the VCardImageServlet.
/vCard/externalPhoto
for embedded images the VCardImageServlet is used, the URL of external images will be embedded in the vCard.
/vCard/mixedPhoto
returns an embedded or external image depending on the vCard.

VCardImageServlet

It uses the same values as the WebVCard plugin, the proxy settings and image sizes are interesting.

Logging

As every good application also here logging is available and can be configured using Log4J. The debug log is not recommended for production systems.

Help for vCard entries

You may either extract this plugin and take a look at the template.body.html file which works fine for Spark 2.0 vCards which do not comply to the XEP.

Or you may use an XMPP debugger (using Spark one must activate it before login) and open your vCard to see all entries in it. This is just a small part:

Flintstone Fred ... ... Fred ... 007 ... 666 ...

Use {{/vCard/NICKNAME}} in your template file to insert the nickname, if it does not exist nothing will be inserted.
{{/vCard/N/FAMILY}} will insert the family name.
A random telephone number may be inserted with {{/vCard/TEL/NUMBER}} but that’s not what you want. Empty tags are used above NUMBER and to select the VOICE WORK number you may use {{/vCard/TEL/VOICE/parent::TEL/WORK/parent::TEL/NUMBER}} or any other DOM4J XPath which matches this node.
An XPath Tutorial may be found here ZVON > Tutorials > XPath Tutorial.
webvCard.zip (32543 Bytes)