mod_msg_filter - block/allow message delivery over HTTP for ejabberd
One of the requirements we have for our chat service where I work is the ability to decide whether users are allowed to chat based on business logic that we execute in our permission system. This means that we need to ask the permissions system every time people start to exchange messages. To that effect we’ve implemented mod_msg_filter and figured we’d share it in case anyone else on the list has similar use cases.
Here’s the blurb:
mod_msg_filter allows the filtering of “message” stanzas across an HTTP service. The URL of the service must be passed as part of the module’’s configuration. Both JIDs and their resources are passed as part of the query string and the result is expected to be one of:
or:
The values of the
{bare_jid1, bare_jid2, resource1, resource2} {bare_jid2, bare_jid1, resource2, resource1}
The
The mnesia cache can be flushed if the ejabberd server is hit on a request handler that maps to this module (for example: /mod_msg_filter/). A stanza must be POSTed that looks like: