Hack and / - What Really IRCs Me: Twitter
In last month's column, I talked about the fact that I thought IRC was the ideal interface for quick communication with my friends. I keep an IRC session running at all times within a screen session, so I can continuously lurk in all of my channels. Because many of my friends use IM instead of IRC though, I've had to figure out ways to manage all of my communication without having a ton of different programs open. Last month, I discussed how I used Bitlbee so I could access all sorts of IM services from my IRC client, and I promised that in the follow-up column, I would talk about how to do something similar for Twitter.
In case you didn't read last month's Point/Counterpoint column, let me summarize my opinion here. I don't see the point of Twitter. I think everything people use Twitter for already could be achieved with IRC and instant messaging without the character limits. Again, IRC is my ideal way to communicate, but now some of my friends (ahem Bill) talk more on Twitter than they do on IRC. So after much prodding from Bill, I bit the bullet and registered a Twitter account so I could see what the fuss was about.
Now, just because I had a Twitter account didn't mean I was going to flood the Internet with every meal and traffic jam in my life. My main requirement for setting up the account at all was that I could access everything via IRC. That way, Twitter was nothing more than another IRC channel, only with higher latency and lower stability. To be honest, I mostly use it in “read-only” mode and just read other people's tweets.
It turns out I'm not the only one who wanted to access Twitter over IRC, and in fact, quite a few different programs out there provide a local IRC gateway to Twitter. Unfortunately, none of the programs have been packaged for my distribution yet, so after struggling to get a few running, I finally found one with a reasonably simple install that worked: tircd.
tircd is a simple Perl script that works much like Bitlbee. When you start the program, it creates a new IRC server on your local machine that you can connect to with an IRC client. The only difference is that it interfaces with your Twitter account, so people you follow show up as users in the channel, and their tweets show up as normal chat messages. Once you are in the channel, everything you type becomes a new Twitter message as well, so it behaves much like any other IRC channel.
To install tircd, first go to the main project page at code.google.com/p/tircd, and download the latest version. As with many Perl scripts, tircd makes use of some CPAN modules you might not have on your system, so dust off your Perl programmer hat, and type the following command as root to install the CPAN modules:
# cpan -i POE POE::Filter::IRCD Net::Twitter
If this is the first time you've used CPAN on your system, you first will have to go through a basic CPAN configuration process, so it knows which mirrors to use and whether you have any proxies in place. Apart from when you choose the mirrors, the default settings should be fine, and when you select the mirrors, simply pick a few that might be close by.
Once the CPAN modules are installed, extract the tircd package in some directory (your home directory works), and then change to that directory. You'll see that only a few files are inside:
$ tar xzvf tircd_v0.7.tar.gz $ cd tircd $ ls ARTISTIC GPL tircd.cfg tircd.pl tircd.pod
tircd includes a sample configuration file that is heavily commented, so you can see what each option does. The default settings should work in most situations, unless you already run a local IRC server (such as Bitlbee in my case). If you do run another IRC server, change the port setting in the file from port 6667 to port 6668 so it won't conflict.
To start tircd, simply execute the tircd.pl script and pass the path to the tircd.cfg file as an argument. Because I was already in the tircd directory, I could type:
$ ./tircd.pl ./tircd.cfg
You should see a number of log messages scroll by in the terminal, and if you want to use the terminal for something else, don't forget to add the & character at the end to start this in the background. Now you might be wondering how you enter your account information. All of this is set when you connect to the local server. Just use your Twitter user name and password as authentication. For instance, on most command-line IRC clients, you would type:
/server localhost 6667 twitter_password twitter_username
In my case, as I already had Bitlbee running on port 6667, I connected to port 6668:
/server localhost 6668 twitter_password twitter_username
Once you are connected to the tircd server, join the #twitter channel. tircd automatically imports everyone you are following, so they show up as users in the channel, and you also will see their recent posts. Any users that follow you back are voiced (+v).
Kyle Rankin is a VP of engineering operations at Final, Inc., the author of a number of books including DevOps Troubleshooting and The Official Ubuntu Server Book, and is a columnist for Linux Journal. Follow him @kylerankin.
- Goldtouch Semi-Vertical Mouse
- My Childhood in a Cigar Box
- Let's Go to Mars with Martian Lander
- Applied Expert Systems, Inc.'s CleverView for TCP/IP on Linux
- Papa's Got a Brand New NAS
- VMware's Clarity Design System
- Panther MPC, Inc.'s Panther Alpha
- Simplenote, Simply Awesome!
- Linux Journal January 2017