intertwingly

It’s just data

XHTML-IM over TLS via Erlang


jabberdemo.erl constructs and sends an XHTML-IM message over TLS using xmerl and Erlang.  Tested with gaim and ejabberd.

The creation of the Session data structure is the bulk of the code.  xmerl:export_simple and ssl:send pretty much take care of all the rest.

A small utility function named export_text exports just the text nodes from an XHTML data structure, which is sent as a fallback to non-XHTML-IM aware clients.  Of course, xmerl supports more patterns, but for the moment, this is enough for my purposes.

Longer term, this needs to be split up into a module which spawns threads and exports separate interfaces for things like authenticating, sending messages to a server, and registering callbacks for presence changes.