| 2025 | } |
| 2026 | |
| 2027 | void *CGameContext::PreProcessMsg(int *pMsgId, CUnpacker *pUnpacker, int ClientId) |
| 2028 | { |
| 2029 | if(Server()->IsSixup(ClientId) && *pMsgId < OFFSET_UUID) |
| 2030 | { |
| 2031 | void *pRawMsg = m_NetObjHandler7.SecureUnpackMsg(*pMsgId, pUnpacker); |
| 2032 | if(!pRawMsg) |
| 2033 | return nullptr; |
| 2034 | |
| 2035 | CPlayer *pPlayer = m_apPlayers[ClientId]; |
| 2036 | static char s_aRawMsg[1024]; |
| 2037 | |
| 2038 | if(*pMsgId == protocol7::NETMSGTYPE_CL_SAY) |
| 2039 | { |
| 2040 | protocol7::CNetMsg_Cl_Say *pMsg7 = (protocol7::CNetMsg_Cl_Say *)pRawMsg; |
| 2041 | // Should probably use a placement new to start the lifetime of the object to avoid future weirdness |
| 2042 | ::CNetMsg_Cl_Say *pMsg = (::CNetMsg_Cl_Say *)s_aRawMsg; |
| 2043 | |
| 2044 | if(pMsg7->m_Mode == protocol7::CHAT_WHISPER) |
| 2045 | { |
| 2046 | if(!CheckClientId(pMsg7->m_Target) || !Server()->ClientIngame(pMsg7->m_Target)) |
| 2047 | return nullptr; |
| 2048 | if(ProcessSpamProtection(ClientId)) |
| 2049 | return nullptr; |
| 2050 | |
| 2051 | WhisperId(ClientId, pMsg7->m_Target, pMsg7->m_pMessage); |
| 2052 | return nullptr; |
| 2053 | } |
| 2054 | else |
| 2055 | { |
| 2056 | pMsg->m_Team = pMsg7->m_Mode == protocol7::CHAT_TEAM; |
| 2057 | pMsg->m_pMessage = pMsg7->m_pMessage; |
| 2058 | } |
| 2059 | } |
| 2060 | else if(*pMsgId == protocol7::NETMSGTYPE_CL_STARTINFO) |
| 2061 | { |
| 2062 | protocol7::CNetMsg_Cl_StartInfo *pMsg7 = (protocol7::CNetMsg_Cl_StartInfo *)pRawMsg; |
| 2063 | ::CNetMsg_Cl_StartInfo *pMsg = (::CNetMsg_Cl_StartInfo *)s_aRawMsg; |
| 2064 | |
| 2065 | pMsg->m_pName = pMsg7->m_pName; |
| 2066 | pMsg->m_pClan = pMsg7->m_pClan; |
| 2067 | pMsg->m_Country = pMsg7->m_Country; |
| 2068 | |
| 2069 | pPlayer->m_TeeInfos = CTeeInfo(pMsg7->m_apSkinPartNames, pMsg7->m_aUseCustomColors, pMsg7->m_aSkinPartColors); |
| 2070 | pPlayer->m_TeeInfos.FromSixup(); |
| 2071 | |
| 2072 | str_copy(s_aRawMsg + sizeof(*pMsg), pPlayer->m_TeeInfos.m_aSkinName, sizeof(s_aRawMsg) - sizeof(*pMsg)); |
| 2073 | |
| 2074 | pMsg->m_pSkin = s_aRawMsg + sizeof(*pMsg); |
| 2075 | pMsg->m_UseCustomColor = pPlayer->m_TeeInfos.m_UseCustomColor; |
| 2076 | pMsg->m_ColorBody = pPlayer->m_TeeInfos.m_ColorBody; |
| 2077 | pMsg->m_ColorFeet = pPlayer->m_TeeInfos.m_ColorFeet; |
| 2078 | } |
| 2079 | else if(*pMsgId == protocol7::NETMSGTYPE_CL_SKINCHANGE) |
| 2080 | { |
| 2081 | protocol7::CNetMsg_Cl_SkinChange *pMsg = (protocol7::CNetMsg_Cl_SkinChange *)pRawMsg; |
| 2082 | if(g_Config.m_SvSpamprotection && pPlayer->m_LastChangeInfo && |
| 2083 | pPlayer->m_LastChangeInfo + Server()->TickSpeed() * g_Config.m_SvInfoChangeDelay > Server()->Tick()) |
| 2084 | return nullptr; |
nothing calls this directly
no test coverage detected