Tip of the day: Check out Special users on how to give trusted users/bots more rights without making them IRCOp.

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
}

Default defines

The following built-in defines are available:

  • UNREALIRCD_VERSION: The full version, like 6.1.2-rc1
  • UNREALIRCD_VERSION_GENERATION: the first part of the version (generation), e.g. 6
  • UNREALIRCD_VERSION_MAJOR: the second part of the version (major version), e.g. 1
  • UNREALIRCD_VERSION_MINOR: the third part of the version (minor version), e.g. 2
  • UNREALIRCD_VERSION_SUFFIX: the last part of the version (version suffix), e.g. -rc1