mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
Add a server-sided way to remove color codes from incoming chat messages (#5948)
These code be generated by CSM, a modded client or just copy and pasted by the player. Changes - Update configuration example and setting translation file. - Remove colour codes before logging chat. - Add setting to remove colour codes before processing the chat.
This commit is contained in:
parent
07be63b287
commit
25ae0739ed
@ -721,6 +721,10 @@ server_announce (Announce server) bool false
|
|||||||
# If you want to announce your ipv6 address, use serverlist_url = v6.servers.minetest.net.
|
# If you want to announce your ipv6 address, use serverlist_url = v6.servers.minetest.net.
|
||||||
serverlist_url (Serverlist URL) string servers.minetest.net
|
serverlist_url (Serverlist URL) string servers.minetest.net
|
||||||
|
|
||||||
|
# Remove color codes from incoming chat messages
|
||||||
|
# Use this to stop players from being able to use color in their messages
|
||||||
|
strip_color_codes (Strip color codes) bool false
|
||||||
|
|
||||||
[*Network]
|
[*Network]
|
||||||
|
|
||||||
# Network port to listen (UDP).
|
# Network port to listen (UDP).
|
||||||
|
@ -344,8 +344,8 @@
|
|||||||
# serverlist_file = favoriteservers.txt
|
# serverlist_file = favoriteservers.txt
|
||||||
|
|
||||||
# Maximum size of the out chat queue. 0 to disable queueing and -1 to make the queue size unlimited
|
# Maximum size of the out chat queue. 0 to disable queueing and -1 to make the queue size unlimited
|
||||||
# type: int min: -1
|
# type: int
|
||||||
max_out_chat_queue_size = 20
|
# max_out_chat_queue_size = 20
|
||||||
|
|
||||||
## Graphics
|
## Graphics
|
||||||
|
|
||||||
@ -555,7 +555,7 @@ max_out_chat_queue_size = 20
|
|||||||
# type: int
|
# type: int
|
||||||
# screen_h = 600
|
# screen_h = 600
|
||||||
|
|
||||||
# Save the window size automatically when modified.
|
# Save window size automatically when modified.
|
||||||
# type: bool
|
# type: bool
|
||||||
# autosave_screensize = true
|
# autosave_screensize = true
|
||||||
|
|
||||||
@ -867,11 +867,10 @@ max_out_chat_queue_size = 20
|
|||||||
# type: string
|
# type: string
|
||||||
# serverlist_url = servers.minetest.net
|
# serverlist_url = servers.minetest.net
|
||||||
|
|
||||||
# Disable escape sequences, e.g. chat coloring.
|
# Remove color codes from incoming chat messages
|
||||||
# Use this if you want to run a server with pre-0.4.14 clients and you want to disable
|
# Use this to stop players from being able to use color in their messages
|
||||||
# the escape sequences generated by mods.
|
|
||||||
# type: bool
|
# type: bool
|
||||||
# disable_escape_sequences = false
|
# strip_color_codes = false
|
||||||
|
|
||||||
## Network
|
## Network
|
||||||
|
|
||||||
@ -1841,3 +1840,4 @@ max_out_chat_queue_size = 20
|
|||||||
# Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers.
|
# Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers.
|
||||||
# type: int
|
# type: int
|
||||||
# profiler_print_interval = 0
|
# profiler_print_interval = 0
|
||||||
|
|
||||||
|
@ -252,6 +252,7 @@ void set_default_settings(Settings *settings)
|
|||||||
|
|
||||||
// Server
|
// Server
|
||||||
settings->setDefault("disable_escape_sequences", "false");
|
settings->setDefault("disable_escape_sequences", "false");
|
||||||
|
settings->setDefault("strip_color_codes", "false");
|
||||||
|
|
||||||
// Network
|
// Network
|
||||||
settings->setDefault("enable_ipv6", "true");
|
settings->setDefault("enable_ipv6", "true");
|
||||||
|
@ -2880,12 +2880,15 @@ void Server::handleChatInterfaceEvent(ChatEvent *evt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::wstring Server::handleChat(const std::string &name, const std::wstring &wname,
|
std::wstring Server::handleChat(const std::string &name, const std::wstring &wname,
|
||||||
const std::wstring &wmessage, bool check_shout_priv, RemotePlayer *player)
|
std::wstring wmessage, bool check_shout_priv, RemotePlayer *player)
|
||||||
{
|
{
|
||||||
// If something goes wrong, this player is to blame
|
// If something goes wrong, this player is to blame
|
||||||
RollbackScopeActor rollback_scope(m_rollback,
|
RollbackScopeActor rollback_scope(m_rollback,
|
||||||
std::string("player:") + name);
|
std::string("player:") + name);
|
||||||
|
|
||||||
|
if (g_settings->getBool("strip_color_codes"))
|
||||||
|
wmessage = unescape_enriched(wmessage);
|
||||||
|
|
||||||
if (player) {
|
if (player) {
|
||||||
switch (player->canSendChatMessage()) {
|
switch (player->canSendChatMessage()) {
|
||||||
case RPLAYER_CHATRESULT_FLOODING: {
|
case RPLAYER_CHATRESULT_FLOODING: {
|
||||||
@ -2940,7 +2943,7 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna
|
|||||||
/*
|
/*
|
||||||
Send the message to others
|
Send the message to others
|
||||||
*/
|
*/
|
||||||
actionstream << "CHAT: " << wide_to_narrow(line) << std::endl;
|
actionstream << "CHAT: " << wide_to_narrow(unescape_enriched(line)) << std::endl;
|
||||||
|
|
||||||
std::vector<u16> clients = m_clients.getClientIDs();
|
std::vector<u16> clients = m_clients.getClientIDs();
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ private:
|
|||||||
|
|
||||||
// This returns the answer to the sender of wmessage, or "" if there is none
|
// This returns the answer to the sender of wmessage, or "" if there is none
|
||||||
std::wstring handleChat(const std::string &name, const std::wstring &wname,
|
std::wstring handleChat(const std::string &name, const std::wstring &wname,
|
||||||
const std::wstring &wmessage,
|
std::wstring wmessage_input,
|
||||||
bool check_shout_priv = false,
|
bool check_shout_priv = false,
|
||||||
RemotePlayer *player = NULL);
|
RemotePlayer *player = NULL);
|
||||||
void handleAdminChat(const ChatEventChat *evt);
|
void handleAdminChat(const ChatEventChat *evt);
|
||||||
|
@ -87,7 +87,7 @@ fake_function() {
|
|||||||
gettext("Key for increasing the volume.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
gettext("Key for increasing the volume.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
||||||
gettext("Dec. volume key");
|
gettext("Dec. volume key");
|
||||||
gettext("Key for decreasing the volume.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
gettext("Key for decreasing the volume.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
||||||
gettext("Autoforward key");
|
gettext("Automatic forwards key");
|
||||||
gettext("Key for toggling autoforward.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
gettext("Key for toggling autoforward.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
||||||
gettext("Cinematic mode key");
|
gettext("Cinematic mode key");
|
||||||
gettext("Key for toggling cinematic mode.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
gettext("Key for toggling cinematic mode.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
||||||
@ -140,6 +140,8 @@ fake_function() {
|
|||||||
gettext("URL to the server list displayed in the Multiplayer Tab.");
|
gettext("URL to the server list displayed in the Multiplayer Tab.");
|
||||||
gettext("Serverlist file");
|
gettext("Serverlist file");
|
||||||
gettext("File in client/serverlist/ that contains your favorite servers displayed in the Multiplayer Tab.");
|
gettext("File in client/serverlist/ that contains your favorite servers displayed in the Multiplayer Tab.");
|
||||||
|
gettext("Maximum size of the out chat queue");
|
||||||
|
gettext("Maximum size of the out chat queue. 0 to disable queueing and -1 to make the queue size unlimited");
|
||||||
gettext("Graphics");
|
gettext("Graphics");
|
||||||
gettext("In-Game");
|
gettext("In-Game");
|
||||||
gettext("Basic");
|
gettext("Basic");
|
||||||
@ -229,6 +231,8 @@ fake_function() {
|
|||||||
gettext("Width component of the initial window size.");
|
gettext("Width component of the initial window size.");
|
||||||
gettext("Screen height");
|
gettext("Screen height");
|
||||||
gettext("Height component of the initial window size.");
|
gettext("Height component of the initial window size.");
|
||||||
|
gettext("Autosave Screen Size");
|
||||||
|
gettext("Save window size automatically when modified.");
|
||||||
gettext("Full screen");
|
gettext("Full screen");
|
||||||
gettext("Fullscreen mode.");
|
gettext("Fullscreen mode.");
|
||||||
gettext("Full screen BPP");
|
gettext("Full screen BPP");
|
||||||
@ -249,8 +253,6 @@ fake_function() {
|
|||||||
gettext("Height on which clouds are appearing.");
|
gettext("Height on which clouds are appearing.");
|
||||||
gettext("Cloud radius");
|
gettext("Cloud radius");
|
||||||
gettext("Radius of cloud area stated in number of 64 node cloud squares.\nValues larger than 26 will start to produce sharp cutoffs at cloud area corners.");
|
gettext("Radius of cloud area stated in number of 64 node cloud squares.\nValues larger than 26 will start to produce sharp cutoffs at cloud area corners.");
|
||||||
gettext("Enable view bobbing");
|
|
||||||
gettext("Enables view bobbing when walking.");
|
|
||||||
gettext("View bobbing factor");
|
gettext("View bobbing factor");
|
||||||
gettext("Enable view bobbing and amount of view bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.");
|
gettext("Enable view bobbing and amount of view bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.");
|
||||||
gettext("Fall bobbing factor");
|
gettext("Fall bobbing factor");
|
||||||
@ -362,8 +364,8 @@ fake_function() {
|
|||||||
gettext("Automaticaly report to the serverlist.");
|
gettext("Automaticaly report to the serverlist.");
|
||||||
gettext("Serverlist URL");
|
gettext("Serverlist URL");
|
||||||
gettext("Announce to this serverlist.\nIf you want to announce your ipv6 address, use serverlist_url = v6.servers.minetest.net.");
|
gettext("Announce to this serverlist.\nIf you want to announce your ipv6 address, use serverlist_url = v6.servers.minetest.net.");
|
||||||
gettext("Disable escape sequences");
|
gettext("Strip color codes");
|
||||||
gettext("Disable escape sequences, e.g. chat coloring.\nUse this if you want to run a server with pre-0.4.14 clients and you want to disable\nthe escape sequences generated by mods.");
|
gettext("Remove color codes from incoming chat messages\nUse this to stop players from being able to use color in their messages");
|
||||||
gettext("Network");
|
gettext("Network");
|
||||||
gettext("Server port");
|
gettext("Server port");
|
||||||
gettext("Network port to listen (UDP).\nThis value will be overridden when starting from the main menu.");
|
gettext("Network port to listen (UDP).\nThis value will be overridden when starting from the main menu.");
|
||||||
@ -452,7 +454,6 @@ fake_function() {
|
|||||||
gettext("Fast mode speed");
|
gettext("Fast mode speed");
|
||||||
gettext("Climbing speed");
|
gettext("Climbing speed");
|
||||||
gettext("Jumping speed");
|
gettext("Jumping speed");
|
||||||
gettext("Descending speed");
|
|
||||||
gettext("Liquid fluidity");
|
gettext("Liquid fluidity");
|
||||||
gettext("Liquid fluidity smoothing");
|
gettext("Liquid fluidity smoothing");
|
||||||
gettext("Liquid sink");
|
gettext("Liquid sink");
|
||||||
|
Loading…
Reference in New Issue
Block a user