From 55824129bd0db5ec337363618f5bab66148611ab Mon Sep 17 00:00:00 2001 From: cheapie Date: Tue, 28 Mar 2017 17:32:05 -0500 Subject: 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 --- init.lua | 7 +++++-- 1 file 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" -- cgit v1.2.3