jrvaja / mod_eventful

An ejabberd module that will turn events into HTTP requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description

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.

Events supported

  • 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.

Supports

  • ejabberd 2.1.x

Installation

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

Example Configuration

%%%   =======
%%%   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"}]},
  ...
]}.

TODO

  • Add support for more events
  • Add support for other protocols (AMQP,...)

About

An ejabberd module that will turn events into HTTP requests

License:MIT License