Tip of the day: Channel mode +H provides Channel history to modern clients. Optionally, it can be stored on-disk to be preserved between server restarts.

Defines and conditional config

From UnrealIRCd documentation wiki
Jump to navigation Jump to search

You can define variables in the configuration file and use these variables elsewhere in the configuration file. You can also use this for conditional configuration. This can be used by advanced users, especially when sharing settings between servers and trying to use the same configuration files for all your servers.

Defining variables

You can define variables, like:

@define $SERVER "hub.example.org"

Using variables

Anywhere in the configuration file you can refer to $VARIABLENAME. For example:

me {
        name "$SERVER";
        info "TestNET Server ($SERVER)";
        sid 001;
}

Conditional configuration

You can use @if to activate/deactivate configuration depending on conditions:

@if $SERVER == "hub.example.org"
link {
        [..]
}
@endif

There are only a few operations supported, namely:

Type of check Syntax example
Checking if the value of a variable matches @if $VARNAME == "something"
Checking if the value of a variable does NOT match @if $VARNAME != "something"
Check if a variable is defined (via @define earlier) @if defined(VARNAME)
Check if a variable is NOT defined (via @define earlier) @if !defined(VARNAME)
Check if a module is loaded @if module-loaded("somemod")
Check if a module is NOT loaded @if !module-loaded("somemod")

The help.conf shipped with UnrealIRCd uses @if module-loaded() so /HELPOP CHMODES only displays certain lines if the module is actually loaded:

helpop chmodes {
        [..]
@if module-loaded("chanmodes/noctcp")
        " C = No CTCPs allowed in the channel [h]";
@endif
}