1
0
mirror of https://github.com/minetest-mods/irc.git synced 2024-12-28 09:40:17 +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 - Added automatic reconnection in case the bot is kicked from the
channel. channel.
- Fixed delay while the bot waits for the Message Of The Day (or topic) - 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: Version 0.1.1:
- Moved all user configuration to `config.lua'. - Moved all user configuration to `config.lua'.

View File

@ -113,12 +113,18 @@ minetest.register_on_leaveplayer(function ( player )
end); end);
minetest.register_on_chat_message(function ( name, message ) 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 (message:sub(1, 1) == "/") then return; end
if (not mt_irc.connected_players[name]) then if (not mt_irc.connected_players[name]) then
--minetest.chat_send_player(name, "IRC: You are not connected. Please use /join"); --minetest.chat_send_player(name, "IRC: You are not connected. Please use /join");
return; return;
end 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 if (not mt_irc.buffered_messages) then
mt_irc.buffered_messages = { }; mt_irc.buffered_messages = { };
end end

View File

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