An IRC Channel Relay Bot

With the advent of numerous IRC networks and private IRC servers, there has arisen a need for replication of common channels across multiple IRC servers. With a channel relay, anything done in the channel on one IRC server can be seen on a second IRC server. Thus you might join together common channels on Efnet and Undernet, or any other IRC networks/servers.

After searching for existing relay scripts, I discovered how limited the existing scripts were. The best choice appeared to be a beta version of an eggdrop TCL script that allowed for only two channels to be joined. But since I needed to tie together four channels on four different IRC networks, I couldn’t use that script. Then I found one that ran as a client script for Klient that seemed nice. But since I don’t use Klient, that choice wouldn’t work either.

Finally I decided to invest the time to build a relay tool that would allow (relatively) infinite servers and channels. Rather than using a TCL script for a sophisticated eggdrop, or a client side script, I decided to implement a simplistic relay tool in C that did only relaying. No attempt was made to implement any additional capabilities beyond relaying. The result was a fast and efficient tool that does only one thing and does it very well.

The key to the JRelay bot is the configuration file (JRelay.ini), which defines each replication bot/channel. Note that each defined channel uses a separate bot. Thus to replicate to N channels, there must be N bots. This is true even if some/all of the channels are on a common server.

Format of the JRelay.ini file
Each channel definition requires one line. The line defines the bot name, the server/port to use, and the channel to occupy. Here is an example replicating three channels.
JRelay, irc.eCompute.org, #DistributedComputing
JRelay, irc.webchat.org, #DistributedComputing
JRelay, mesa.az.us.undernet.org:6660, #DistributedComputing

In this example, each bot will be named the same – JRelay. Since they will be on three separate networks, there will be no nick collision. But if they could all be named the same if they were going to be on the same server. In that event, two of them would automatically be renamed to the form of JRelayXX  where the XX would be a random number between 0 and 99.

Also notice that in this case, each of the three bots will be joining the same channel on the different networks. This does not have to be true in all cases. Perhaps you would wish to connect two channels that have different names but have common interests. Whatever the channel names are in the definitions is where the relay bot will reside.

The server name definition may have an optional port number. If the port number is not defined, the relay bot will attempt to use port 6667.