irssi and camper_van

Recently I’ve come across a ruby irc server called camper_van. What it does is pretty simple: it communicates with Campfire while acting as an IRC server. That, combined with irssi makes it much more fun to use Campfire for work.

The following is a simple script that starts the server (if not already running) and then opens up irssi in a new gnome-terminal session.

#! /usr/bin/env sh
RUBY_VERSION="1.9.1"
SERVER="${HOME}/.gem/ruby/${RUBY_VERSION}/bin/camper_van"
PIDFILE="/tmp/camper_van.pid"
if [ ! -e ${SERVER} ]; then
echo "CamperVan server not found at '${SERVER}'."
fi
function start_server {
echo "CamperVan server not running, starting it now."
"${SERVER}" &
echo $! >${PIDFILE}
sleep 2
}
if [ ! -e ${PIDFILE} ]; then
start_server
else
pid=`cat ${PIDFILE}`
if [ ! -e /proc/$pid -a /proc/$pid/exe ]; then
start_server
fi
fi
gnome-terminal -e irssi
view raw campervan hosted with ❤ by GitHub

The second file is an example irssi config file (merge it with ~/.irssi/config).

servers = (
{
address = "127.0.0.1";
chatnet = "Campfire";
port = "6667";
autoconnect = "true";
password = "subdomain:token";
}
);
chatnets = {
Campfire = { type = "IRC"; };
};
channels = (
{ name = "#roomname"; chatnet = "Campfire"; autojoin = "yes"; }
);
view raw irssi-config.pl hosted with ❤ by GitHub