XMPP notices: a workaround for Drupal 5 (and how to install Openfire 3.6.3 in Ubuntu 8.10)

Since I got my self-hosted Ubuntu lamp server up and running some while back, I have made it my personal mission to find out exactly what she can do. "Why in the world would you want to run a home server?" is the question I sought to answer for myself, and sought to do so in such a way that any novice could benefit from what nifty things I did find. In this, I tinker with new (new to me) technologies, and see if any inherent level of novelty outweighs any technical level of brain hurt.

The first thing I installed was Drupal, which you can do with apt or synaptic, and it has become the bedrock and center of everything I do on this server. I love to find new ways to interact with my site, new ways to get the site to perform and interact with users, and generally any neat trick I can come up with that has functionality. Every time I discover a new technology, I see if there is a way to integrate it into my Drupal setup, integration is a wonderful thing.

  • I can publish to Drupal from my Ubuntu desktop using drivel.
  • I can further integrate my Ubuntu desktop with Drupal using Evolution and the excellent calendar module.
  • My Tweets and/or Dents go to my Drupal installation via a custom block I got from Twitter
    • And my Drupal installation can talk to my identi.ca account when I post new content via a small rewrite of the twitter module for drupal.
  • I aggregate interesting news feeds I discover from my Tiny Tiny RSS installation with the core module "aggregator".
  • I integrate my Gallery2 online picture gallery with drupal using a great module for the job, and I can publish pictures into that Gallery from my Ubuntu desktop using the excellent F-Spot photo manager
    • I can take a picture, plug in my camera to my Ubuntu desktop, and that picture goes right into my Drupal, via Gallery, via F-spot...one click!

Get the picture? I am a geek for integrations between Drupal and my Ubuntu desktop, and between separate services I run on my Ubuntu server and Drupal. I am, in my way, attempting to make a nice transparent portal from my Ubuntu desktop to the internet via Drupal, and vise-versa.

So, in this ongoing effort to self-host and experiment with different technologies I recently decided to install and run with the Openfire Jabber/XMPP server, and see if I could get Drupal and Jabber to play nice together, showing up on my Ubuntu desktop via Pidgin. Installing Openfire on a stock Ubuntu 8.10 server with LAMP and PHPmyAdmin was pretty simple:

Installing The Openfire XMPP/Jabber Server On Ubuntu 8.10

  • Gain server access: ssh into your server (I use ssh for remote administration). If you use your desktop as your server (which I did for some time), then just open your terminal.
  • We need to install Java. In the terminal type in
    sudo apt-get install sun-jave6-bin

  • We need a databse for Openfire to store it's information. Using PHPmyAdmin (or your method of choice) create an empty MySql database granting a user by the same name all permissions on that database.
  • Now we're ready for Openfire: Input these lines in your terminal in this order, one at a time:

    cd /opt

    sudo wget http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_3_6_3.tar.gz

    mv downloadServlet\?filename\=openfire%2Fopenfire_3_6_3.tar.gz openfire_3_6_3.tar.gz

    sudo tar zxvf openfire_3_6_3.tar.gz

    sudo ln -s /opt/openfire/bin/openfire /etc/init.d/

    sudo chmod +x /etc/init.d/openfire

    sudo update-rc.d openfire defaults

    cd /opt/openfire

    sudo nohup ls >ls.log 2>&1 &

  • Open a hole in your firewall for port 9090, and browse to
    https://your.domain.com:9090/

    You may have to click the file

    install.php

    Follow the instructions and answer the questions, and it's good. You can fine tune your preferences in the web-based admin interface, and configure Pidgin, or your Jabber client of choice, to use the new name and address for your spanking new and unique Jabber account and chat away.

Congrats, you now host a Jabber server!

I got this far and went investigating for solutions on getting Drupal to interact with XMPP, how awesome would that be? VERY! Well, the problem is: there is no working solution for D5 and I'm still waiting for the critical modules I use to be ported to the latest Drupal (or find time to port them myself), until then, I'm with Drupal 5, and it's modules. There is an XMPP API module, but it requires a library that is apparently no longer available. There are plenty of XMPP modules for D6, and nice ones to boot; but this does not help me out at all. I want a solution now.

I wanted some way to have Drupal interact with Jabber, and communicate with me on my Ubuntu desktop via Pidgin. Well, it looks like necessity looses its place to pure geek-driven-novelty as the mother of invention.

XMPP Notices workaround for Drupal 5

  • Create some new accounts
    • Create a "bot" account on your jabber server (optional, you could use ANY existing Jabber account)
    • Create an Identi.ca account for your new bot! I suggest using a separate account than one you may already have. It would actually be even better to use your own installation of laconica for this. But since this is temporary, I believe it will be ok. Go into bot's Identi.ca settings and generate an email for posting to Identi.ca via sms. Also turn on XMPP updates here, using the jabber account you just created.
    • Create a "bot" account in drupal, using the email address you just created at Identi.ca.
  • Go grab yourself the Notify module (currently 5.x-1.2), unzip it into your modules folder in Drupal, keeping a backup.
  • In your favorite text editor, open up the notify.module file. I suggest using nano for this
    sudo nano /path/to/your/drupal/modules/notify/notify.module

    and go to line 467, and change this from

    $body = t('Greetings !user,', array('!user' => $user->name)) ."\n\n". $body;

    to

    $body = t('There is something going on at http://yoursite.com,', array('!user' => $user->name)) ."\n\n". $body;

    Changing the address to your actual site. You can customize this message as well. Just keep it less than 140 characters, and if you have a multi-user site and plan on allowing others to use the notify module, you will want to keep it relative.
    Save the file.

  • Now enable the module, and set it up (look in the module's readme.txt file if you need help)
  • Go to bot's account settings in Drupal and enable notification settings accordingly! Just turn on any notification here that you want XMPP messages for!
  • Add the bot's jabber account to your Pidgin setup.

Sweet! Now whenever someone creates new content, or comments on your Drupal site, you will get a handy little XMPP message telling you that

Something is going on at http://yoursite.com!

This Setup also allows you to follow the identi.ca user "bot" that you created, and you can, optionally, receive these updates via Gwibber, or some similar client.

This may seem complex, but all we did was:

  • Install and configure Openfire
  • Create 3 accounts for a "bot"
    • An Openfire, or other Jaber account
    • An Idneti.ca, or other laconica account
    • A Drupal account
  • Install and edit one line in a Drupal module, and configure it's settings

And with that you can post to your Drupal based blog via Drivel, and know when someone else comments on it via Pidgin, all right from your Ubuntu desktop! It does not get easier or more convenient than that.

If you have any questions, suggestions or other comments, please do leave them here.

Trackback URL for this post:

http://nousessence.com/trackback/1265
joshp's picture

Simple SparkWeb how-to

Need a nice web based jabber client? Try SparkWeb, it's by Ignite Realtime as well, and seems nice enough.

Just

  • Download the file from here and unzip it into your web directory. /var/www/sparkweb/ on a default apache installation.
  • Download the updated sparkweb.swf file from here and replace the one in your Sparkweb folder.
  • Rename the sparkweb.html file to index.htlm and open it in a text editor.
  • On line 32 enter in your server name. server: "example.com", You can use localhost here if your Openfire server is on the same machine.
  • On line 36 add this policyFileURL: "xmlsocket://example.com:5229" being sure to change example.com with your own domain.
  • Save and exit the file, open up port 5229 in your firewall, and point your web browser to http://example.com/sparkweb and log in!

More details for installation and configuration can be found here, and here.

joshp's picture

One more workaround...

If you can give your bot an actual email account, another way to set this up with OpenFire is to get the "email listener" plugin for OpenFire, and have it listen to email sent to your bot's actual email address (bot@yourdomain.com), and set up the bot's email address in Drupal to be this, instead of the identi.ca account. Have the email listener plugin send you a message via jabber whenever bot gets an email, and you have the same effect, but without the 140 Character limit. This method actually gives you the entire email right in the XMPP message. Neat.
Anonymous's picture

This method actually gives

This method actually gives you the entire email right in the XMPP message. Neat. avatar

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You may link to Gallery2 items on this site using a special syntax.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.

Send this page to a friend

Thank you for spreading the word!

Mollom stats

Mollom has blocked 5953 form submissions to this site in the last 1 year 9 weeks. That’s an average of 13.7 a day.