Merge pull request #7866 from heinrich5991/pr_ddnet_redundant_utf8_checks

Remove redundant UTF-8 checks
This commit is contained in:
Robert Müller 2024-01-27 13:03:45 +00:00 committed by GitHub
commit 83942f9a50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2047,10 +2047,6 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
void CGameContext::OnSayNetMessage(const CNetMsg_Cl_Say *pMsg, int ClientID, const CUnpacker *pUnpacker)
{
if(!str_utf8_check(pMsg->m_pMessage))
{
return;
}
CPlayer *pPlayer = m_apPlayers[ClientID];
bool Check = !pPlayer->m_NotEligibleForFinish && pPlayer->m_EligibleForFinishCheck + 10 * time_freq() >= time_get();
if(Check && str_comp(pMsg->m_pMessage, "xd sure chillerbot.png is lyfe") == 0 && pMsg->m_Team == 0)
@ -2181,10 +2177,6 @@ void CGameContext::OnCallVoteNetMessage(const CNetMsg_Cl_CallVote *pMsg, int Cli
char aSixupDesc[VOTE_DESC_LENGTH] = {0};
char aCmd[VOTE_CMD_LENGTH] = {0};
char aReason[VOTE_REASON_LENGTH] = "No reason given";
if(!str_utf8_check(pMsg->m_pType) || !str_utf8_check(pMsg->m_pReason) || !str_utf8_check(pMsg->m_pValue))
{
return;
}
if(pMsg->m_pReason[0])
{
str_copy(aReason, pMsg->m_pReason, sizeof(aReason));
@ -2557,10 +2549,6 @@ void CGameContext::OnChangeInfoNetMessage(const CNetMsg_Cl_ChangeInfo *pMsg, int
bool SixupNeedsUpdate = false;
if(!str_utf8_check(pMsg->m_pName) || !str_utf8_check(pMsg->m_pClan) || !str_utf8_check(pMsg->m_pSkin))
{
return;
}
pPlayer->m_LastChangeInfo = Server()->Tick();
pPlayer->UpdatePlaytime();
@ -2771,22 +2759,6 @@ void CGameContext::OnStartInfoNetMessage(const CNetMsg_Cl_StartInfo *pMsg, int C
if(pPlayer->m_IsReady)
return;
if(!str_utf8_check(pMsg->m_pName))
{
Server()->Kick(ClientID, "name is not valid utf8");
return;
}
if(!str_utf8_check(pMsg->m_pClan))
{
Server()->Kick(ClientID, "clan is not valid utf8");
return;
}
if(!str_utf8_check(pMsg->m_pSkin))
{
Server()->Kick(ClientID, "skin is not valid utf8");
return;
}
pPlayer->m_LastChangeInfo = Server()->Tick();
// set start infos