IRCRelay

From Qontrol.nl Wiki
Jump to: navigation, search

UCIS IRC Relay

This software links (multiple) channels on (different) IRC networks together by passing messages between them. It is possible to link channels among different networks, as well as to link channels on the same network. Multiple channels (more than two) can be linked together. It is even possible to link in a private conversation with one or more predefined individuals/nicknames.

The relay can be configured through a simple configuration file, as well as at run-time through the use of commands via the IRC session. Run-time changes are NOT saved!

License

The software is released under the terms of the BSD license. If you like or use the software, you are welcome to let me know by sending an e-mail (see below) and you may even send me some money (see below).

Usage

Make sure to configure the software first (see below). Then just run the main program file relay.php, using either ./relay.php, php relay.php or a supervisor daemon like daemontools, runit or supervisor. Make sure that the suprtvisor daemon sets the working directory appropriately so the program can find it's configuration file.

Contact

  • By e-mail: Ivo@UCIS.nl
  • On IRC: Ivo or UFO in #Chat on irc.kwaaknet.org
  • Paypal: Ivo@UFO-Net.nl - thank you very much!
  • MSN Messenger: Ivo@UFO-Net.nl

Configuration

The configuration data is contained in one simple php file, config.php (see below for an example configuration). The configuration consists of a few nested arrays:

  • $config - associative array containing all configuration data
    • $config['password'] - administrator login password, leave out or set to NULL to disable run-time administration
    • $config['networks'] - associative array listing all IRC networks to connect to
      • $config['networks'][$key] - associated array listing the configuration for the network with short name $key
        • $config['networks'][$key]['nick'] - nickname to use on this IRC network
        • $config['networks'][$key]['server'] - IRC server address, either a domain name or IP address
        • $config['networks'][$key]['port'] - IRC server port number (optional, defaults to 6667)
        • $config['networks'][$key]['name'] - long name for the network (optional)
        • $config['networks'][$key]['ident'] - username/ident (optional)
        • $config['networks'][$key]['realname'] - real name (optional)
        • $config['networks'][$key]['ipv6'] - set to true to connect using IPv6 (optional, defaults to false)
        • $config['networks'][$key]['debug'] - set to true to enable debugging for this network (optional, defaults to false)
        • $config['networks'][$key]['channels'] - yet another associative array containing the channel configuration for this network
          • $config['networks'][$key]['channels'][$name] - associative array containing the configuration for a channel named $channel (eg #chat or an individual nickname)
            • $config['networks'][$key]['channels'][$name]['link'] - indicates which channels to link to, all channels having the same link property are connected
            • $config['networks'][$key]['channels'][$name]['display'] - short text to prefix messages originating from this channel (optional)

Source code

relay.php

You can find the main program file here: IRCRelay/Sourcecode. Just copy-paste the code into your favourite text editor and save it as a .php file.

config.php (example)

This is an example configuration file. Make sure to change it according to your needs.

<?php
$config = array(
        'password' => NULL,
        'networks' => array(
'KN' => array(
        'name' => 'Kwaaknet.org',
        'server' => 'irc.kwaaknet.org',
        'port' => 6667,
        'nick' => 'IRCRelay',
        'channels' => array(
                '#ircrelay' => array('display' => 'KN', 'link' => 'main'),
        ),
), 'FN' => array(
        'name' => 'freenode',
        'server' => 'irc.freenode.net',
        'nick' => 'IRCRelay',
        'channels' => array(
                '#ircrelay' => array('display' => 'AN', 'link' => 'main'),
        ),
),
        ),
);