The Hidden Blog

As it turns out, I do have a hostname.

Use Google Hangouts via Bitlbee / IRC

Published on September 24, 2016

As someone who hates Google Hangouts with a passion it took me surprisingly long to look into a way to use it via an IRC bridge to get rid of the annoying Chrome app. Today I finally had some spare time to look into it and found some promising projects that enabled me to do exactly what I wanted: Getting rid of the shitty desktop client and use Hangouts directly through IRC.

I’m already using Twitter and AIM through Bitlbee so checking if there’s support for Hangouts was the first thing I did. Bitlbee is an amazing piece of software enabling you to use a lot of different chat services through a unified IRC interface. Unfortunately Hangouts is a propritary protocol now and you can’t just use Jabber like it was the case with GTalk back in the days. There’s a new library now that reverse engineered the protocol and enables developers to still build on the protocol: hangups. There’s a whole list of other projects using that library now.

One of the project that got inspired by hangups is purple-hangouts which is an additional plugin for the already existing libpurple library. libpurple is the IM library behind Pidgin.

Install purple-hangouts

The overlay we need to install purple-hangouts is already in the official overlays so we can just run layman -L | grep mrueg to see if it’s still there and then add the repository to our overlays with layman -a mrueg. Then just run eix-sync to update your eix index and install it with emerge -av purple-hangouts.

Enable libpurple support in Bitlbee

To use the purple-hangouts is just some additional plugins for the already existing libpurple library so we have to make sure bitlbee is already compiled with these enabled. To do that just set the use flags of the bitlbee package to include purple and then emerge the package again.

root@notmyhostname /etc/portage$ cat package.use | grep bitlbee
net-im/bitlbee otr twitter purple

Configure Bitlbee

After restarting Bitlbee (/etc/init.d/bitlbee restart) you should be able to connect to your server again. Type help purple in your &bitlbee channel and you should see hangouts in the list of available services.

[14:21:25]  dewey	help purple
[14:21:30]  root	BitlBee libpurple module supports the following IM protocols:
[14:21:30]  root	 
[14:21:30]  root	* aim (AIM)
[14:21:30]  root	* hangouts (Hangouts)

To add the account to your bitlbee configuration just run add hangouts with your Google Account email. To set the password you’ll have to use the /OPER command which should look like that:

/OPER hangouts <your google password>
[14:23:15]  dewey	account add hangouts
[14:23:15]  root	Account successfully added with tag hangouts
[14:23:15]  root	You can now use the /OPER command to enter the password
[14:24:00]  dewey	account list
[14:24:00]  root	 0 (twitter): twitter, tehwey (connected)
[14:24:00]  root	 2 (hangouts): hangouts,
[14:24:00]  root	End of account list
[14:24:43]  dewey	account on hangouts

Once that is done we are ready to just turn it on which is done by running account hangouts on which will in turn trigger the authentication process with Google. This will open a new IRC query that prompts you to click an URL and paste an oAuth token. This URL is currently broken so to finalize the login process we’ll have to get an oAuth token from Google through another way.

Google is trying to prevent this so there are some additional hoops we have to jump through. A workaround is currently being discussed on the issue tracker.

Just follow the instructions in this comment and grab the oAuth token, then just paste it in the IRC query that prompted you for the token and hit return. Now we are ready to finally login with accounts hangouts on:

[14:34:29]  dewey	account hangouts on
[14:34:35]  root	hangouts - Logging in: Authenticating
[14:34:35]  root	hangouts - Logging in: Logged in

Done, that was easy!

Show real names instead of IDs

If you prefer not to memorize long IDs I’d recommend to enable full names for the hangouts plugin. This will just show the real name people set on their Hangouts profile instead. To do that just run the following commands:

account hangouts set nick_format %full_name
accounts hangouts off
accounts hangouts on

That’s it!