Wednesday, July 9, 2014

Hipchat + Bitlbee + Irssi

I use irssi for open source. I use hipchat for work. It's pretty obvious that they should be combined.

There are a number of posts around the internet covering how to do this but I will throw my hat into the ring. Suffice to say, I'm standing on the shoulders of giants.

I use Centos 6 as my jump host. After a lot of head scratching I eventually discovered that the version of bitlbee in centos/epel is too old to work correctly. I thus had to compile my own. Yippie. Why aren't we just using FreeBSD again?

 ./configure --prefix=$HOME/local --ssl=openssl

Architecture: Linux

Configuration done:
  Debugging disabled.
  Building PIE executable
  Binary stripping enabled.
  Off-the-Record (OTR) Messaging disabled.
  systemd disabled.
  Using event handler: glib
  Using SSL library: openssl
  Building with these protocols: msn jabber oscar yahoo twitter

After  make and make install the software is installed in my home directory. Bitlbee installs to $PREFIX/sbin so be sure that is in your $PATH.

We can now fire up bitlbee:


[nibz@destiny]~% mkdir ~/.config/bitlbee
[nibz@destiny]~% bitlbee  -D -i 127.0.0.1 -p 2121 -d /home/nibz/.config/bitlbee
Warning: Unable to read configuration file `/home/nibz/local/etc/bitlbee/bitlbee.conf'.


Despite this troubling error bitlbee is running correctly:

[nibz@destiny]~% ps -ef | grep bitlbee                                        
nibz     31276     1  0 00:07 ?        00:00:00 bitlbee -D -i 127.0.0.1 -p 2121 -d /home/nibz/.config/bitlbee
nibz     31386  9444  0 00:07 pts/20   00:00:00 grep bitlbee

With this up we have bitlbee listening on localhost port 2121. Connect to this with your favorite irc client, I use irssi.
  
/server add -auto -network hipchat 127.0.0.1 2121
/connect 127.0.0.1
Now you must join the bitlbee control channel and proceed to do the quickstart tutorial stuff. Choose a very secure password because anyone able to connect to the bitlbee socket can attempt to log into your account. As far as I know there is no rate limiting.


/join bitlbee
help quickstart
help quickstart2

Next we follow the instructions here, here, here and here. Don't worry. I have my set below. You'll need more than just your hipchat credentials. You need to get your hipchat metadata from here. I'm not sure what the security status of that information is, but I've gone ahead and anonamized mine.


On the jabber xmpp settings page of your hipchat account, there is a 'username', a 'jabber id', and a 'conference (muc) domain'.

My username is of the format 8489_938318@chat.hipchat.com.

The first before the underscore, 8489, is your organization id. The second number is essentially your number.

Users on your domain will look like <Bob Dole> 8489_38239@chat.hipchat.com.

Channels/Rooms will look like #ScienceLab 8489_ScienceLab@conf.hipchat.com.

Notice that the channels are suffixed by the 'conf.hipchat.com' and the users are suffixed by 'chat.hipchat.com'. I believe this corresponds to the 'conference (mux) domain.'

Anyhoo this is how you connect:





account add jabber 8489_384193@chat.hipchat.com
account jabber set tag hipchat
account hipchat set nick_source full_name
account hipchat set resource bot

Now you have to feed it your password. Use the /oper command on your irc client, as if you were assuming irc network operator privileges. This will prompt you for your password, and your password will not be echoed to you. I do not know to what extent the password is encrypted on disk.

Now connect to the network:


account hipchat on

You'll see a long list of 'people' join. I think this is everyone in your domain. I think this is also the place where you private message people. As in, any messages coming to you in this domain channel are private messages from the person sending it and any messages you send are messages you send privately.




Now join your channel and set your nick to present as your real name to appease the gods.

chat add hipchat 8489_ScienceLab@conf.hipchat.com #ScienceLab
channel #ScienceLab set nick 'James Kirk'
/join #ScienceLab



And just like that. Boom. Hipchat through Irssi.



 

No comments:

Post a Comment