summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorANAND <ClobberXD@gmail.com>2019-08-08 21:34:46 +0530
committerrubenwardy <rw@rubenwardy.com>2019-08-08 17:04:46 +0100
commitd1c27c7e8037e9f438741ee5f7d3b6bda22d22a0 (patch)
treefa04794d876ec4c912add9fcca36eff4a18df016 /src/server.cpp
parentcc610c74a742511e04dce91b24d09c860ca7fa1b (diff)
downloadminetest-d1c27c7e8037e9f438741ee5f7d3b6bda22d22a0.tar.gz
minetest-d1c27c7e8037e9f438741ee5f7d3b6bda22d22a0.tar.bz2
minetest-d1c27c7e8037e9f438741ee5f7d3b6bda22d22a0.zip
Allow customizing chat message format (#8529)
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 7e6208711..27388e666 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1571,7 +1571,7 @@ void Server::SendChatMessage(session_t peer_id, const ChatMessage &message)
}
void Server::SendShowFormspecMessage(session_t peer_id, const std::string &formspec,
- const std::string &formname)
+ const std::string &formname)
{
NetworkPacket pkt(TOCLIENT_SHOW_FORMSPEC, 0 , peer_id);
if (formspec.empty()){
@@ -2863,28 +2863,28 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna
{
// If something goes wrong, this player is to blame
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) {
switch (player->canSendChatMessage()) {
- case RPLAYER_CHATRESULT_FLOODING: {
- std::wstringstream ws;
- ws << L"You cannot send more messages. You are limited to "
- << g_settings->getFloat("chat_message_limit_per_10sec")
- << L" messages per 10 seconds.";
- return ws.str();
- }
- case RPLAYER_CHATRESULT_KICK:
- DenyAccess_Legacy(player->getPeerId(),
- L"You have been kicked due to message flooding.");
- return L"";
- case RPLAYER_CHATRESULT_OK:
- break;
- default:
- FATAL_ERROR("Unhandled chat filtering result found.");
+ case RPLAYER_CHATRESULT_FLOODING: {
+ std::wstringstream ws;
+ ws << L"You cannot send more messages. You are limited to "
+ << g_settings->getFloat("chat_message_limit_per_10sec")
+ << L" messages per 10 seconds.";
+ return ws.str();
+ }
+ case RPLAYER_CHATRESULT_KICK:
+ DenyAccess_Legacy(player->getPeerId(),
+ L"You have been kicked due to message flooding.");
+ return L"";
+ case RPLAYER_CHATRESULT_OK:
+ break;
+ default:
+ FATAL_ERROR("Unhandled chat filtering result found.");
}
}
@@ -2912,10 +2912,8 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna
line += L"-!- You don't have permission to shout.";
broadcast_line = false;
} else {
- line += L"<";
- line += wname;
- line += L"> ";
- line += wmessage;
+ line += narrow_to_wide(m_script->formatChatMessage(name,
+ wide_to_narrow(wmessage)));
}
/*