Hack and / - What Really IRCs Me: Instant Messaging

August 1st, 2009 by Kyle Rankin in

Use Bitlbee to roll all of your instant-messaging accounts into an IRC interface and do all your chatting from one place.
Your rating: None Average: 4.5 (2 votes)

To me, IRC is the ideal interface for quick communication with my friends. I keep a console IRC session (irssi) running on my server at all times within screen. With that setup, I constantly can lurk in all of the channels I want to follow and reconnect to the session, no matter what machine I am using. Because many of my friends use IRC, it's pretty easy to stay in touch. I can chat with them daily, and if they need to tell me something when I'm not around, they can leave me a private message, and I will see it the next time I'm in front of my computer. To me, the IRC interface is best both for group and private chats—so much so that I prefer it to instant messaging.

Of course, not all of my friends use IRC. Even among those who do, they don't all prefer to do all of their communication there. So, in addition to IRC, I maintain instant-messaging accounts. This means to keep in touch with everyone, I need to keep both an IRC and an instant-messaging program open. Plus, unless I set up a text-based IM client on my server, I'd have to fire up a local client on whatever computer I'm in front of, which isn't possible when I'm using someone else's computer. On top of that, some of my friends have replaced both chat and IM with Twitter, which means yet another account and yet another program open on my desktop—well, it would in theory at least. Instead, I've discovered a few programs that let me roll everything into IRC sessions, so sending someone an IM is as simple as an IRC private message, and everyone's Twitter feeds become just another comment in an IRC channel. In this column, I discuss how to access your IM accounts from within IRC, and in a follow-up column, I will talk about how to access Twitter as well, because they each require different programs.

IRC Instant Messaging with Bitlbee

The program that makes IM possible within IRC is an IM-to-IRC gateway called Bitlbee (www.bitlbee.org). Basically, Bitlbee sets up an IRC server on your local machine that you can connect to like any other IRC server you might already use. Once you connect to the server, you can join the #bitlbee channel and authenticate with the bot inside. Then, you can configure Bitlbee with your Jabber, MSN, Yahoo or Oscar (AIM/ICQ) accounts. Once you are set up, when your friends are on-line, they join the channel, and when you talk to them or private-message them inside the IRC channel, it translates it to an instant message.

Bitlbee should be packaged for most major distributions, so you can install it like any other program. Otherwise, just pull down and compile the source code from the main project page. Bitlbee uses inetd, so once you connect to the IRC port, inetd automatically spawns a Bitlbee process. Depending on your distribution, the post-install script may or may not set up the line in inetd.conf automatically. If it doesn't, add the following line to /etc/inetd.conf:

6667  stream  tcp   nowait  bitlbee /usr/sbin/tcpd  /usr/sbin/bitlbee

Set Up the Bitlbee Account

Once Bitlbee is installed, go to your IRC program and connect to a new server, but in place of the typical hostname, connect to localhost. Once you connect to the server, join the #bitlbee channel. Bitlbee includes a built-in help program. Simply type help to see a list of help topics, or type help followed by a particular Bitlbee bot command to see help for that command. In addition to these help topics, Bitlbee also includes a quickstart topic (type help quickstart) that will walk you through setting up your Bitlbee account and adding your IM accounts (I cover these same steps below).

The first thing you need to do before you can IM with Bitlbee is register an account with the server so that it can save all of your IM account settings, contacts and other information, and password-protect it. Type:

register password

and replace password with the password you want to use. The next time you connect to Bitlbee, you must type:

identify password

in the #bitlbee channel so the bot can give you access to your IM accounts.

Add IM Accounts

Once you are registered, you can start adding IM accounts. The account command lets you add or remove accounts from Bitlbee, and the syntax for adding an account is:

account add protocol username password server

The protocol above should be replaced with jabber, msn, yahoo or oscar, depending on which chat protocol your IM account uses. Then, list your user name and password for that IM account. The final server field is needed only for the oscar protocol, so it knows whether to connect to the AOL Instant Messenger server (login.oscar.aol.com) or the ICQ server (login.icq.com). The rest of the protocols don't need it. So, for instance, if I had an AOL Instant Messenger account called test with a password of mypassword, I would add it with the following command:

account add oscar test mypassword login.oscar.aol.com

After you have added all of your IM accounts, type:

account on 

in the #bitlbee channel, and Bitlbee will enable and log in to all of your accounts. Bitlbee should download your contact list automatically, and those contacts that are on-line will show up as though they joined the channel. Because Bitlbee renames people on your contact list so they have a more IRC-friendly name, you might end up with people from different accounts with similar or at least confusing names. To clear things up, just use the rename command followed by the old nickname and then the new nickname you want to use.

Chat in Bitlbee

Once your accounts are set up, you can chat with any person who is currently in the #bitlbee channel. Simply type their nickname, followed by a colon (:), and then say what you want to say. Alternatively, you can use /msg to set up a private chat, just like with any other IRC channel.

Contact List Management

Once you start using Bitlbee, you probably will get to the point where you need to add or remove contacts from your contact list. The add and remove commands take care of this, but first, type:

account list 

to get a list of the accounts you have registered and their Bitlbee number. Then, to add a user, type add, by the number you saw in the account list associated with the account, and, finally, add the user's handle. So, if I wanted to add a user named mybuddy to the first account I set up (so it would be account 0), I would type:

add 0 mybuddy

To remove that user from my contact list, I would type:

remove mybuddy

Because Bitlbee gives each user a unique nickname in the channel, you don't have to specify the IM account with which a nickname is associated when you remove it.

There you have it. Now you're ready to do all of your IM chatting within your IRC session. Of course, there are a number of other commands and settings you can tweak in Bitlbee. To start, type help and look at all the available help topics and tutorials within the channel. I recommend you run through all of the quickstart topics first and then branch out into the rest of the commands. As for me, I'll be lurking in IRC (such as the #linuxjournal channel on irc.freenode.net) as always.

Kyle Rankin is a Senior Systems Administrator in the San Francisco Bay Area and the author of a number of books, including Knoppix Hacks and Ubuntu Hacks for O'Reilly Media. He is currently the president of the North Bay Linux Users' Group.

__________________________


Special Magazine Offer -- Free Gift with Subscription
Receive a free digital copy of Linux Journal's System Administration Special Edition as well as instant online access to current and past issues. CLICK HERE for offer

Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dezzadk's picture

Some tips

On September 24th, 2009 dezzadk (not verified) says:

Hey guys. Here are some more helpful commands. Hope it will come in handy (At least I've used them the first days of my bitlbee'in)

- More commands
"help commands" will give you a list of commands.

- If a buddy requests authorization you will be asked a yes/no question in &bitlbee/#bitlbee .. Simply write yes or no in the main channel.

rename buddies simply:
rename name1 name2

- This command sets typing notices that continually sends CTCP [TYPING] when the client you're chatting with is writing or editing text.
set typing_notice on

Also some other important settings for automatic establishing of connections to your accounts:
set auto_reconnect true
set auto_connect true

- Buddylist .. Same as /names, but more detailed.
blist

- This command gives a list of unanswered questions (Which are mainly authorization requests)
qlist

- A good extensive reference for bitlbee commands:
http://infectious.cc/archive/oldsite/howtos/bitlbee-user-guide.html

dezzadk's picture

irssi bitlbee scripts

On September 24th, 2009 dezzadk (not verified) says:

http://the-timing.nl/stuff/irssi-bitlbee/

Here are some irssi bitlbee scripts that might help you guys out.

The collection consists of:

Auto_away.pl

Server specific autoaway with two away states

BitlBee_nick_change.pl

Screenname change in query and &bitlbee

BitlBee_join_notice.pl

Statusbar item and query notification

BitlBee_blist.pl

Grep from your buddylist

BitlBee_typing_notice.pl

Show and send typing notices

BitlBee_tab_completion.pl

Completion of BitlBee commands

Doug_M's picture

irssi and bitlbee

On August 11th, 2009 Doug_M says:

Great article Kyle. Is it possible to have irssi automatically join the #bitlbee channel? I tried

/CHANNEL ADD -auto #bitlbee

but it complains of missing parameters. It probably wants the network but there is no network.

Regards,
Doug McComber

tricqster's picture

Re: irssi and bitlbee

On September 6th, 2009 tricqster (not verified) says:

I guess you need to do:

/SERVER ADD -auto -network localhost localhost 6667

to connect automatically to localhost (bitlbee) on startup.

Post new comment

Please note that comments may not appear immediately, so there is no need to repost your comment.
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <i> <b>
  • Lines and paragraphs break automatically.

More information about formatting options

Newsletter

Each week Linux Journal editors will tell you what's hot in the world of Linux. You will receive late breaking news, technical tips and tricks, and links to in-depth stories featured on www.linuxjournal.com.
Sign up for our Email Newsletter

Tech Tip Videos

From the Magazine

December 2009, #188

If last month's Infrastrucuture issue was too "big" for you then try on this month's Embedded issue. Find out how to use Player for programming mobile robots, build a humidity controller for your root cellar, find out how to reduce the boot time of your embedded system, and if you're new to embedded systems find out the basics that go into one. You can also read about the Beagle Board, the Mesh Potato and a spate of other interestingly named items. And along with our regular columns don't miss our new monthly column: Economy Size Geek.


Read this issue