2013-01-08 16:50:47 +01:00
|
|
|
-- 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.
|
|
|
|
--
|
|
|
|
|
2012-12-14 23:33:44 +01:00
|
|
|
-- *************************
|
|
|
|
-- ** BASIC USER SETTINGS **
|
|
|
|
-- *************************
|
|
|
|
|
|
|
|
-- Server to connect on joinplayer (string, default "irc.freenode.net")
|
2013-04-20 20:03:34 +02:00
|
|
|
mt_irc.server = minetest.setting_get("mt_irc.server") or "irc.freenode.net";
|
2012-12-14 23:33:44 +01:00
|
|
|
|
|
|
|
-- Port to connect on joinplayer (number, default 6667)
|
2013-04-20 20:03:34 +02:00
|
|
|
mt_irc.port = tonumber(minetest.setting_get("mt_irc.port")) or 6667;
|
2012-12-14 23:33:44 +01:00
|
|
|
|
2013-01-08 16:50:47 +01:00
|
|
|
-- Channel to connect on joinplayer (string, default "##mt-irc-mod")
|
2013-04-20 20:03:34 +02:00
|
|
|
mt_irc.channel = minetest.setting_get("mt_irc.channel") or "##mt-irc-mod";
|
2012-12-14 23:33:44 +01:00
|
|
|
|
|
|
|
-- ***********************
|
|
|
|
-- ** ADVANCED SETTINGS **
|
|
|
|
-- ***********************
|
|
|
|
|
|
|
|
-- Time between chat updates in seconds (number, default 0.2).
|
2013-04-20 20:03:34 +02:00
|
|
|
mt_irc.dtime = tonumber(minetest.setting_get("mt_irc.dtime")) or 0.2;
|
2012-12-14 23:33:44 +01:00
|
|
|
|
2013-04-20 20:03:34 +02:00
|
|
|
-- Underlying socket timeout in seconds (number, default 60.0).
|
|
|
|
mt_irc.timeout = tonumber(minetest.setting_get("mt_irc.timeout")) or 60.0;
|
2012-12-14 23:33:44 +01:00
|
|
|
|
|
|
|
-- Nickname when using single conection (string, default "minetest-"..<server-id>);
|
2013-04-20 20:03:34 +02:00
|
|
|
-- (<server-id> is a random string of 6 hexidecimal numbers).
|
2013-03-29 06:18:14 +01:00
|
|
|
mt_irc.server_nick = minetest.setting_get("mt_irc.server_nick");
|
2012-12-14 23:33:44 +01:00
|
|
|
|
|
|
|
-- Password to use when using single connection (string, default "")
|
2013-03-29 06:18:14 +01:00
|
|
|
mt_irc.password = minetest.setting_get("mt_irc.password");
|
2012-12-14 23:33:44 +01:00
|
|
|
|
|
|
|
-- The format of messages sent to IRC server (string, default "<$(name)> $(message)")
|
|
|
|
-- See `README.txt' for the macros supported here.
|
2013-03-29 06:18:14 +01:00
|
|
|
mt_irc.message_format_out = minetest.setting_get("mt_irc.message_format_out") or "<$(name)> $(message)";
|
2012-12-14 23:33:44 +01:00
|
|
|
|
|
|
|
-- The format of messages sent to IRC server (string, default "<$(name)@IRC> $(message)")
|
|
|
|
-- See `README.txt' for the macros supported here.
|
2013-03-29 06:18:14 +01:00
|
|
|
mt_irc.message_format_in = minetest.setting_get("mt_irc.message_format_in") or "<$(name)@IRC> $(message)";
|
2012-12-14 23:33:44 +01:00
|
|
|
|
|
|
|
-- Enable debug output (boolean, default false)
|
2013-03-29 06:39:41 +01:00
|
|
|
mt_irc.debug = not minetest.setting_getbool("mt_irc.disable_debug");
|
2012-12-16 16:56:02 +01:00
|
|
|
|
|
|
|
-- Whether to automatically join the channed when player joins
|
2013-01-02 00:15:45 +01:00
|
|
|
-- (boolean, default true)
|
2013-03-29 06:39:41 +01:00
|
|
|
mt_irc.auto_join = not minetest.setting_getbool("mt_irc.disable_auto_join");
|
2012-12-16 16:56:02 +01:00
|
|
|
|
|
|
|
-- Whether to automatically connect to the server on mod load
|
2013-01-02 00:15:45 +01:00
|
|
|
-- (boolean, default true)
|
2013-03-29 06:39:41 +01:00
|
|
|
mt_irc.auto_connect = not minetest.setting_getbool("mt_irc.disable_auto_connect");
|
2013-04-20 20:03:34 +02:00
|
|
|
|
|
|
|
-- Set default server nick if not specified.
|
|
|
|
if (not mt_irc.server_nick) then
|
2013-04-25 23:00:44 +02:00
|
|
|
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(
|
|
|
|
pr:next(0, 255),
|
|
|
|
pr:next(0, 255),
|
|
|
|
pr:next(0, 255)
|
|
|
|
);
|
2013-04-20 20:03:34 +02:00
|
|
|
end
|