Previous Section  < Day Day Up >  Next Section

Hack 17 Automatic Completion of Nicknames

figs/beginner.gif figs/hack17.gif

Your client does the typing so that you don't have to.

Often when chatting on IRC you spend much of your time just typing in people's nicknames. This can get tedious, so many clients have some kind of automatic completion facility that works out whose nick you're trying to type and finishes the job for you. This hack will explain the nick-completion functionality provided in several popular IRC clients.

4.2.1 mIRC

mIRC provides basic tab-completion functionality that will be familiar to anyone who's used a modern command-line interface. Type the first letter or so of a nickname and press the Tab key. mIRC will then complete the rest of the nickname for you, as shown in Figure 4-1. If more than one nick starts with the part that you typed, mIRC will allow you to cycle through the available options by repeatedly pressing the Tab key.

Figure 4-1. Tab completion in mIRC: before (left) and after (right) pressing Tab
figs/irch_0401.gif


4.2.2 irssi

irssi provides tab-completion features similar to those found in mIRC. If the nick you tab-complete is the first word in a message, irssi assumes that you're addressing someone, and automatically adds a colon to the end of the nick. In addition, the concept of tab completion has been extended to the rest of the irssi interface. You can see a list of all user completions by entering /completion.

4.2.3 XChat

XChat offers some more advanced nick-completion features, which are configured in the Interface Input Box page of the Preferences dialog. As with irssi, if the nick you are trying to complete is the first word of a line, XChat will assume that you are addressing the person in question and add an optional suffix to the nick. By default, this suffix is a comma, as shown in Figure 4-2. Unlike mIRC and irssi, XChat does not cycle through options if more than one nick starts with the character(s) you entered; instead, it displays all the options and expects you to enter enough extra characters to eliminate the ambiguity.

Figure 4-2. The XChat preferences for nick completion
figs/irch_0402.gif


XChat also has automatic nick completion, a feature that people either love or hate: when it is turned on, any characters at the start of a message that are followed by the nick-completion suffix will be magically expanded when you press the Enter key. The characters will expand into the first matching nick, alphabetically. An example of how this works and the problems it can cause are shown in Figure 4-3. Autocompletion can be enabled and disabled in the XChat preferences.

Figure 4-3. An example of XChat's nick autocomplete feature: before (left) and after (right) pressing Enter
figs/irch_0403.gif


4.2.4 ChatZilla

ChatZilla provides tab-completion facilities that are similar to those found in irssi. It does not cycle through nicks if there is ambiguity, but completes the nick as far as it can and displays the available options if you press Tab twice quickly. If the nick is the first word of a line, ChatZilla suffixes it with a comma.

4.2.5 BitchX

BitchX provides tab-completion facilities equivalent to those found in mIRC, but does not cycle through the available options when asked to complete an ambiguous nick. Instead, like XChat, it displays the available options.

Steve Jolly

    Previous Section  < Day Day Up >  Next Section