summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2017-03-28 17:32:05 -0500
committercheapie <no-email-for-you@example.com>2017-03-28 17:32:05 -0500
commit55824129bd0db5ec337363618f5bab66148611ab (patch)
treeb483f7eda61d88b67baa3a274c73db5c5eae5a4e
parentc27c4dff02a9046e030ca3477d0217dd2ebc87df (diff)
downloadchat6-55824129bd0db5ec337363618f5bab66148611ab.tar
chat6-55824129bd0db5ec337363618f5bab66148611ab.tar.gz
chat6-55824129bd0db5ec337363618f5bab66148611ab.tar.bz2
chat6-55824129bd0db5ec337363618f5bab66148611ab.tar.xz
chat6-55824129bd0db5ec337363618f5bab66148611ab.zip
Some tweaks
- Now discards color information before processing (if the client is new enough to support that) - Properly recognizes messages sent by the player on IRC
-rw-r--r--init.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index 47b9728..a354e7d 100644
--- a/init.lua
+++ b/init.lua
@@ -30,6 +30,9 @@ local function get_nick_color(nick)
end
minetest.register_on_receiving_chat_messages(function(message)
+ if color and type(color.strip_colors) == "function" then
+ message = color.strip_colors(message)
+ end
local msgtype
local user
local text
@@ -45,7 +48,7 @@ minetest.register_on_receiving_chat_messages(function(message)
msgtype = "special"
text = message
end
- if user == player_name then
+ if (user == player_name) or (string.match(user,"^(.*)@") == player_name) then
msgtype = "sent_channel"
elseif string.find(text,player_name) then
msgtype = "highlight_channel"
@@ -62,7 +65,7 @@ minetest.register_on_receiving_chat_messages(function(message)
msgtype = "special"
text = message
end
- if user == player_name then
+ if (user == player_name) or (string.match(user,"^(.*)@") == player_name) then
msgtype = "sent_action"
elseif string.find(text,player_name) then
msgtype = "highlight_action"