|MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA|
O'Reilly Book Excerpts: IRC Hacks
Hacking IRCby Paul Mutton
Author's note: Many of my colleagues use IRC, and a few of us also have webcams so we can see what each other is up to. By combining an IRC client and a webcam, we can let people know what we're doing, even if it's not readily apparent by looking at the webcam.
Add Your IRC Nickname to Your Webcam
Webcams are the best way to let people know exactly what you're doing—after all, a picture is worth a thousand words, or so they say. Adding extra text to your webcam image can reveal a lot more, particularly if you are not there to be seen. This hack shows you how to display your current IRC nickname on your webcam image.
The Windows webcam software used in this hack is Dorgem. This unusual name doesn't actually mean anything; it is a combination of letters that could sound like a word and didn't return any results on search engines at the time of its creation. So the chances are that if you Google this, you'll be able to find it easily. If not, you can download it from http://dorgem.sourceforge.net.
One useful feature of Dorgem is that it allows you to overlay captions on your webcam image. These captions can be either bitmap images or plain text. If you go for the plain text option, you can choose to overlay a string that you type in, or tell it to read the contents of a file. The latter choice allows you to include whatever text is in the file, so you can easily create a script for your IRC client that updates the file with your current nickname.
Writing Your Nickname to a File
As this hack is to run on a Windows machine, it will use mIRC as the IRC
client. To update the contents of the file every time you change your
nickname, it's going to be necessary to trap that
event. The easiest way of doing this is to override
Open up the mIRC Scripts Editor (Tools → Scripts Editor...)
and select the Aliases tab. Now create the alias for the
This overrides the
The second line echoes a string to your active window so you can
receive a confirmation of what your webcam message will say.
The third line writes the same message to a file. The
The alias lets you add extra parameters to the
This would cause nick.txt to contain:
If he wanted to include some more information about his nickname, he
could simply add some more details after the
This would cause nick.txt to contain:
Now that you've configured your IRC client to keep this file up-to-date, you just have to set up Dorgem to display its contents on your webcam image.
Displaying File Contents in Dorgem
Assuming Dorgem is up and running properly, you can add a caption to the webcam image by clicking on the Caption Settings button, as shown in .
In the Caption Settings dialog (), click on Add to add a new caption overlay. When prompted, select a Text caption and click on OK.
In the Text Caption Settings dialog, shown in , give the caption a meaningful name, such as "IRC nick." This will not appear on the webcam image, but it will help you work out what this caption is used for if you end up adding any others.
Make sure the Enable checkbox is checked and that the length is set to 0 (unlimited). Enter the filename in the File box. For best results, you should make the text transparent, otherwise it will be printed on an opaque rectangle. If you want to make it stand out better, you could add a full shadow and use a contrasting color for background and foreground.
Clicking on the Position button reveals the Caption Position dialog, as shown in . This example places the caption at the bottom right of the webcam image. If you know the dimensions of your webcam image, you can even experiment with absolute positioning.
shows the final results: a webcam image with the user's current IRC nickname and personalized message in the bottom right.
When people look at your webcam now, they will no longer be left guessing what you're up to when you're not there.