Defines and conditional config

From UnrealIRCd documentation wiki
Jump to navigation Jump to search

In UnrealIRCd 5 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[edit]

You can define variables, like:

@define $SERVER ""

Using variables[edit]

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

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

Conditional configuration[edit]

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

@if $SERVER == ""
link {

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]";