Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Client/mods/deathmatch/logic/CPacketHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,8 @@ void CPacketHandler::Packet_ChatEcho(NetBitStreamInterface& bitStream)
bitStream.Read(szMessage, iNumberOfBytesUsed);
szMessage[iNumberOfBytesUsed] = 0;
// actual limits enforced on the remote client, this is the maximum a string can be to be printed.
if (MbUTF8ToUTF16(szMessage).size() <=
SString textToProcess = bColorCoded ? RemoveColorCodes(szMessage) : szMessage;
if (MbUTF8ToUTF16(textToProcess).size() <=
MAX_CHATECHO_LENGTH + 6) // Extra 6 characters to fix #7125 (Teamsay + long name + long message = too long message)
{
// Strip it for bad characters
Expand Down
32 changes: 19 additions & 13 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,21 +260,27 @@ bool CStaticFunctionDefinitions::ClearChatBox()

bool CStaticFunctionDefinitions::OutputChatBox(const char* szText, unsigned char ucRed, unsigned char ucGreen, unsigned char ucBlue, bool bColorCoded)
{
if (strlen(szText) <= MAX_OUTPUTCHATBOX_LENGTH)
{
CLuaArguments Arguments;
Arguments.PushString(szText);
Arguments.PushNumber(ucRed);
Arguments.PushNumber(ucGreen);
Arguments.PushNumber(ucBlue);
if (!szText || szText[0] == '\0')
return false;

SString textToProcess = bColorCoded ? RemoveColorCodes(szText) : szText;

if (textToProcess.length() > MAX_OUTPUTCHATBOX_LENGTH) {
return false;
}

bool bCancelled = !g_pClientGame->GetRootEntity()->CallEvent("onClientChatMessage", Arguments, false);
if (!bCancelled)
{
m_pCore->ChatPrintfColor("%s", bColorCoded, ucRed, ucGreen, ucBlue, szText);
return true;
}
CLuaArguments Arguments;
Arguments.PushString(szText);
Arguments.PushNumber(ucRed);
Arguments.PushNumber(ucGreen);
Arguments.PushNumber(ucBlue);

bool bCancelled = !g_pClientGame->GetRootEntity()->CallEvent("onClientChatMessage", Arguments, false);
if (!bCancelled) {
m_pCore->ChatPrintfColor("%s", bColorCoded, ucRed, ucGreen, ucBlue, szText);
return true;
}

return false;
}

Expand Down
Loading