Here I will descripe how to provide instant messaging via a discrete jabber server in the framework Drupal. As frontend I used a bit modified version of the web based JWChat. The backend communicates with the jabber server at database level and cares about correct registrations and buddy lists.
Please Note
Its a beta version. However it would be nice if I get a lot of feedback (especially windows user / IE) so that it doesn't stay a beta for too long.
Currently there is only ejabberd 2 support, but its scheduled to extend that. If you are a developer maybe you want to do that. Therefore check the engines subdirectory and the implementation of ejabberd.
This plugin needs access to the database used by the jabberserver.
Actually multi user chats (muc) are possible. Therefor the admins have to be hardcorded in the config file of ejabberd.
Exampleinstallation
Set up ejabberd with MySQL native driver, descriped here. Adjust the additional modules mod_last, mod_offline, mod_roster and mod_vcard as well (like he descripes at the end). If your drupal is using another DBMS you have to set up ejabberd to use that DBMS. Tipp: Here you can download debian packages for erlang mysql support.
Make sure that either HTTP-Polling or HTTP-Binding is activated in the ejabberd config. For help please consult Google or the ejabberd doc.
Configure your webserver. How to do that is descriped in the README of JWChat (quote):
Setup your web server so that it redirects some local address like http://jabber.example.com/http-poll/ to some service that either implements HTTP Polling or HTTP Binding.
Here is an example that should work with a default ejabberd installation on the same host:
Note 1: You need to enable mod_rewrite and mod_proxy at your apache configuration. Apache2 users also need to enable the protocol specific proxy module mod_proxy_http.
Note 2: With JabberHTTPBind you don't need to do this sort of address rewriting if you're serving JWChat's files from within your servlet container directly or you're using some technique like mod_jk to mount a remote servlet engine directory transparently into your apache's domain of served addresses.
Replace 127.0.0.1 with the server address of youre ejabberd.
Now the plugin comes into play. Download and extract it and copy the jabber folder into the module directory of your drupal installation.
Add the database connection to the jabber server to your settings.php
To do so you have to declare $db_url as an array. For example if your
current settings.php looks like this:
Note that the jabber server and the drupal installation have to use the same DBMS.
Enable this module by navigating to Administer > Site building > Modules.
Go to Administer > User Management > Access control, and give the permission access jabber to the roles you like (probably authenticated users).
Configure the module by going to Administer > Site configuration > Jabber server parameters. Set the options depending on your specific jabber server setup. My test configuration looks like this. Note: In most instances you cannot run the jabberserver as localhost, because your user won't be able to connect to it.
If all seems fine you should remove the module mod_register from the ejabberd configuration file. After that only the plugin is able to change passwords or registrate users.
Thats it! Surely its a bit nasty to come to this point, but at the end all efforts pay off :) If you have issues don't hestitate to leave a comment and I will help you as good as it is possible for me.