Campfire activity notifier for KDE

Campfire is a web-based chat product from 37Signals. One thing bothered me with using it as a development chat channel: I want to be notified of messages visually instead of checking for them.

Kathy Sierra once wrote an excellent post on the addiction to email-checking. The same goes for Campfire, constantly checking it for new messages can drive you insane.

Solution? Tinder.

Install Tinder and run the following ruby script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require 'rubygems'
require 'tinder'
campfire = Tinder::Campfire.new 'your_domain'
campfire.login 'your_login', 'your_password'
room = campfire.find_room_by_name 'Development'
def self.knotify title, msg
  # shows message on screen
  system "dcop knotify default notify eventname \'#{title}\' \'#{msg}\' '' '' 16 2"
  # plays alarm sound
  system "dcop knotify default notify eventname \'#{title}\' \'#{msg}\' '/usr/share/sounds/KDE_Error_2.ogg' '' 1 2"
end
room.listen do |m|
  if !m.nil? and m[:message].size > 1
    knotify(m[:person], m[:message].gsub("'",""))# knotify doesn't like this character
  end
end

Note that the script currently works for KDE only, but the knotify method could be replaced with a call to Growl for Apple users. Also, it’s best to use a login name that is already on the channel so the bot doesn’t get kicked out of the chat room after being inactive.

We’ve also used Tinder to hook Campfire up with Subversion, Trac and Capistrano.

Sweet.

Leave a Reply