mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Merge pull request #7866 from heinrich5991/pr_ddnet_redundant_utf8_checks
Remove redundant UTF-8 checks
This commit is contained in:
commit
83942f9a50
|
@ -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)
|
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];
|
CPlayer *pPlayer = m_apPlayers[ClientID];
|
||||||
bool Check = !pPlayer->m_NotEligibleForFinish && pPlayer->m_EligibleForFinishCheck + 10 * time_freq() >= time_get();
|
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)
|
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 aSixupDesc[VOTE_DESC_LENGTH] = {0};
|
||||||
char aCmd[VOTE_CMD_LENGTH] = {0};
|
char aCmd[VOTE_CMD_LENGTH] = {0};
|
||||||
char aReason[VOTE_REASON_LENGTH] = "No reason given";
|
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])
|
if(pMsg->m_pReason[0])
|
||||||
{
|
{
|
||||||
str_copy(aReason, pMsg->m_pReason, sizeof(aReason));
|
str_copy(aReason, pMsg->m_pReason, sizeof(aReason));
|
||||||
|
@ -2557,10 +2549,6 @@ void CGameContext::OnChangeInfoNetMessage(const CNetMsg_Cl_ChangeInfo *pMsg, int
|
||||||
|
|
||||||
bool SixupNeedsUpdate = false;
|
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->m_LastChangeInfo = Server()->Tick();
|
||||||
pPlayer->UpdatePlaytime();
|
pPlayer->UpdatePlaytime();
|
||||||
|
|
||||||
|
@ -2771,22 +2759,6 @@ void CGameContext::OnStartInfoNetMessage(const CNetMsg_Cl_StartInfo *pMsg, int C
|
||||||
if(pPlayer->m_IsReady)
|
if(pPlayer->m_IsReady)
|
||||||
return;
|
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();
|
pPlayer->m_LastChangeInfo = Server()->Tick();
|
||||||
|
|
||||||
// set start infos
|
// set start infos
|
||||||
|
|
Loading…
Reference in a new issue