From 39f4a2f607d44738d60db84eba4b30e3d7450204 Mon Sep 17 00:00:00 2001 From: Pierre-Adrien Langrognet Date: Sun, 21 May 2017 23:06:51 +0200 Subject: [CSM] Add send_chat_message and run_server_chatcommand API functions (#5747) * [CSM] Add send_chat_message and run_server_chatcommand API functions * Add client-side chat message rate limiting * Limit out chat queue size * [CSM] Add minetest.clear_out_chat_queue API function and .clear_chat_queue chatcommand * Last fixes/cleanups before merge --- builtin/client/chatcommands.lua | 12 ++++++++++++ builtin/settingtypes.txt | 3 +++ 2 files changed, 15 insertions(+) (limited to 'builtin') diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua index f425216f5..2b8cc4acd 100644 --- a/builtin/client/chatcommands.lua +++ b/builtin/client/chatcommands.lua @@ -51,3 +51,15 @@ core.register_chatcommand("disconnect", { core.disconnect() end, }) + +core.register_chatcommand("clear_chat_queue", { + description = core.gettext("Clear the out chat queue"), + func = function(param) + core.clear_out_chat_queue() + return true, core.gettext("The out chat queue is now empty") + end, +}) + +function core.run_server_chatcommand(cmd, param) + core.send_chat_message("/" .. cmd .. " " .. param) +end diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 463ca0be9..0ec33c628 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -312,6 +312,9 @@ serverlist_url (Serverlist URL) string servers.minetest.net # File in client/serverlist/ that contains your favorite servers displayed in the Multiplayer Tab. serverlist_file (Serverlist file) string favoriteservers.txt +# Maximum size of the out chat queue. 0 to disable queueing and -1 to make the queue size unlimited +max_out_chat_queue_size (Maximum size of the out chat queue) int 20 + [*Graphics] [**In-Game] -- cgit v1.2.3