diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/server.cpp b/src/server.cpp index 1e8e6a5d2..e9ccc3d79 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); } } |