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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
The second file is an example irssi config file (merge it with
~/.irssi/config
).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; } | |
); |