cadence’s website.

Some changes will be applied after reloading.
Some changes will be applied after reloading.

Command line computing part 3: IRC tutorial with WeeChat

About this page

This page was originally published via the Gemini protocol. However, I've also made the contents available on this blog if you don't have a Gemini client. The translation you are reading is not perfect. Hopefully it is good enough.

A note about formatting

`backticks` around words indicate the boundaries of code that you should type in. You should not actually type the backticks. You may wish to replace words inside them. For example, if you see the text `/query somenick`, you may wish to enter the following into the chat window:

/query cadence

History of IRC

It may be interesting to briefly discuss some history.

IRC was created in the late 1980s. It grew throughout 1990 and peaked in the early 2000s. IRC has become a lot less popular in recent times, probably due to people moving to the chat features implemented on many social media platforms.

The available interfaces for IRC are fairly complex to get running at first, which is something I hope to partially ameliorate by writing this page. Despite IRC's loss in popularity, it is still used by enthusiasts, dedicated groups, and people who like old technology. Since you're reading this article about command-line computing, you'll likely be in good company with the people currently on there!

IRC is a great fit for text-mode computing because it is entirely text-based and designed to be operated without a graphical interface. It was created before HTTP and HTML, and has no built-in file uploads.

IRC jargon

  • channel: a channel is a space for sending messages. people can join channels in order to read and send messages there. channels are managed by people known as channel operators, "chanops".
  • nick: a nick is the nickname that a person connects with and is known by.
  • network: a network is what you connect to with your client. each network is operated by a set of people, and contains channels. you can join multiple networks.
  • server: a server is more of a technical concern. large networks have many servers to distribute load. connecting to the network will typically assign you a random server, and you can see messages from everyone on the network no matter their server.

IRC features

IRC is text chat.

You get text messages, nicknames, multiple channels, private messages, and basic moderation.

Modern chat applications often include message history, file uploads, user avatars, typing notifications, message formatting, message editing, and voice chat. None of these features are available in IRC.

About clients

IRC is not a proprietary protocol, so many clients have been developed for it for a variety of operating systems and time periods.

It is worth noting that several graphical clients for IRC exist, some more easier to use than others. Kiwi IRC (a webapp) and HexChat (a GTK 2 application) are popular choices.

Some more modern IRC clients try to "fill in the gaps" by working around what they consider to be missing features. For example, IRCCloud makes a persistent connection to the IRC network even after you disconnect, allowing you to access message history when you return. Some clients allow you to upload images to another website, and then post a link to them in the chat. Some clients might automatically render these images in the timeline.

This article is about command-line computing, so I'll be explaining how to connect with the command-line client WeeChat. There are also other command-line clients that some people swear by, including irssi and ircII. Connecting with those is left as an exercise for the reader.

Connecting with WeeChat

I'll assume you want to connect to the largest network, Libera Chat. If you want to connect to a different network in addition or instead, you should visit that network's website. It will contain the parameters you need in order to connect. The procedure should be very similar no matter the network.

After first opening WeeChat, you will be in the system buffer, where you can run commands. To add the network Libera Chat, use this command:

/server add liberachat irc.libera.chat/6697 -ssl

In this command, `liberachat` is a local alias for the network, `irc.libera.chat` is the network's address, and `6697` is the port. `-ssl` specifies to connect with SSL - you will always want to do this.

Now you can set connection options like your nickname. Use this command to set options:

/fset server_default

(The options you set here will apply to all networks. To set options for a specific network, use /fset liberachat, or whatever alias you gave that network previously.)

First, set the nicks. The nick is the display name you will have. Only one person can have a nickname at any given time, so pick something unusual.

To set it, scroll to the entry that ends with `.nicks`, press Alt-Return, and enter the replacement value. Press Return to confirm.

Then set your username. This field will rarely be displayed and doesn't have to be unique. Set it to be the same as your preferred nickname.

Then set your realname. It's called realname for historical reasons - you *could* put your real life name there, but most people use the field either as a joke or to display pronouns. This is also rarely displayed.

If you don't know what sasl_username or sasl_password are, you don't need to fill them in. If you do know what they are and you have already registered, now is the chance to enter them!

Press q, Return, to exit fset mode.

Type /save to ensure your settings are saved.

Now you can connect. Type /connect liberachat and see what happens.

(If you get stuck, you may wish to check WeeChat's quick start guide and Libera Chat's guides. If you email me to tell me what the problem was, I can add information about it to this guide too.)

Basic WeeChat usage

Joining a channel

It's no fun being alone. Type `/join #channelname` to join some channel on the network if you know its name.

Finding channels

You can search on the internet for topics you're interested in, or you can find channels on the network that contain a certain name using `/list -re .*help.*` (replace "help" with the term you want to search for).

Switching channels

The left side of the screen is the list of channel you're joined to (WeeChat also calls them "buffers"). The current one you're in is highlighted. To change channel, hold Alt and press the number (for channels numbered 1-10), or press Alt-J and two numbers (for channels numbered 11-99). You can also use F5/F6 to move up and down the list one at a time.

Channels with activity or highlights will be marked in a different colour. You can switch to the next highlighted channel with the shortcut Alt-A.

Scrolling

F1/F2 scroll the channel list. F9/F10 scroll the channel topic. F11/F12 scroll the nicks list on the right side of the screen.

Running commands

You can run commands from any screen, but if they have output, the output will always be sent to the "server buffer". This buffer is always at the top of the channel list, and you can change to it by pressing Alt-1.

Helpful IRC commands

Without a user interface, IRC interactions are triggered using /slash commands. You can get a command list with /help, and help about a specific command with /help commandname.

  • join a room: /join #someroom
  • leave the room you're looking at: /part
  • list rooms (caution: there are a lot): /list
  • open a private message: /query somenick
  • see the channel topic: /topic
  • kick a user (you must be an op): /kick somenick reason...
  • ban a user (you must be an op): /ban somenick reason...

Strange things to know about on IRC

What are the mode letters?

Mode letters indicate the status, privileges, or lack of, of a user or channel. The modes are set by the network, and may be edited by commands. The mode letters and their meanings are different on each network, so you should check your network's documentation.

For example, here are Libera Chat's mode lists: https://libera.chat/guides/usermodes https://libera.chat/guides/channelmodes

What is NickServ?

NickServ is a bot account, operated by the network you connect to, that acts as a gatekeeper for authentication. As you have already noticed, you can connect to an IRC server under any nick with no sign-up or login. If somebody disconnects you can connect with their nick to impersonate them, which is obviously an issue! NickServ allows people to "register" their nicknames (akin to signing up for a website) which means a password is required to connect with that nickname in future (akin to logging in).

In the past, you used to /msg your password to NickServ directly to authenticate. This process can be automated by every IRC client. Nowadays, authentication is done at the same moment you connecting using a method called SASL.

What is ChanServ?

This is another network-operated bot that restores the permissions of chanops if they disconnect and reconnect. It generally works automatically and you don't need to worry about it.

Registering your nick

As mentioned just above in the NickServ section, registering your nick stops other people impersonating you on the network, so while it's not necessary, it's a great idea if you are a frequent participant on IRC!

To register your nickname, start a private message with NickServ using the command /query NickServ. You can now send the word "register" to NickServ and it will tell you what to do next.

After registering, you'll need to specify the password when reconnecting. Here's how:

(The following directions will store your password in plain text. If you want to store it securely, read the quick start guide in detail: https://weechat.org/files/doc/devel/weechat_quickstart.en.html#irc_server_options)

Open the settings for your network with /fset liberachat

Find the options for SASL. SASL is for authentication.

Add your username and password to the configuration.

A helpful WeeChat plugin

If you have many channels, you may find the "go.py" plugin useful. You can install it by typing `/script install go.py`.

It can be activated with the hotkey Alt-G. You can now type the name of a channel to quickly switch to it.

There are many many plugins available, and it is expected that you will install plugins to shape WeeChat to your needs. See WeeChat's documentation for a list of plugins!

Matrix

WeeChat doesn't only support IRC. If you're a Matrix fan, there is a weechat-matrix plugin written in Python which is surprisingly really good!

But do note that Matrix users may expect your client to be able to do things like render images or typing notifications or read receipts, which WeeChat cannot. WeeChat includes some workarounds for images, links, formatting, mentions, and quote replies, but remember that a graphical Matrix client may be more appropriate for Matrix, which is designed as a graphical protocol.

Conclusion

Hopefully this was a helpful introduction to IRC and WeeChat and you can get connected easily. See you on the net!

Cadence

A seal on a cushion spinning a globe on its nose.
Another seal. They are friends!