Campfire In Jabber/IRC/irssi


DO NOT USE THIS!!!

I made Arson, it is a much
improved Campfire<->Jabber gateway that uses actual multi-user chat
and doesn't require hacking irssi or anything. Please use that
instead.

OBSOLETE; SEE ABOVE

OBSOLETE; SEE ABOVE

OBSOLETE; SEE ABOVE


Campfire is a web-based chat service that
people seem to like lately, for reasons I'm honestly not clear on.
I guess it's because it has persistence? But I've had chat
persistence for more than a decade;
GNU Screen or
tmux, plus a decent IRC client (I
happen to use irssi), and that's it: chat
persistence, woo.

But anyways, people seem to like Campfire,
and they make me use it. Like, it's an actual job requirement.

I really can't stand having chat outside of screen/tmux, let alone
in a web browser. Time-sensitive things I rely on do not belong
in a web browser, they belong in my terminal. Sorry, it's just a
religious thing.

So, this time I decided to do something about it. What I came up
with is ... quite a horrible hack, honestly, but it works really
well so far.

There are three segments here, with the result of having a fully
working setup in irssi that feels like a proper chat client. First,
a campfire/jabber gateway in Ruby; this turns each campfire room
into messages from a single jabber user, with the name of the
camfire user prepended to the messages. Second,
bitlbee, which is an IRC server that
connects to various chat protocols, including jabber, and translates
between the two. Third, irssi scripts to make everything behave
properly, since having a bunch of virtual users all sending private
messages from a single real user is not something irssi is prepared
to handle.

Campfire To/From Jabber


This is a very simply/hacky/kludgy system. What you do is you set
up your own jabber server, ideally on the same server as the script.
I've used ejabberd, which was very easy to
get working.

Once you've done that, create users for each campfire room, like so
in ejabberd:

sudo /usr/sbin/ejabberdctl register ey-cf-support localhost password


Then you'll have to modify the config in
the ruby script itself, which I'll explain in a minute
(here's the browser viewable version).
The script is based on
camper.rb, but I can't
get it (or anything else based on
tinder ) to work
at all, so I modified it to use
Broach. Umm, such as it is;
it's pretty light so far, had to do some stuff by hand.

Besides Broach, you'll need Jabber::Simple, Daemons, and the pointlessly redundantly named yajl-ruby.

For the script, change all the parts between "# BEGIN CHANGE SECTION" and "# END CHANGE SECTION". It needs your Campfire API Token, and information about your campfire rooms and what you want to do with the messages in them.

It uses Daemons, which means you run it like "ruby campfire_jabber_hack.rb start" or similar. Run just "ruby campfire_jabber_hack.rb" to get options. It does some limited logging to campfire_jabber_hack.output (and, for reasons I don't understand, camfire_jabber_hack.log on shutdown/signal) in the directory the script lives in. This is also where the PID files go.

Don't bother adding the jabber users in whatever jabber system you use; as soon as they log in they'll ask you for permission to send.

If you only need Campfire<->Jabber, stop there.

Jabber To/From IRC


I use bitlbee to connect my irc client to jabber. It has plenty of documentation on its own; I'll let it speak for itself.

Making Irssi Deal With The Results


The result here is something that irssi doesn't deal with well: a bunch of fake users coming from one user as privmsgs.

It looks bad, it highlights and beeps on every message, and tab completion doesn't work.

So, here's an irssi script to handle this hack (and [http://teddyb.org/~rlpowell/hobbies/software/campfire_jabber_hack/campfire_jabber_irssi.pl.txt|here you can see it in your browser).

Put it in ~/.irssi/scripts/autorun/. If you don't want to restart irssi, run "/load ~/.irssi/scripts/autorun/campfire_jabber_irssi.pl".

To use it, put a space-seperated list of users into the
campfire_hack_nicks setting, like so:

/set campfire_hack_nicks ey-cf-support ey-cf-sysadmin


See the script itself for details of what it does, but at that point you should be able to /query each campfire user, and everything should Just Work.