check whisper messages

don't trust the server
This commit is contained in:
Henri Derycke 2019-03-18 21:49:47 +01:00
parent e59c927ec5
commit 63f4b3ec3f

View file

@ -382,10 +382,19 @@ void CChat::AddLine(int ClientID, int Mode, const char *pLine, int TargetID)
g_Config.m_ClFilterchat == 2 ||
(m_pClient->m_LocalClientID != ClientID && g_Config.m_ClFilterchat == 1 && !m_pClient->m_aClients[ClientID].m_Friend))))
return;
if(Mode == CHAT_WHISPER && (TargetID == -1 || !m_pClient->m_aClients[TargetID].m_Active || // unknown client
m_pClient->m_aClients[TargetID].m_ChatIgnore || g_Config.m_ClFilterchat == 2 ||
(m_pClient->m_LocalClientID != TargetID && g_Config.m_ClFilterchat == 1 && !m_pClient->m_aClients[TargetID].m_Friend)))
return;
if(Mode == CHAT_WHISPER)
{
// unknown client
if(ClientID == -1 || !m_pClient->m_aClients[ClientID].m_Active || TargetID == -1 || !m_pClient->m_aClients[TargetID].m_Active)
return;
// should be sender or receiver
if(ClientID != m_pClient->m_LocalClientID && TargetID != m_pClient->m_LocalClientID)
return;
// ignore and chat filter
if(m_pClient->m_aClients[TargetID].m_ChatIgnore || g_Config.m_ClFilterchat == 2 ||
(m_pClient->m_LocalClientID != TargetID && g_Config.m_ClFilterchat == 1 && !m_pClient->m_aClients[TargetID].m_Friend))
return;
}
// trim right and set maximum length to 128 utf8-characters
int Length = 0;