I keep forgetting how to setup the mod_webpresence for ejabberd whenever I happen to reinstall everything so I am typing it out here for future reference and maybe it’ll even be useful for others. The instructions aren’t 100% clear for me on the ejabberd-contrib github page since I have always had issues figuring it out. Hopefully these instructions will save some time in the future.
First I have to remove the existing erlang-kernel and all it’s packages and update to a new version of Erlang. I actually don’t know if this is necessary anymore but I update Erlang to the latest version since it was necessary in the past in order to properly be able to build the module.
yum remove erlang-kernel
Then I download latest Erlang package and install it instead. They have a bunch of operating systems including Ubuntu, CentOS, Fedora, Debian, Mac OS X and Windows.
wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_17.3-1~centos~6_amd64.rpm yum localinstall esl-erlang_17.3-1~centos~6_amd64.rpm
From the ejabberd-contrib repository I upload to my ejabberd/lib folder the ejabberd-dev module and the mod_webpresence module. You can do this numerous ways. I simply download or clone the git repository and upload or move those module’s folders to the ejabberd/lib folder.
Then I go into the mod_webpresence folder, make the build.sh executable and run it.
chmod +x build.sh && ./build.sh
The output shouldn’t have any errors or unfortunately something else is wrong. It should create a beam file in the ebin folder and say something like: Recompile: src/mod_webpresence
Next I copy the ejabberd/lib/mod_webpresence/ebin/mod_webpresence.beam file to ejabberd/lib/ejabberd-14.07/ebin/mod_webpresence.beam
Edit the ejabberd/conf/ejabberd.yml file and add the parts to the appropriate sections as shown below.
This part goes under the port: 5280 listen section or whatever port you are running the ejabberd_http module on that you want to serve the mod_webpresence from.
request_handlers: "presence": mod_webpresence
For example mine looks like this:
- port: 5280 module: ejabberd_http http_poll: false http_bind: true captcha: true request_handlers: "presence": mod_webpresence
And this part goes down where all the other modules are defined. Make sure you update the /PATH/TO/ejabberd
mod_webpresence: pixmaps_path: "/PATH/TO/ejabberd/lib/mod_webpresence/data/pixmaps/" baseurl: "http://@HOST@/presence/" access: local
Restart ejabberd and that should hopefully work out. If the ejabberd server doesn’t start then you probably should check the logs and see if you can see what’s wrong. If something is wrong then that really sucks! Especially if you don’t know much about Erlang. You will probably have to do some digging and try to figure it out.
If the server started fine and there are no errors in the logs then now you have to use a jabber client (I used Miranda NG) and login as the user you want to see the presence of. Access the Service Discovery under your jabber connection Services and Register with the webpresence service.
Once you do that it should send you a message telling you some examples and so forth like this:
Subject: Web Presence: registered You have registered: email@example.com Use URLs like: http://@HOST@/presence/USERID/OUTPUT/ USERID: jid/username/jabber.example.com OUTPUT: xml Example: http://@HOST@/presence/jid/username/jabber.example.com/image/
If all is well then you should now be able to find or write your own app to detect and display your online presence. I ended up using the xml URL like this: jabber.example.com:5280/presence/jid/username/jabber.example.com/xml