ejabberd: message archive management (XEP-0313)

by Gregor Uhlenheuer on February 23, 2014

Lately programming with erlang fascinates me a lot. Specifically hacking the XMPP server ejabberd draws my interest the most. So I started implementing the message archive management XMPP extension described in the experimental XEP-0313 specification.

ejabberd message archiving

ejabberd already supports some message archiving out-of-the-box by the mod_archive module that is part of the ejabberd community scripts repository. That module implements the XEP-0136 specification and supports storage via mnesia, PostgreSQL, MySQL or sqlite.

For my approach I chose to implement the XEP-0313 standard instead because it is known to be less complicated and therefore easier to implement by clients, as stated by the specification:

“This specification aims to define a much simpler and modular protocol for working with a server-side message store. Through this it is hoped to boost implementation and deployment of archiving in XMPP.”

Moreover I plan to use the MongoDB database as storage engine.

ejabberd-mod-mam

You can find the latest version of mod-mam on github. The module targets the current master branch of ejabberd which is the so called “community edition”.

The latest version of mod-mam supports:

The following points are on my TODO list:

Configuration

In order to use mod-mam you have to add it to the modules section in your ejabberd.cfg. This could look like this:

MongoDB content

Just to give a short impression on how the content is stored, this is what an archived message looks like inside the MongoDB collection:

Example archive query

An examplary archive query conversion between client and server would look like the following. At first the client queries for its last two messages (limited by a RSM instruction):

The server responds with the two requested messages:

Finally the server finishes the interaction with the closing <id> stanza:

Feedback

As mod-mam is still in early beta phase any feedback, bug reports or contributions are very much appreciated. Either contact me directly or better head over to the issues on github and open a bug report or pull request.

References

This post is tagged with programming, erlang, ejabberd, archive and module