This commit is contained in:
ShadowNinja
2013-04-29 18:07:44 -04:00
parent 3aede000b7
commit c7f989dd85
105 changed files with 946 additions and 22249 deletions

View File

@ -1,72 +1,91 @@
-- IRC Mod for Minetest
-- By Diego Martínez <kaeza@users.sf.net>
--
-- This mod allows to tie a Minetest server to an IRC channel.
--
-- This program is free software. It comes without any warranty, to
-- the extent permitted by applicable law. You can redistribute it
-- and/or modify it under the terms of the Do What The Fuck You Want
-- To Public License, Version 2, as published by Sam Hocevar. See
-- http://sam.zoy.org/wtfpl/COPYING for more details.
--
-- This file is licensed under the terms of the BSD 2-clause license.
-- See LICENSE.txt for details.
-- *************************
-- ** BASIC USER SETTINGS **
-- *************************
local config = {}
-------------------------
-- BASIC USER SETTINGS --
-------------------------
-- Nickname (string, default "minetest-"..<server-id>)
-- (<server-id> is a random string of 6 hexidecimal numbers).
config.nick = minetest.setting_get("irc.nick")
-- Server to connect on joinplayer (string, default "irc.freenode.net")
mt_irc.server = minetest.setting_get("mt_irc.server") or "irc.freenode.net";
config.server = minetest.setting_get("irc.server") or "irc.freenode.net"
-- Port to connect on joinplayer (number, default 6667)
mt_irc.port = tonumber(minetest.setting_get("mt_irc.port")) or 6667;
config.port = tonumber(minetest.setting_get("irc.port")) or 6667
-- NickServ password
config.NSPass = minetest.setting_get("irc.NSPass")
-- SASL password (Blank to disable SASL authentication)
config.SASLPass = minetest.setting_get("irc.SASLPass")
-- Channel to connect on joinplayer (string, default "##mt-irc-mod")
mt_irc.channel = minetest.setting_get("mt_irc.channel") or "##mt-irc-mod";
config.channel = minetest.setting_get("irc.channel") or "##mt-irc-mod"
-- ***********************
-- ** ADVANCED SETTINGS **
-- ***********************
-- Key for the channel (string, default nil)
config.key = minetest.setting_get("irc.key")
-- Time between chat updates in seconds (number, default 0.2).
mt_irc.dtime = tonumber(minetest.setting_get("mt_irc.dtime")) or 0.2;
-----------------------
-- ADVANCED SETTINGS --
-----------------------
-- Server password (string, default "")
config.password = minetest.setting_get("irc.password")
-- SASL username
config.SASLUser = minetest.setting_get("irc.SASLUser") or config.nick
-- Enable a TLS connection, requires LuaSEC (bool, default false)
config.secure = minetest.setting_getbool("irc.secure")
-- Time between chat updates in seconds (number, default 2.1). Setting this too low can cause "Excess flood" disconnects.
config.interval = tonumber(minetest.setting_get("irc.interval")) or 2.0
-- Underlying socket timeout in seconds (number, default 60.0).
mt_irc.timeout = tonumber(minetest.setting_get("mt_irc.timeout")) or 60.0;
config.timeout = tonumber(minetest.setting_get("irc.timeout")) or 60.0
-- Nickname when using single conection (string, default "minetest-"..<server-id>);
-- (<server-id> is a random string of 6 hexidecimal numbers).
mt_irc.server_nick = minetest.setting_get("mt_irc.server_nick");
-- Password to use when using single connection (string, default "")
mt_irc.password = minetest.setting_get("mt_irc.password");
-- Prefix to use for bot commands (char, default '!')
config.command_prefix = minetest.setting_get("irc.command_prefix") or '!'
config.command_prefix = config.command_prefix:sub(1, 1)
-- The format of messages sent to IRC server (string, default "<$(name)> $(message)")
-- See `README.txt' for the macros supported here.
mt_irc.message_format_out = minetest.setting_get("mt_irc.message_format_out") or "<$(name)> $(message)";
config.format_out = minetest.setting_get("irc.format_out") or "<$(name)> $(message)"
-- The format of messages sent to IRC server (string, default "<$(name)@IRC> $(message)")
-- See `README.txt' for the macros supported here.
mt_irc.message_format_in = minetest.setting_get("mt_irc.message_format_in") or "<$(name)@IRC> $(message)";
config.format_in = minetest.setting_get("irc.format_in") or "<$(name)@IRC> $(message)"
-- Enable debug output (boolean, default false)
mt_irc.debug = not minetest.setting_getbool("mt_irc.disable_debug");
config.debug = minetest.setting_getbool("irc.debug")
-- Whether to automatically join the channed when player joins
-- Whether to enable players joining and parting the channel
config.enable_player_part = not minetest.setting_getbool("irc.disable_player_part")
-- Whether to automatically join the channel when player joins
-- (boolean, default true)
mt_irc.auto_join = not minetest.setting_getbool("mt_irc.disable_auto_join");
config.auto_join = not minetest.setting_getbool("irc.disable_auto_join")
-- Whether to automatically connect to the server on mod load
-- (boolean, default true)
mt_irc.auto_connect = not minetest.setting_getbool("mt_irc.disable_auto_connect");
-- (boolean, default true)
config.auto_connect = not minetest.setting_getbool("irc.disable_auto_connect")
-- Set default server nick if not specified.
if (not mt_irc.server_nick) then
local pr = PseudoRandom(os.time());
if not config.nick then
local pr = PseudoRandom(os.time())
-- Workaround for bad distribution in minetest PRNG implementation.
local fmt = "minetest-%02X%02X%02X";
mt_irc.server_nick = fmt:format(
config.nick = ("MT-%02X%02X%02X"):format(
pr:next(0, 255),
pr:next(0, 255),
pr:next(0, 255)
);
)
end
mt_irc.config = config