Limit chat to 1000 characters

This commit is contained in:
Benau 2019-08-11 02:11:48 +08:00
parent 1397f3834f
commit 88adfbc8df
2 changed files with 2 additions and 2 deletions

View File

@ -1341,7 +1341,7 @@ void ClientLobby::sendChat(irr::core::stringw text)
name = PlayerManager::getCurrentOnlineProfile()->getUserName(); name = PlayerManager::getCurrentOnlineProfile()->getUserName();
else else
name = player->getName(); name = player->getName();
chat->encodeString16(name + L": " + text); chat->encodeString16(name + L": " + text, 1000/*max_len*/);
STKHost::get()->sendToServer(chat, true); STKHost::get()->sendToServer(chat, true);
delete chat; delete chat;

View File

@ -595,7 +595,7 @@ void ServerLobby::handleChat(Event* event)
event->getPeer()->updateLastActivity(); event->getPeer()->updateLastActivity();
const bool sender_in_game = event->getPeer()->isWaitingForGame(); const bool sender_in_game = event->getPeer()->isWaitingForGame();
core::stringw message; core::stringw message;
event->data().decodeString16(&message); event->data().decodeString16(&message, 1000/*max_len*/);
if (message.size() > 0) if (message.size() > 0)
{ {
NetworkString* chat = getNetworkString(); NetworkString* chat = getNetworkString();