1
0
mirror of https://github.com/minetest-mods/irc.git synced 2024-11-05 01:30:19 +01:00

Fixed player being able to chat on IRC even with no shout privilege

This commit is contained in:
Diego Martínez 2013-01-08 14:13:41 -02:00
parent 57cc54ec8c
commit 4baafeec46
3 changed files with 9 additions and 2 deletions

View File

@ -11,6 +11,7 @@ Version 0.1.2:
- Added automatic reconnection in case the bot is kicked from the
channel.
- Fixed delay while the bot waits for the Message Of The Day (or topic)
- Added automatic reconnection in case of ping timeout.
Version 0.1.1:
- Moved all user configuration to `config.lua'.

View File

@ -113,12 +113,18 @@ minetest.register_on_leaveplayer(function ( player )
end);
minetest.register_on_chat_message(function ( name, message )
if (not mt_irc.connect_ok) then return; end
if (message:sub(1, 1) == "/") then return; end
if (not mt_irc.connected_players[name]) then
--minetest.chat_send_player(name, "IRC: You are not connected. Please use /join");
return;
end
if (not mt_irc.connect_ok) then return; end
local privs = minetest.get_player_privs(name);
if (not privs.shout) then
minetest.chat_send_player(name, "IRC: No shout priv");
irc.say(mt_irc.channel, "DEBUG: message from unpriviledged player: "..name);
return;
end
if (not mt_irc.buffered_messages) then
mt_irc.buffered_messages = { };
end

View File

@ -36,7 +36,7 @@ mt_irc.timeout = nil;
-- Nickname when using single conection (string, default "minetest-"..<server-id>);
-- (<server-id> is the server IP address packed as a 32 bit integer).
mt_irc.server_nick = "HelloIRC";
mt_irc.server_nick = nil;
-- Password to use when using single connection (string, default "")
mt_irc.password = nil;