XChat

From LQWiki
Jump to: navigation, search

X-Chat is an Internet Relay Chat (IRC) client for UNIX operating systems. X-Chat runs on most BSD and POSIX compliant operating systems, and works on Linux. A Windows client also exists as do several MacOS ports. A prominent fork for MacOS is X-Chat Aqua. All versions support many scripting capabilities.

Basic Operation

The easiest way of connecting to a server is through the server list. X-Chat comes with a list of servers. One of the best servers related to Open Source Software is irc.freenode.net[1].

To connect, simply enter your desired nick and username, select a network and hit connect.

Type '/join #xchat' to join the XChat channel, or try the name of whatever project you are interested in. Debian, SuSE, LTSP, KDE and Xine all have channels.

Scripting Xchat

There are several ways of scripting in xchat.

Perl Scripts

Most of the scripts seem to be written in Perl. Perl scripts need the Perl plugin. So just put your perl.so where xchat can find it, then put your perl scripts in ~/.xchat2/ and everything should be fine :).

Errors might occur when the plugin's version doesnt match the version of xchat.

TCL Scripts

There are several Tcl scripts for xchat. The procedure is the same as for perl scripts: tcl.so where xchat can find it, .tcl scripts in ~/.xchat2/ and there you go. :)

Python Scripts

Some people prefer python over perl, and many a great battles have been fought over this matter. Have xchat find the python.so, put your python script in... you guessed right! ...in ~/.xchat2/, done.

The python xchat api doc[2] and some XchatPyScriptSamples

Ruby Scripts

Ruby has gained a lot of popularity lately and there now is a ruby plugin for xchat. You should know the deal by now... :)

Simple Scripts

Using a language plugin you can have all the power of your preferred programming/scripting language, at the cost of having to load yet another binary.

Then one can use scripts that do not require a plugin at all. Of course these scripts have a very limited functionality, however, they do get simple things done very easily. Functionality is limited to irc commands plus user commands plus commands introduced by XchatPlugins.

A script of this kind will contain one command per line, without the leading "/" (or whatever you set input_command_char to). Also comments are not possible.

For example:
msg nickserv identify secretpass
join #foo,#bar
join #fool foolkey
msg guarding-bot opme anothersecretpass

Save this in a file and use load -e <full path to file> as connection command in the server list to have xchat execute the script after connecting to that server.

Also note that with recent versions of xchat you won't need to identify to nickserv like this anymore, the server list now has a nickserv password field.

Selecting an encoding

If you're using a language other than English, you might want to have another look at the server list before you connect. XChat supports a number of character sets and encodings, and although the default, UTF-8, is a very good encoding for multilingual text. But not all IRC clients support it and for the characters that are send to appear correctly on the other people's IRC clients, they have to set the exact same encoding in their client.

To select another text encoding, simply do the following:

  • Open the server list
  • Check the box labeled 'Edit mode'
  • Find the dropdown menu labeled 'Character Set'
  • Select your encoding of choice, e.g. ISO-8859-1.

To change your encoding while you're connected to a server, use the /charset command followed by your encoding of choice.

Note on IRC and character encodings: There is no guarantee the characters outside ASCII will work. It depends on the IRC server software (most don't do any character encoding conversion and just send the data as-is), and the other users' IRC clients (most clients use WINDOWS-1252, so characters not in ASCII will show up garbled in their client) .

DCC file sends

XChat can send and receive two types of DCC: Active mode and passive mode. Generally, active mode should be used, because it works with almost all clients, but if you're behind a very restrictive firewall, you could have to resort to using passive mode.

Active mode can be used in the following way:

  • /dcc send <nick>
  • /dcc send <nick> <file>

Passive mode is activated like this:

  • /dcc psend <nick>
  • /dcc psend <nick> <file>

Options

The options in XChat are scattered about the interface a bit. While the options related to connecting are found in the server list and most other options are found under Settings→Preferences, some options are also available from the 'IRC' or 'Server' menus, or by right-clicking on a channel window. Additionally, all options should be accessible by typing '/set'.

Plugin Tweaks

Most plugins work as expected once they are loaded, others need a little tweak. These tweaks are described here.

Linux Systray Plugin

So you downloaded and extracted it, then loaded the .so --- but why doesn't it display any icons? As described in its README you need to set up the icon path, that is the path to the images directory. "images" is to be taken literally in this case.

Look for a directory named "images" which contains these three subdirectories: "GTKtray", "Menu" and "Win32". Right-click on the invisible icon in the system tray (notification area for gnome users), go to that setup thing and fill in the path up to and including the "images" directory we found above. Do NOT point it to GTKtray or so, this won't work; just "images" is fine. After saving your changes you need to restart xchat.

That's it - it works now!

External links