diff --git a/README.txt b/README.txt index 9fc2283..081d990 100644 --- a/README.txt +++ b/README.txt @@ -109,6 +109,9 @@ Once the game is connected to the IRC channel, chatting using the 'T' or by anyone. Also, when someone sends a message to the channel, that text will be visible in-game. +Messages that begin with "[off]" from in-game or IRC are not sent to the + other side. + This mod also adds a few chat commands: /irc_msg diff --git a/src/callback.lua b/src/callback.lua index 0104f7a..847f481 100644 --- a/src/callback.lua +++ b/src/callback.lua @@ -21,6 +21,7 @@ end) minetest.register_on_chat_message(function(name, message) if not mt_irc.connected or message:sub(1, 1) == "/" + or message:sub(1, 5) == "[off]" or not mt_irc.joined_players[name] or (not minetest.check_player_privs(name, {shout=true})) then return diff --git a/src/hooks.lua b/src/hooks.lua index d7cf803..baa636e 100644 --- a/src/hooks.lua +++ b/src/hooks.lua @@ -109,6 +109,8 @@ function mt_irc.hooks.channelChat(user, channel, message) if mt_irc:check_botcmd(user, channel, message) then return + elseif message:sub(1, 5) == "[off]" then + return elseif foundchat then mt_irc:sendLocal(("<%s@%s> %s") :format(chatnick, user.nick, chatmessage))