Today's fun fact

When you connect to an IRC server, you get spammed with a lot of messages reporting various information. Some of it is purely informational, such as the MOTD, for the eyes of the user. Others are of use to the IRC client itself.

For example, this is numeric reply 004 from a DALnet IRC server (line-wrapped for readability):

:mozilla.se.eu.dal.net 004 daive mozilla.se.eu.dal.net bahamut-1.8(04)
   aAbcdefFghiIjkKmnoOrRswxXy bceiIjklLmMnoOprRstv

This message tells the client what server he is connected to (mozilla.se.eu.dal.net), what server software is running (bahamut-1.8(04)), what user modes this network knows about (aAbcdefFghiIjkKmnoOrRswxXy, one letter per mode), and what channel modes it knows about (bceiIjklLmMnoOprRstv, again one letter per mode).

All this information helps the IRC client to be a good citizen of that network, for example by avoiding attempting to set modes that aren’t known to the network (which will fail anyway, so it’s just a waste of network trafic).

Another one of those very useful messages is actually so big that it’s transmitted in several messages: numeric reply 005.

:mozilla.se.eu.dal.net 005 dave NETWORK=DALnet SAFELIST MAXBANS=200 MAXCHANNELS=20 
  CHANNELLEN=32 KICKLEN=307 NICKLEN=30 TOPICLEN=307 MODES=6 CHANTYPES=#
  CHANLIMIT=#:20 PREFIX=(ov)@+ STATUSMSG=@+ :are available on this server
:mozilla.se.eu.dal.net 005 dave CASEMAPPING=ascii WATCH=128 SILENCE=10 ELIST=cmntu
  EXCEPTS INVEX CHANMODES=beI,k,jl,cimMnOprRst MAXLIST=b:200,e:100,I:100
  TARGMAX=DCCALLOW:,JOIN:,KICK:4,KILL:20,NOTICE:20,PART:,PRIVMSG:20,WHOIS:,WHOWAS:
  :are available on this server

What does all that garbage mean? Well, it looks like a list of directives giving information about some capabilities of the network. Some are fairly obvious: the network is called ‘DALnet’, the maximum topic length on a channel is 307 characters…

But others on that list are somewhat more cryptic. What does INVEX mean? What’s with the strange comma-separated syntax for CHANMODES ? Fortunately, this is what we have RFCs for! This is what RFC 2812, “Internet Relay Chat: Client Protocol”, has to say about numeric reply 005:

005    RPL_BOUNCE
       "Try server <server name>, port <port number>"

       - Sent by the server to a user to suggest an alternative
         server.  This is often used when the connection is
         refused because the server is already full.

If you’re thinking that this doesn’t look like our message from above at all, you would be right. I’ve tried five different IRC networks, and all transmit numeric reply 005 in the format I showed above. What probably happened is that someone came up with this capabilities system for IRC networks, and replaced an unused numeric reply with it. And, of course, didn’t document it or anything. Because that would be too easy!

I can’t help but think that this change was rather stupid. There is a huge gap of unused numeric replies from 006 to 199. And yet, whoever came up with this new message chose to replace an existing one, which means that we now have conflicting specifications and reality. It seems that this is unfortunately par for the course for IRC.

And, for extra credit, figure out what the third set of flags EFnet sends out in numeric reply 004 is for! It’s also not in the spec.