設定檔語法

From UnrealIRCd documentation wiki
Jump to navigation Jump to search
This page is a translated version of the page Configuration file syntax and the translation is 44% complete.
Other languages:
English • ‎中文(台灣)‎

UnrealIRCd設定檔使用模組格式,每個模組都有不同的形式,舉例來說,有可能長這樣:

<模組名> <模組值> {
	<模組指令> <指令值>;
}

<模組名>是模組的名稱像是me就是Me模組,又例如adminAdmin模組

<模組值>不一定都會出現,但若出現則有可能有兩種涵義:1)有時候它指名了特定的值像是:bobsmithoper bobsmith {,2)其他時候則是定義子類別像是deny dcc {

<模組指令>是一個獨立變數賦予模組特定的值。<指令值> 是關聯的值,如果<指令值>包含空格或代表註解的字元則必須使用雙誇號像是某些值"某 一 些 有 空 格 的 值";。(如果你想在誇號內加入誇號,請使用\",這樣"就會被認為是誇號內的字元)。

最後<模組指令>可能也包含指令,諸如此類。

Note: the configuration file is currently case sensitive so BLOCK-NAME is not the same as block-name.

IMPORTANT: You must terminate each line with a ; and terminate each block with a }. Only the start and end of the block (eg: me {) has no terminating ; character. If you forget a } or ; somewhere then UnrealIRCd will fail to read your configuration file correctly and will not boot!

Examples (correct):

me {
        name "irc.something.net";
        sid 001;
        info "Some nice server";
}
log ircd.log {
        flags {
                errors;
        }
}
set {
        maxchannelsperuser 10;

        options {
                hide-ulines;
        }
        
        anti-flood {
                connect-flood 3:60;
                nick-flood 3:60;
        }
}

Important: there is a special notation used to talk about entries in the config file and we use it throughout the UnrealIRCd documentation. Take the first example from above (the me block), the name is set to irc.something.net, we call this variable me::name. Similarly, in the last example we would refer to the connect-flood directive as set::anti-flood::connect-flood, and we call that block the set::anti-flood block.

You can also put comments in the configuration file. Comments are text that isn't interpreted by UnrealIRCd and it's entirely up to you if you use it and what you write. UnrealIRCd supports 3 types of comments:

# This is a single line comment (type 1)
// This is also a single line comment (type 2)
/* This is a
   multi line
   comment */

Now that you know how the configuration file works in principle, copy conf/examples/example.conf to conf/ and rename it to unrealircd.conf. Walk through it block per block, line by line. If you want to know more about a specific section then see the top of the Configuration article for all the available blocks and directives.