aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2017-06-09 20:39:25 +0100
committerSmallJoker <SmallJoker@users.noreply.github.com>2017-06-09 21:39:25 +0200
commit740b4bec07b0a43943c9d4a20a2dc1abf4c90db9 (patch)
treed6ca194ce2dac6e59d62df59d86efded876f3eca /src
parent44495ea719b98aca341b9082521d0d4ee51405c8 (diff)
downloadminetest-740b4bec07b0a43943c9d4a20a2dc1abf4c90db9.tar.gz
minetest-740b4bec07b0a43943c9d4a20a2dc1abf4c90db9.tar.bz2
minetest-740b4bec07b0a43943c9d4a20a2dc1abf4c90db9.zip
Fix sending color codes to clients that don't support them. (#5950)
Also remove `disable_escape_sequences` since it's not needed anymore.
Diffstat (limited to 'src')
-rw-r--r--src/server.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 0351fa13b..52eb97608 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1643,15 +1643,18 @@ void Server::SendInventory(PlayerSAO* playerSAO)
void Server::SendChatMessage(u16 peer_id, const std::wstring &message)
{
DSTACK(FUNCTION_NAME);
+ if (peer_id != PEER_ID_INEXISTENT) {
+ NetworkPacket pkt(TOCLIENT_CHAT_MESSAGE, 0, peer_id);
- NetworkPacket pkt(TOCLIENT_CHAT_MESSAGE, 0, peer_id);
- pkt << message;
+ if (m_clients.getProtocolVersion(peer_id) < 27)
+ pkt << unescape_enriched(message);
+ else
+ pkt << message;
- if (peer_id != PEER_ID_INEXISTENT) {
Send(&pkt);
- }
- else {
- m_clients.sendToAll(&pkt);
+ } else {
+ for (u16 id : m_clients.getClientIDs())
+ SendChatMessage(id, message);
}
}