1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Fix sending color codes to clients that don't support them. (#5950)

Also remove `disable_escape_sequences` since it's not needed anymore.
This commit is contained in:
red-001 2017-06-09 20:39:25 +01:00 committed by SmallJoker
parent 44495ea719
commit 740b4bec07
3 changed files with 28 additions and 48 deletions

View file

@ -1643,15 +1643,18 @@ void Server::SendInventory(PlayerSAO* playerSAO)
void Server::SendChatMessage(u16 peer_id, const std::wstring &message)
{
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_CHAT_MESSAGE, 0, peer_id);
pkt << message;
if (peer_id != PEER_ID_INEXISTENT) {
NetworkPacket pkt(TOCLIENT_CHAT_MESSAGE, 0, peer_id);
if (m_clients.getProtocolVersion(peer_id) < 27)
pkt << unescape_enriched(message);
else
pkt << message;
Send(&pkt);
}
else {
m_clients.sendToAll(&pkt);
} else {
for (u16 id : m_clients.getClientIDs())
SendChatMessage(id, message);
}
}