So I've been playing around with some more of this new-fangled "desktop integration" stuff. Pretty crazy.

portland street

Recently the ever-useful gaim project was renamed to pidgin. The new release is quite nice, but several plugins haven't really been ported over yet. On top of that, the notification plugin has some serious problems on 64-bit machines. How troublesome! Of course, you can always scratch your itches by writing plugins in Python or C, but then you have to use Python or C.

Well it turns out if you take advantage of dbus, the whole plugin architecture with its limited language support becomes a bit of a non-issue. The ruby-dbus project helps out here admirably. I should note that there's a proliferation of projects purporting to allow dbus usage from within Ruby, but this one seemed the most mature and active. I was also very impressed by the quick response on the mailing list I got from the developers when I found a problem.

  def watch_status
    @purple.on_signal("AccountStatusChanged") do |account,  old,  new|
        TwitterClient.update(current_message) unless current_message == ''
      rescue Twitter: : RESTError => re
        puts re

  def notify_messages
    @purple.on_signal("ReceivedImMsg") do |account,  user,  message|
      message.gsub!(/\<[^\>]*\>/,  '') # jabber messages have unnecessary XML
      user = user.split(/\//).first # get rid of jabber resource part
      Notify.send(: message => message,  : title => "#{user} says: ", 
                  : seconds => 5, 
                  : icon => (File.expand_path("~/.purple/icons/") + '/'
                            + @buddy_icons[user] if @buddy_icons[user]))
      sleep 0.2

So far it does a few things:

Not what you'd call exciting, but the point is it's written in Ruby and thus easily extensible by myself. Instant messaging has been the lone holdout in terms of the daily tasks that I was unable to automate and tie into programmatically, so it's good to see that taken care of.

Code is in Trac as usual.

« older | 2007-10-13T07:00:01Z | newer »