1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 17:50:37 +01:00

Updated default IRC's configuration

This commit is contained in:
LeMagnesium 2015-04-02 17:39:58 +02:00
parent 2f9656f359
commit 7fa1375fee

View File

@ -4,7 +4,7 @@
irc.config = {} irc.config = {}
local function setting(stype, name, default) local function setting(stype, name, default, required)
local value local value
if stype == "bool" then if stype == "bool" then
value = minetest.setting_getbool("irc."..name) value = minetest.setting_getbool("irc."..name)
@ -14,6 +14,10 @@ local function setting(stype, name, default)
value = tonumber(minetest.setting_get("irc."..name)) value = tonumber(minetest.setting_get("irc."..name))
end end
if value == nil then if value == nil then
if required then
error("Required configuration option irc."..
name.." missing.")
end
value = default value = default
end end
irc.config[name] = value irc.config[name] = value
@ -23,13 +27,13 @@ end
-- BASIC USER SETTINGS -- -- BASIC USER SETTINGS --
------------------------- -------------------------
setting("string", "nick") -- Nickname (default "MT-<hash>", <hash> 6 random hexidecimal characters) setting("string", "nick", nil, true) -- Nickname
setting("string", "server", "irc.freenode.net") -- Server to connect on joinplayer setting("string", "server", nil, true) -- Server address to connect to
setting("number", "port", 6667) -- Port to connect on joinplayer setting("number", "port", 6667) -- Server port to connect to
setting("string", "NSPass") -- NickServ password setting("string", "NSPass") -- NickServ password
setting("string", "sasl.user", irc.config.nick) -- SASL username setting("string", "sasl.user", irc.config.nick) -- SASL username
setting("string", "sasl.pass") -- SASL password setting("string", "sasl.pass") -- SASL password
setting("string", "channel", "##mt-irc-mod") -- Channel to join setting("string", "channel", nil, true) -- Channel to join
setting("string", "key") -- Key for the channel setting("string", "key") -- Key for the channel
setting("bool", "send_join_part", true) -- Whether to send player join and part messages to the channel setting("bool", "send_join_part", true) -- Whether to send player join and part messages to the channel
@ -46,14 +50,3 @@ setting("bool", "enable_player_part", true) -- Whether to enable players joini
setting("bool", "auto_join", true) -- Whether to automatically show players in the channel when they join setting("bool", "auto_join", true) -- Whether to automatically show players in the channel when they join
setting("bool", "auto_connect", true) -- Whether to automatically connect to the server on mod load setting("bool", "auto_connect", true) -- Whether to automatically connect to the server on mod load
-- Generate a random nickname if one isn't specified.
if not irc.config.nick then
local pr = PseudoRandom(os.time())
-- Workaround for bad distribution in minetest PRNG implementation.
irc.config.nick = ("MT-%02X%02X%02X"):format(
pr:next(0, 255),
pr:next(0, 255),
pr:next(0, 255)
)
end