Pipe Event Plugin for Adium

Back when I used OpenBSD on my laptop and Pidgin for instant messaging, I wrote a D-Bus script to watch incoming messages and forward any to my cell phone that were received while my screen was locked. The script forwarded messages to Prowl's web API, which would forward them to my iPhone using push notifications.

The last time I switched back to a Mac desktop, I had to switch back to Adium and lost the ability to selectively forward messages. While Adium does have an event action to run an AppleScript, there's no way of passing the actual event text to the script, so it has to talk back to Adium and try to find the newest message. The only option was to generate Growl notifications for all messages and then configure Growl to forward them to Prowl. I got fed up with that pretty quickly, so I modified Adium to create a new event type for "messages received while away". That way I could have the Growl notification only on that event, so I would only get messages forwarded while away. That worked better, but it prevented me from being able to go away while still at my computer without getting a bunch of messages queued up on my phone.

After that I switched back to OpenBSD, so I was back to my D-Bus script. Then I switched back to an Android phone so I couldn't use Prowl and had to forward messages to my phone through T-Mobile's e-mail-to-SMS gateway. I recently switched back to a Mac so now I'm back to Adium with no easy way of forwarding messages to Android.

I spent a few hours this evening writing an Adium plugin that can execute an arbitrary command and pipe the event text to it. Now I can have a script receive every incoming message but only forward them when the screen is locked or some other condition. Once Notifo finally comes out with their Android client, I'll be able to make it forward messages using their web API.


  1. Click the "Install" link on the plugin's Adium Xtras page. Adium should notify you that the plugin has been installed and you may have to restart Adium.
  2. In Adium's Preferences, choose Events. You can also create a per-contact alert by double-clicking on a contact and clicking the Events icon.
  3. Click an event, such as "Message received", and click the [+] button. Select "Pipe event to command". Enter the full path to your command and hit OK.
screenshot of adium preferences window

The command is executed every time the event triggers (like when a message is received), has its STDOUT and STDERR closed, and then has the full content of the event/message written to its STDIN (for easier scripting, the event/message has a trailing newline appended). The title of the event is passed to the command as its first argument (for received messages, this is the name of the sender).

A simple ruby script that will write every received message to a file:

File.open("#{ENV["HOME"]}/adium.log", "a+") do |f|
  f.puts "#{Time.now}: from #{ARGV[0]} - #{STDIN.read.strip}"

Note: make sure the command is executable (chmod +x).

The BSD-licensed source code is on github.

Questions or comments?
Please feel free to contact me.