Archive for June, 2009

The documentation and examples for Process One’s just released EXMPP library is very lacking. Not to fault them, it was just released a couple days ago. So here I’ll describe how I used EXMPP for working with a multi-user chat system. Obviously you need to have your Jabber server setup for muc. Uncomment the mod_muc stuff in your ejabberd config if you are using that. I have mine set to use conference.localhost.

First, you can look in echo_client.erl that is provided with the source to see how to setup a connection to your Jabber server. The key pieces that are a pain to figure out are the records for connecting to a room and for creating a message.

Below is a function for creating the record to send that will move your user to the specified room:

-define (MUC, <<"http://jabber.org/protocol/muc">>).
-define (JABBER_HOST, "localhost").
-define (JABBER_MUC_HOST, "conference.localhost").
-define (JABBER_PORT, 5222).

create_move_room (Room, Username) ->
  #xmlel {name=presence, attrs=[#xmlattr{name=to,
          children=[#xmlel{name=x, attrs=[#xmlattr{name=xmlns, value=?MUC}]}]}.

exmpp_session:send_packet(Session, create_move_room (Room, Username)),

Now that we are in a room we can start sending messages to the people there:

create_message (Room, Message) ->
  #xmlel {name=message, attrs=[#xmlattr{name=to,
          #xmlattr{name=type, value=list_to_binary("groupchat")}],

exmpp_session:send_packet(Session, create_message(To, Msg)),

Not much too it. I was just annoyed trying to figure out their records for XML but they turned out be very easy as well. Its great to have a complete and well done Erlang Jabber library at last.


Read Full Post »

I’m going to be writing some articles on Free software and media to hopefully get published. I was wondering if people in the Chicago GNU/Linux Users Group, or other Free software lovers who find this, could give me their ideas regarding Free software and socialism (Marxist not Euro-style). Or opposted views, comparing Free software and media to liberatiarianism or individual anarchism.

Read Full Post »