Configuration Manual#

Srain uses Libconfig to process configuration file.

Configuration File#

The path of system wide configuration file builtin.cfg depends on the compile flag --sysconfdir, default to be /etc/srain.

The path of user wide configuration file srain.cfg is $XDG_CONFIG_HOME/srain, usually it is ~/.config/srain (~/.var/app/im.srain.Srain for flatpak installs).

The difference between system wide and user wide configuration file is the priority, The user wide configuration always overwrite the one in system wide configuration. For more details about priority, refer to Priority and Fallback.

Syntax#

For the syntax of configuration file, please refer to Libconfig’s documentation: Configuration Files

For an example configuration, refer to All Configurable Items.

Priority and Fallback#

A group is a collection of configurations. The same group in different place have different priority.

server: { # A top level ``server`` group

    # ...

    user = {}
    default-messages = {}
    irc = {}
    chat = { } # A ``chat`` group directly in ``server``

    chat-list = (
        { }, # A ``chat`` group in ``chat-list``
        # ...
    )
}

server-list: (
    { }, # A ``server`` group in ``server-list``
    # ...
)

For example, A server group contains the information(not all) of connection to IRC servers. server group can appear at the top level of configuration file, or be an element of server-list list with a unique name. The top level server is often used to specify the global configuration, and server-list is used to specify specified IRC servers.

The configuration in server-list can overwrite the top level server, and if an option is not specified in server-list, It will fallback to server.

Another similar group is chat, chat contains configuration of chat panel, such as whether to show topic, whether to save chat log and etc. Every server group can contain a chat group and a chat-list list. Elements in chat-list are also identified with an unique name.

As same as the relationship between top level server and server-list, chat-list is used to specify a specified chat and has higher priority.

As mentioned above, The priority of user configuration is always higher than system’s, so we can get the priority sorting of server and chat group:

server-list(user) >
top level server(user) >
server-list(system) >
top level server(system)

chat-list in server-list(user) >
chat in server-list(user) >
chat-list in top level server(user) >
chat in top level server(user) >
chat-list in server-list(system) >
chat in server-list(system) >
chat-list in top level server(system) >
chat in top level server(system)

All Configurable Items#

Here is the default system wide configuration file used by Srain, all configurable items are already listed here. you can make a copy as your user configuration file, but note:

  1. User configuration always overwrite system’s, if you don’t know what does this option means, please remove it from your user configuration rather than overwrite it

  2. The server’s name in server-list is unique, please remoeve the duplicated server in server-list before using

# Srain built-in configuration file
# Application configuration.

version = "1.0.0rc5"        # String; Every configuration file should have a
                            # version, altough it is not used yet
# id = "im.srain.Srain"       # The identifier for Srain
theme = "default-bubble"    # String; Theme; Available values: default
csd = true                  # Bool; Whether enable Client-Side Decoration
send-on-ctrl-enter = false  # Bool; Send messsage on CTRL+Enter pressed
exit-on-close = false       # Bool; Exit program on main window closed
auto-connect = []           # String array; Servers that are auto connected
                            # after startup
server-visibility = true    # Bool; Whether the server buffer is visible
scroll-on-new-message = false # Auto scroll when a new message is recieved
chat-list-order = "recent"  # String; Set to "alphabet" for alphabetical order sort

# If you want to report/fix a bug, terminal log will be helpful.
log =
{
    prompt-color = true     # Bool; Colorful output
    prompt-file = false     # Bool; Display the filename of the file which log
                            # statement is located
    prompt-function = true  # Bool; As aboved, function name
    prompt-line = false     # Bool; As aboved, line number

    # String array; Specify the log level of a group of files
    debug-targets   = []    # Files with debug log level
    info-targets    = []    # Files with information log level
    warn-targets    = [""]  # Files with warning log level
    error-targets   = []    # Files with error" log level
}

# Global IRC Server configuration, this group can also appear in server-list.
server =
{
    auto-join = []  # String array; Chats that are auto joined after server
                    # is created
    auto-run = []   # String array; Commands that are auto run after server
                    # is created

    user =
    {
        nickname = "SrainUser"
        username = "Srain"
        realname = "Can you can a can?"

        login:
        {
            method = "none"     # String; Login method; Available values:
                                # - none: No login method, default value
                                # - nickserv: Login with NICKSERV command
                                # - msg-nickserv: Login with /msg NickServ identify
                                # - sasl-plain: Login with SASL PLAIN mechanism
                                # - sasl-ecdsa: Login with SASL
                                #   ECDSA-NIST256P-CHALLENGE mechanism
                                # - sasl-external: Login with SASL EXTERNAL mechanism
                                #   (requires a TLS certificate set in the **server**
                                #   section, not the one just below)

            # For method "sasl-ecdsa"
            # certificate = ""  # String; Path to login ECDSA certificate file, used for
                                # sasl-ecdsa authentication (**not** sasl-external)
        }

        # Default messages for performing specified action
        part-message = "Leaving."
        kick-message = "Kick."
        away-message = "Away from keyboard."
        quit-message = "El Psy Congroo."
    }

    # Chat configuration, this group can also appear in chat-list.
    chat =
    {
        log = true                      # Bool; Persistent chat log to storage
        notify = true                   # Bool; Send notification when you are
                                        # mentioned by others or receiving any
                                        # ERROR message
        notify-all = true               # Bool; Send notification when receiving
                                        # any PRIVMSG/ACTION/NOTIFY/ERROR message
        show-topic = true               # Bool; Show topic
        show-avatar = false             # Bool; Show user avater
        show-user-list = true           # Bool; Show user list
        render-mirc-color = true        # Bool; Render mirc color
        nick-completion-suffix = ":"    # String; Suffix of completed nick name
                                        # e.g. "nick: msg"

        preview-url = true          # Bool; Show previewer for every URL
        auto-preview-url = true     # Bool; Automatically preview supported URL

        auto-run = []   # String array; Commands that are auto run after
                        # chat is created
    }

    # Specified chat configuration, every element in list should have a unique
    # ``name``.
    chat-list =
    (
        {
            # ``name`` is necessary for a ``chat`` group in ``chat-list``.
            name = "#srain"
            show-topic = true
        }
    )
}

# Specified server configuration, every element in list should have a unique
# "name".
server-list =
(
    {
        # ``name``, ``addresses`` are necessary for a ``server`` group
        # in ``server-list``, otherwise you can not connect to it.
        name = "Libera Chat"        # String; The unique name of server
        addresses = [
            "irc.libera.chat:6697"
        ]                           # String array; Addresses of IRC server,
                                    # each address follows the format of
                                    # <host>[:<port>]. The port can be omitted,
                                    # default 6667 for non-TLS and 6697 for TLS
        tls = true                  # Bool; Connect with TLS encryption
        # tls-noverify = false      # Bool; Connect with TLS encryption but without
                                    # certificate verification, only used while
                                    # connecting to a self-signed certificate
                                    # verified server
        encoding = "utf-8"          # String; Encoding of IRC server, to get
                                    # all available value of encoding, check the
                                    # output of ``iconv --list``
        # ipv6 = false              # Use IPv6 connection, not yet supported
        # certificate = "/home/you/.config/srain/libera.pem"
                                    # Client TLS certificate, that can be used for
                                    # authentication with CertFP or SASL EXTERNAL (if
                                    # ``method = "sasl-external"`` is set in the
                                    # ``user`` configuration)
    },
    {
        name = "OFTC"
        addresses = ["irc.oftc.net:6697"]
        tls = true
        encoding = "utf-8"
    },
    {
        name = "hackint"
        addresses = ["irc.hackint.org:6697"]
        tls = true
        encoding = "utf-8"
    },
    {
        name = "Rizon"
        addresses = ["irc.rizon.net:6697"]

        tls = true
        encoding = "utf-8"
    },
    {
        name = "DALnet"
        addresses = [
            "irc.dal.net:6697",
            "agility.nl.eu.dal.net:6697",
            "bifrost.ca.us.dal.net:6697",
            "bitcoin.uk.eu.dal.net:6697",
            "choopa.nj.us.dal.net:6697",
            "diamond.hub.dal.net:6697",
            "fidelity.tx.us.dal.net:6697",
            "foxtrot.hub.dal.net:6697",
            "halcyon.il.us.dal.net:6697",
            "hash.ix.nl.dal.net:6697",
            "hoon.ix.au.dal.net:6697",
            "istana.ix.sg.dal.net:6697",
            "jingo.ix.us.dal.net:6697",
            "karsk.ix.eu.dal.net:6697",
            "kiwi.ix.nz.dal.net:6697",
            "koala.vc.au.dal.net:6697",
            "laud.ix.us.dal.net:6697",
            "loyalty.ix.us.dal.net:6697",
            "merlin.hub.dal.net:6697",
            "midnight.hub.dal.net:6697",
            "ninja.hub.dal.net:6697",
            "nonstop.ix.me.dal.net:6697",
            "oi.ix.au.dal.net:6697",
            "oper-e.dal.net:6697",
            "paradigm.hub.dal.net:6697",
            "powertech.no.eu.dal.net:6697",
            "punch.wa.us.dal.net:6697",
            "rangers.ix.us.dal.net:6697",
            "redemption.ix.us.dal.net:6697",
            "renew.hub.dal.net:6697",
            "smurf.hub.dal.net:6697",
            "underworld.se.eu.dal.net:6697",
            "uworld.hub.dal.net:6697"
        ]
        tls = true
        encoding = "utf-8"
    },
    {
        name = "EFnet"
        addresses = [
            "irc.efnet.fr:6667",
            "efnet.port80.se:6697",
            "efnet.portlane.se:6667",
            "irc.du.se:6667",
            "irc.homelien.no:6667",
            "irc.inet.tele.dk:6667",
            "irc.nordunet.se:6667",
            "irc.underworld.no:6667",
            "irc.choopa.net:6697",
            "irc.colosolutions.net:6667",
            "irc.mzima.net:6667",
            "irc.prison.netirc.servercentral.net:6667"
        ]
        tls = false
        encoding = "utf-8"
    },
    {
        name = "IRCnet"
        addresses = [
            "irc.ssl.ircnet.com:6697",
            "irc.ircnet.com:6667",
            "irc.at.ircnet.com:6667",
            "irc.be.ircnet.com:6667",
            "irc.cz.ircnet.com:6667",
            "irc.dk.ircnet.com:6667",
            "irc.ee.ircnet.com:6667",
            "irc.fi.ircnet.com:6667",
            "irc.fr.ircnet.com:6667",
            "irc.de.ircnet.com:6667",
            "irc.hu.ircnet.com:6667",
            "irc.it.ircnet.com:6667",
            "irc.jp.ircnet.com:6667",
            "irc.nl.ircnet.com:6667",
            "irc.no.ircnet.com:6667",
            "irc.pl.ircnet.com:6667",
            "irc.si.ircnet.com:6667",
            "irc.se.ircnet.com:6667",
            "irc.us.ircnet.com:6667"
        ]
        tls = false
        encoding = "utf-8"
    },
    {
        name = "Undernet"
        addresses = [
            "irc.undernet.org:6667",
            "ix1.undernet.org:6667",
            "ix2.undernet.org:6667",
            "ashburn.va.us.undernet.org:6667",
            "bucharest.ro.eu.undernet.org:6667",
            "budapest.hu.eu.undernet.org:6667",
            "chicago.il.us.undernet.org:6667"
        ]
        tls = false
        encoding = "utf-8"
    },
    {
        name = "QuakeNet"
        addresses = [
            "irc.quakenet.org:6667",
            "dreamhack.se.quakenet.org:6667",
            "euroserv.fr.quakenet.org:6667",
            "irc.ipv6.quakenet.org:6667",
            "port80a.se.quakenet.org:6667",
            "port80b.se.quakenet.org:6667",
            "port80c.se.quakenet.org:6667",
            "portlane.se.quakenet.org:6667",
            "servercentral.il.us.quakenet.org:6667",
            "underworld1.no.quakenet.org:6667"
        ]
        tls = false
        encoding = "utf-8"
    },
    {
        name = "freenode"
        addresses = [
            "irc.freenode.net:6697",
            "chat.freenode.net:6697",
            "irc.freenode.org:6697",
            "chat.freenode.org:6697"
        ]
        tls = true
        encoding = "utf-8"
    },
    {
        name = "localhost"
        addresses = ["localhost:6667", "127.0.0.1:6667"]
        tls = false
    }

# TODO: More predefined servers
)