This code has not been touched in 3 years. I no longer use ejabberd, or erlang. Please do not use this project in production.
mod_eventful is an ejabberd module that listens for certain events, and sends the details of these via HTTP to another service. This allows internal events inside ejabberd to trigger actions on external services. There is also support for basic access authentication on the HTTP requests to help provide a simple layer of security for the actions on your external service.
- set_presence_hook: Triggered whenever a client changes their presence.
- unset_presence_hook: Triggered whenever a client goes offline.
- online_hook: Triggered when a client comes online, and there are no other clients online with the same bare jid.
- offline_hook: Triggered when a client goes offline, and there are no other clients online with the same bare jid.
- message_hook: Triggered whenever a user sends a message, either in a MUC or normally.
- ejabberd 2.1.x
Make sure that ejabberd is already installed. The build script assumes it lives at /usr/lib/ejabberd
$ git clone git://github.com/theozaurus/mod_eventful.git
$ cd mod_eventful
$ ./build.sh
$ sudo cp ebin/*.beam /usr/lib/ejabberd/ebin
Update the configuration in /etc/ejabberd/ejabberd.cfg
and restart ejabberd
%%% =======
%%% MODULES
{modules,
[
...
{mod_eventful, [
{url, [
{online_hook, "http://localhost/users/online"},
{offline_hook, "http://localhost/users/offline"},
{unset_presence_hook, undefined},
{set_presence_hook, undefined},
{message_hook, "http://localhost/messages"}
]},
{user, "HTTP BASIC USERNAME"},
{password, "HTTP BASIC PASSWORD"}]},
...
]}.