Add "[off]" prefix for messages not to be sent to the "other side".

If an in-game message begins with "[off]", it's not sent to IRC,
and vice-versa.
This commit is contained in:
kaeza 2013-12-27 12:57:35 -02:00
parent aa299b7a10
commit 10f32b77b0
3 changed files with 6 additions and 0 deletions

View File

@ -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 <nick> <message>

View File

@ -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

View File

@ -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))