Gary Haran.com


Campfire Without Getting Burned (out)

Posted in Uncategorized by gary.haran on the March 5th, 2008

At Standout Jobs we’re lucky enough to all use Campfire to coordinate. It’s especially good on a day like today where we have 20cm of snow on the ground. We can work from wherever we want and still be able to work as a team regardless of geography.

There is one problem with campfire: it can get pretty noisy. My brother offers a nice solution to let you know when Campfire message are directed at you so you can ignore them the rest of the time.

Here are instructions on how to set it up for yourself.

It assumes that you are using OS X 10.5 (Leopard), that you can edit ruby files and that a little system plumbing doesn’t scare you.

Get Growl (if you don’t already have it)

Growl is a notification system for Mac OS X: it allows applications that support Growl to send you notifications. In our case it’s exactly what we need.

Adjust Script

#!/usr/bin/ruby
# http://www.danielharan.com/2008/03/05/campfire-better-growl-notifications/

# Originally from http://forum.karppinen.fi/forums/3/topics/62
@udp_pass         = 'mypass'                        # this is any password you feel like... you will need it later
@campfire_user  = 'gary@standoutjobs.com'  # this is your campfire login 
@campfire_pass  = '321654987'                   # this is your campfire password 
@campfire_room = 'Main Room'                   # campfire room you want to track
@regexps           = [/ALL/i, /GH/Gary/i, /reception-trunk/] # adjust this to your liking

# Start of CampfireGrowler.rb
require 'rubygems'
require 'ruby-growl'
require 'tinder'

growler = Growl.new("localhost", "ruby-growl", ["ruby-growl Notification"], nil, @udp_pass)

campfire = Tinder::Campfire.new 'standoutjobs'
campfire.login @campfire_user, @campfire_pass
room = campfire.find_room_by_name @campfire_room

room.listen do |m|
  if !m.nil? && m[:message].size > 1 && @regexps.any? {|e| e =~ m[:message]}
    growler.notify "ruby-growl Notification", m[:person], m[:message]
  end
end

Save this script in a secure place. I saved mine as ~/Library/GrowlingExtras/CampfireGrowler.rb.

Set permissions

$ chmod +x ~/Library/GrowlingExtras/CampfireGrowler.rb

Download Lingon

Lingon is a graphical user interface for creating launchd configuration files for Mac OS X. We’ll use it to create a start item.

Create Your Startup Agent

- Open Lingon
- Click New
- 1) Name: com.growl.GrowlingExtras
- 2) What: /Users/#{your OS X name here}/Library/GrowlingExtras/CampfireGrowl.rb
- hit save
- restart system

Setup Growling Preferences

Go to System Preferences > Other > Growl > Network

- Enable [] Listen for incoming notifications
- Enable [] Allow remote application registration.
- type in the @udp_pass you had in your rb file: ‘mypass’

Happy Growling!

« Previous Page