From 1073b72965e0f0f79e4363849bd8b31f059e110e Mon Sep 17 00:00:00 2001 From: Learath Date: Mon, 8 Oct 2018 01:59:07 +0300 Subject: [PATCH 1/6] Ignore DNSBL on "empty" servers. --- src/base/system.c | 5 ++++ src/base/system.h | 15 ++++++++++ src/engine/server.h | 2 ++ src/engine/server/server.cpp | 49 +++++++++++++++++++++++++++++++-- src/engine/server/server.h | 2 ++ src/game/server/gamecontext.cpp | 6 ++-- 6 files changed, 74 insertions(+), 5 deletions(-) diff --git a/src/base/system.c b/src/base/system.c index 9e84fce67..bd6dee238 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -997,6 +997,11 @@ int net_addr_comp(const NETADDR *a, const NETADDR *b) return mem_comp(a, b, sizeof(NETADDR)); } +int net_addr_comp_ip(const NETADDR *a, const NETADDR *b) +{ + return mem_comp(a->ip, b->ip, sizeof(a->ip)); +} + void net_addr_str(const NETADDR *addr, char *string, int max_length, int add_port) { if(addr->type == NETTYPE_IPV4 || addr->type == NETTYPE_WEBSOCKET_IPV4) diff --git a/src/base/system.h b/src/base/system.h index 3279fadc0..50e7676e2 100644 --- a/src/base/system.h +++ b/src/base/system.h @@ -672,6 +672,21 @@ int net_host_lookup(const char *hostname, NETADDR *addr, int types); */ int net_addr_comp(const NETADDR *a, const NETADDR *b); +/* + Function: net_addr_comp_ip + Compares two network addresses by ip. + + Parameters: + a - Address to compare + b - Address to compare to. + + Returns: + <0 - Address a is lesser then address b + 0 - Address a is equal to address b + >0 - Address a is greater then address b +*/ +int net_addr_comp_ip(const NETADDR *a, const NETADDR *b); + /* Function: net_addr_str Turns a network address into a representative string. diff --git a/src/engine/server.h b/src/engine/server.h index b468c6e99..26af00b6f 100644 --- a/src/engine/server.h +++ b/src/engine/server.h @@ -32,6 +32,8 @@ public: int TickSpeed() const { return m_TickSpeed; } virtual int MaxClients() const = 0; + virtual int ClientCount() = 0; + virtual int DistinctClientCount() = 0; virtual const char *ClientName(int ClientID) = 0; virtual const char *ClientClan(int ClientID) = 0; virtual int ClientCountry(int ClientID) = 0; diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index b83fbdd1d..1de077580 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -554,6 +554,51 @@ int CServer::MaxClients() const return m_NetServer.MaxClients(); } +int CServer::ClientCount() +{ + int ClientCount = 0; + for(int i = 0; i < MAX_CLIENTS; i++) + { + if(m_aClients[i].m_State != CClient::STATE_EMPTY) + { + ClientCount++; + } + } + + return ClientCount; +} + +int CServer::DistinctClientCount() +{ + NETADDR aAddresses[MAX_CLIENTS]; + for(int i = 0; i < MAX_CLIENTS; i++) + { + if(m_aClients[i].m_State != CClient::STATE_EMPTY) + { + GetClientAddr(i, &aAddresses[i]); + } + } + + int ClientCount = 0; + for(int i = 0; i < MAX_CLIENTS; i++) + { + if(m_aClients[i].m_State != CClient::STATE_EMPTY) + { + ClientCount++; + for(int j = 0; j < MAX_CLIENTS; j++) + { + if(!net_addr_comp_ip(&aAddresses[i], &aAddresses[j])) + { + ClientCount--; + break; + } + } + } + } + + return ClientCount; +} + int CServer::SendMsg(CMsgPacker *pMsg, int Flags, int ClientID) { return SendMsgEx(pMsg, Flags, ClientID, false); @@ -1900,7 +1945,7 @@ int CServer::Run() char aBuf[256]; str_format(aBuf, sizeof(aBuf), "ClientID=%d addr=%s secure=%s blacklisted", ClientID, aAddrStr, m_NetServer.HasSecurityToken(ClientID)?"yes":"no"); - + Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "dnsbl", aBuf); } } @@ -2341,7 +2386,7 @@ void CServer::ConNameBan(IConsole::IResult *pResult, void *pUser) { Distance = str_length(pName) / 3; } - + for(int i = 0; i < pThis->m_aNameBans.size(); i++) { CNameBan *pBan = &pThis->m_aNameBans[i]; diff --git a/src/engine/server/server.h b/src/engine/server/server.h index 75bb19e2f..bce48a96e 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -260,6 +260,8 @@ public: bool ClientIngame(int ClientID); bool ClientAuthed(int ClientID); int MaxClients() const; + int ClientCount(); + int DistinctClientCount(); virtual int SendMsg(CMsgPacker *pMsg, int Flags, int ClientID); int SendMsgEx(CMsgPacker *pMsg, int Flags, int ClientID, bool System); diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 82a6ccdd1..c07234cbe 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -1340,7 +1340,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) return; } - if (g_Config.m_SvDnsblVote && !m_pServer->DnsblWhite(ClientID)) + if (g_Config.m_SvDnsblVote && !m_pServer->DnsblWhite(ClientID) && Server()->DistinctClientCount() > 1) { // blacklisted by dnsbl SendChatTarget(ClientID, "You are not allowed to vote due to DNSBL."); @@ -3568,10 +3568,10 @@ void CGameContext::ForceVote(int EnforcerID, bool Success) // check if there is a vote running if(!m_VoteCloseTime) return; - + m_VoteEnforce = Success ? CGameContext::VOTE_ENFORCE_YES_ADMIN : CGameContext::VOTE_ENFORCE_NO_ADMIN; m_VoteEnforcer = EnforcerID; - + char aBuf[256]; const char *pOption = Success ? "yes" : "no"; str_format(aBuf, sizeof(aBuf), "authorized player forced vote %s", pOption); From f1867e04037581bee47b7012df8b87971ee5e50a Mon Sep 17 00:00:00 2001 From: Learath Date: Mon, 8 Oct 2018 19:55:18 +0300 Subject: [PATCH 2/6] Grammar fix "then->than" --- src/base/system.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/base/system.h b/src/base/system.h index 50e7676e2..ec6e50f6f 100644 --- a/src/base/system.h +++ b/src/base/system.h @@ -149,7 +149,7 @@ void mem_zero(void *block, unsigned size); size - Size of the data to compare Returns: - <0 - Block a is lesser then block b + <0 - Block a is lesser than block b 0 - Block a is equal to block b >0 - Block a is greater than block b */ @@ -666,9 +666,9 @@ int net_host_lookup(const char *hostname, NETADDR *addr, int types); b - Address to compare to. Returns: - <0 - Address a is lesser then address b + <0 - Address a is lesser than address b 0 - Address a is equal to address b - >0 - Address a is greater then address b + >0 - Address a is greater than address b */ int net_addr_comp(const NETADDR *a, const NETADDR *b); @@ -681,9 +681,9 @@ int net_addr_comp(const NETADDR *a, const NETADDR *b); b - Address to compare to. Returns: - <0 - Address a is lesser then address b + <0 - Address a is lesser than address b 0 - Address a is equal to address b - >0 - Address a is greater then address b + >0 - Address a is greater than address b */ int net_addr_comp_ip(const NETADDR *a, const NETADDR *b); @@ -1092,9 +1092,9 @@ char *str_skip_whitespaces(char *str); b - String to compare. Returns: - <0 - String a is lesser then string b + <0 - String a is lesser than string b 0 - String a is equal to string b - >0 - String a is greater then string b + >0 - String a is greater than string b Remarks: - Only garanted to work with a-z/A-Z. @@ -1131,9 +1131,9 @@ int str_comp_nocase_num(const char *a, const char *b, const int num); b - String to compare. Returns: - <0 - String a is lesser then string b + <0 - String a is lesser than string b 0 - String a is equal to string b - >0 - String a is greater then string b + >0 - String a is greater than string b Remarks: - The strings are treated as zero-terminated strings. @@ -1150,9 +1150,9 @@ int str_comp(const char *a, const char *b); num - Maximum characters to compare Returns: - <0 - String a is lesser then string b + <0 - String a is lesser than string b 0 - String a is equal to string b - >0 - String a is greater then string b + >0 - String a is greater than string b Remarks: - The strings are treated as zero-terminated strings. @@ -1168,9 +1168,9 @@ int str_comp_num(const char *a, const char *b, const int num); b - String to compare. Returns: - <0 - String a is lesser then string b + <0 - String a is lesser than string b 0 - String a is equal to string b - >0 - String a is greater then string b + >0 - String a is greater than string b Remarks: - The strings are treated as zero-terminated strings. From 2e137e6fc7edcff30d64fd510f67d5380f66f2bd Mon Sep 17 00:00:00 2001 From: Learath Date: Mon, 8 Oct 2018 19:56:51 +0300 Subject: [PATCH 3/6] net_addr_comp_ip -> net_addr_comp_noport --- src/base/system.c | 7 +++++-- src/base/system.h | 6 +++--- src/engine/server/server.cpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/base/system.c b/src/base/system.c index bd6dee238..7c7f00d84 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -997,9 +997,12 @@ int net_addr_comp(const NETADDR *a, const NETADDR *b) return mem_comp(a, b, sizeof(NETADDR)); } -int net_addr_comp_ip(const NETADDR *a, const NETADDR *b) +int net_addr_comp_noport(const NETADDR *a, const NETADDR *b) { - return mem_comp(a->ip, b->ip, sizeof(a->ip)); + NETADDR ta = *a, tb = *b; + ta.port = tb.port = 0; + + return net_addr_comp(&ta, &tb); } void net_addr_str(const NETADDR *addr, char *string, int max_length, int add_port) diff --git a/src/base/system.h b/src/base/system.h index ec6e50f6f..9221d7c66 100644 --- a/src/base/system.h +++ b/src/base/system.h @@ -673,8 +673,8 @@ int net_host_lookup(const char *hostname, NETADDR *addr, int types); int net_addr_comp(const NETADDR *a, const NETADDR *b); /* - Function: net_addr_comp_ip - Compares two network addresses by ip. + Function: net_addr_comp_noport + Compares two network addresses ignoring port. Parameters: a - Address to compare @@ -685,7 +685,7 @@ int net_addr_comp(const NETADDR *a, const NETADDR *b); 0 - Address a is equal to address b >0 - Address a is greater than address b */ -int net_addr_comp_ip(const NETADDR *a, const NETADDR *b); +int net_addr_comp_noport(const NETADDR *a, const NETADDR *b); /* Function: net_addr_str diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 1de077580..6459d8e24 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -587,7 +587,7 @@ int CServer::DistinctClientCount() ClientCount++; for(int j = 0; j < MAX_CLIENTS; j++) { - if(!net_addr_comp_ip(&aAddresses[i], &aAddresses[j])) + if(!net_addr_comp_noport(&aAddresses[i], &aAddresses[j])) { ClientCount--; break; From 254ff3dc6bf814afdac8d4234e85bbc4bce2a82f Mon Sep 17 00:00:00 2001 From: Learath Date: Mon, 8 Oct 2018 20:56:49 +0300 Subject: [PATCH 4/6] Oversight --- src/engine/server/server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 6459d8e24..3d86e842d 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -585,7 +585,7 @@ int CServer::DistinctClientCount() if(m_aClients[i].m_State != CClient::STATE_EMPTY) { ClientCount++; - for(int j = 0; j < MAX_CLIENTS; j++) + for(int j = 0; j < i; j++) { if(!net_addr_comp_noport(&aAddresses[i], &aAddresses[j])) { From 5b95eddca1eb50a828954381e588b593366e0216 Mon Sep 17 00:00:00 2001 From: Learath Date: Mon, 8 Oct 2018 21:04:04 +0300 Subject: [PATCH 5/6] DRY with net_addr_comp_noport --- src/engine/server/register.cpp | 6 +----- src/engine/shared/network_conn.cpp | 6 +----- src/engine/shared/network_server.cpp | 8 +------- src/game/server/ddracecommands.cpp | 22 +++++++++------------- src/game/server/gamecontext.cpp | 6 ++---- 5 files changed, 14 insertions(+), 34 deletions(-) diff --git a/src/engine/server/register.cpp b/src/engine/server/register.cpp index b287068de..0a93cb547 100644 --- a/src/engine/server/register.cpp +++ b/src/engine/server/register.cpp @@ -239,13 +239,9 @@ int CRegister::RegisterProcessPacket(CNetChunk *pPacket) { // check for masterserver address bool Valid = false; - NETADDR Addr1 = pPacket->m_Address; - Addr1.port = 0; for(int i = 0; i < IMasterServer::MAX_MASTERSERVERS; i++) { - NETADDR Addr2 = m_aMasterserverInfo[i].m_Addr; - Addr2.port = 0; - if(net_addr_comp(&Addr1, &Addr2) == 0) + if(net_addr_comp_noport(&pPacket->m_Address, &m_aMasterserverInfo[i].m_Addr) == 0) { Valid = true; break; diff --git a/src/engine/shared/network_conn.cpp b/src/engine/shared/network_conn.cpp index f0aa7989f..6915d7559 100644 --- a/src/engine/shared/network_conn.cpp +++ b/src/engine/shared/network_conn.cpp @@ -312,12 +312,8 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr, SECURITY_ { if(CtrlMsg == NET_CTRLMSG_CONNECT) { - NETADDR nAddr; - mem_copy(&nAddr, pAddr, sizeof(nAddr)); - nAddr.port = 0; - m_PeerAddr.port = 0; #ifndef FUZZING - if(net_addr_comp(&m_PeerAddr, &nAddr) == 0 && time_get() - m_LastUpdateTime < time_freq() * 3) + if(net_addr_comp_noport(&m_PeerAddr, pAddr) == 0 && time_get() - m_LastUpdateTime < time_freq() * 3) return 0; #endif diff --git a/src/engine/shared/network_server.cpp b/src/engine/shared/network_server.cpp index ea8fc15ba..d4e0abe65 100644 --- a/src/engine/shared/network_server.cpp +++ b/src/engine/shared/network_server.cpp @@ -168,11 +168,7 @@ void CNetServer::SendControl(NETADDR &Addr, int ControlMsg, const void *pExtra, int CNetServer::NumClientsWithAddr(NETADDR Addr) { - NETADDR ThisAddr = Addr, OtherAddr; - int FoundAddr = 0; - ThisAddr.port = 0; - for(int i = 0; i < MaxClients(); ++i) { if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_OFFLINE || @@ -181,9 +177,7 @@ int CNetServer::NumClientsWithAddr(NETADDR Addr) !m_aSlots[i].m_Connection.m_TimeoutSituation))) continue; - OtherAddr = *m_aSlots[i].m_Connection.PeerAddress(); - OtherAddr.port = 0; - if(!net_addr_comp(&ThisAddr, &OtherAddr)) + if(!net_addr_comp_noport(&Addr, m_aSlots[i].m_Connection.PeerAddress())) FoundAddr++; } diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index 1fc2afb73..8c09252d4 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -351,12 +351,10 @@ void CGameContext::VoteMute(IConsole::IResult *pResult, NETADDR *pAddr, int Secs char aBuf[128]; bool Found = 0; - pAddr->port = 0; // ignore port number for vote mutes - // find a matching vote mute for this ip, update expiration time if found for(int i = 0; i < m_NumVoteMutes; i++) { - if(net_addr_comp(&m_aVoteMutes[i].m_Addr, pAddr) == 0) + if(net_addr_comp_noport(&m_aVoteMutes[i].m_Addr, pAddr) == 0) { m_aVoteMutes[i].m_Expire = Server()->Tick() + Secs * Server()->TickSpeed(); @@ -389,18 +387,16 @@ void CGameContext::VoteMute(IConsole::IResult *pResult, NETADDR *pAddr, int Secs Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "votemute", "vote mute array is full"); } -void CGameContext::Mute(IConsole::IResult *pResult, NETADDR *Addr, int Secs, +void CGameContext::Mute(IConsole::IResult *pResult, NETADDR *pAddr, int Secs, const char *pDisplayName) { char aBuf[128]; int Found = 0; - Addr->port = 0; // ignore port number for mutes - // find a matching mute for this ip, update expiration time if found for (int i = 0; i < m_NumMutes; i++) { - if (net_addr_comp(&m_aMutes[i].m_Addr, Addr) == 0) + if (net_addr_comp_noport(&m_aMutes[i].m_Addr, pAddr) == 0) { m_aMutes[i].m_Expire = Server()->Tick() + Secs * Server()->TickSpeed(); @@ -412,7 +408,7 @@ void CGameContext::Mute(IConsole::IResult *pResult, NETADDR *Addr, int Secs, { if (m_NumMutes < MAX_MUTES) { - m_aMutes[m_NumMutes].m_Addr = *Addr; + m_aMutes[m_NumMutes].m_Addr = *pAddr; m_aMutes[m_NumMutes].m_Expire = Server()->Tick() + Secs * Server()->TickSpeed(); m_NumMutes++; @@ -464,7 +460,7 @@ void CGameContext::ConMuteID(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; int Victim = pResult->GetVictim(); - + if (Victim < 0 || Victim > MAX_CLIENTS || !pSelf->m_apPlayers[Victim]) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "muteid", "Client id not found."); @@ -514,7 +510,7 @@ void CGameContext::ConUnmute(IConsole::IResult *pResult, void *pUserData) void CGameContext::ConMutes(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; - + if (pSelf->m_NumMutes <= 0) { // Just to make sure. @@ -523,7 +519,7 @@ void CGameContext::ConMutes(IConsole::IResult *pResult, void *pUserData) "There are no active mutes."); return; } - + char aIpBuf[64]; char aBuf[128]; pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "mutes", @@ -563,7 +559,7 @@ void CGameContext::ConModerate(IConsole::IResult *pResult, void *pUserData) str_format(aBuf, sizeof(aBuf), "Server kick/spec votes are no longer actively moderated."); pSelf->SendChat(-1, CHAT_ALL, aBuf, 0); - + if(pPlayer->m_Moderating) pSelf->SendChatTarget(pResult->m_ClientID, "Active moderator mode enabled for you."); else @@ -636,6 +632,6 @@ void CGameContext::ConUnFreezeHammer(IConsole::IResult *pResult, void *pUserData void CGameContext::ConVoteNo(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; - + pSelf->ForceVote(pResult->m_ClientID, false); } diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index c07234cbe..9bb361daa 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -1382,10 +1382,9 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) NETADDR Addr; Server()->GetClientAddr(ClientID, &Addr); - Addr.port = 0; // ignore port number int VoteMuted = 0; for(int i = 0; i < m_NumVoteMutes && !VoteMuted; i++) - if(!net_addr_comp(&Addr, &m_aVoteMutes[i].m_Addr)) + if(!net_addr_comp_noport(&Addr, &m_aVoteMutes[i].m_Addr)) VoteMuted = (m_aVoteMutes[i].m_Expire - Server()->Tick()) / Server()->TickSpeed(); if(VoteMuted > 0) { @@ -3280,12 +3279,11 @@ int CGameContext::ProcessSpamProtection(int ClientID) m_apPlayers[ClientID]->m_LastChat = Server()->Tick(); NETADDR Addr; Server()->GetClientAddr(ClientID, &Addr); - Addr.port = 0; // ignore port number for mutes int Muted = 0; for(int i = 0; i < m_NumMutes && !Muted; i++) { - if(!net_addr_comp(&Addr, &m_aMutes[i].m_Addr)) + if(!net_addr_comp_noport(&Addr, &m_aMutes[i].m_Addr)) Muted = (m_aMutes[i].m_Expire - Server()->Tick()) / Server()->TickSpeed(); } From 571b069b91ce56aa8cf623a32844bfbeacb14f77 Mon Sep 17 00:00:00 2001 From: Learath Date: Mon, 8 Oct 2018 21:29:33 +0300 Subject: [PATCH 6/6] Small cleanup of *Mute functions --- src/game/server/ddracecommands.cpp | 12 +++++------- src/game/server/gamecontext.cpp | 2 +- src/game/server/gamecontext.h | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index 8c09252d4..e56c4dafe 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -345,8 +345,7 @@ void CGameContext::ConForcePause(IConsole::IResult *pResult, void *pUserData) pPlayer->ForcePause(Seconds); } -void CGameContext::VoteMute(IConsole::IResult *pResult, NETADDR *pAddr, int Secs, - const char *pDisplayName, int AuthedID) +void CGameContext::VoteMute(const NETADDR *pAddr, int Secs, const char *pDisplayName, int AuthedID) { char aBuf[128]; bool Found = 0; @@ -387,8 +386,7 @@ void CGameContext::VoteMute(IConsole::IResult *pResult, NETADDR *pAddr, int Secs Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "votemute", "vote mute array is full"); } -void CGameContext::Mute(IConsole::IResult *pResult, NETADDR *pAddr, int Secs, - const char *pDisplayName) +void CGameContext::Mute(const NETADDR *pAddr, int Secs, const char *pDisplayName) { char aBuf[128]; int Found = 0; @@ -442,7 +440,7 @@ void CGameContext::ConVoteMute(IConsole::IResult *pResult, void *pUserData) NETADDR Addr; pSelf->Server()->GetClientAddr(Victim, &Addr); - pSelf->VoteMute(pResult, &Addr, clamp(pResult->GetInteger(1), 1, 86400), + pSelf->VoteMute(&Addr, clamp(pResult->GetInteger(1), 1, 86400), pSelf->Server()->ClientName(Victim), pResult->m_ClientID); } @@ -470,7 +468,7 @@ void CGameContext::ConMuteID(IConsole::IResult *pResult, void *pUserData) NETADDR Addr; pSelf->Server()->GetClientAddr(Victim, &Addr); - pSelf->Mute(pResult, &Addr, clamp(pResult->GetInteger(1), 1, 86400), + pSelf->Mute(&Addr, clamp(pResult->GetInteger(1), 1, 86400), pSelf->Server()->ClientName(Victim)); } @@ -484,7 +482,7 @@ void CGameContext::ConMuteIP(IConsole::IResult *pResult, void *pUserData) pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "mutes", "Invalid network address to mute"); } - pSelf->Mute(pResult, &Addr, clamp(pResult->GetInteger(1), 1, 86400), NULL); + pSelf->Mute(&Addr, clamp(pResult->GetInteger(1), 1, 86400), NULL); } // unmute by mute list index diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 9bb361daa..5c9cd47c6 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3297,7 +3297,7 @@ int CGameContext::ProcessSpamProtection(int ClientID) if ((m_apPlayers[ClientID]->m_ChatScore += g_Config.m_SvChatPenalty) > g_Config.m_SvChatThreshold) { - Mute(0, &Addr, g_Config.m_SvSpamMuteDuration, Server()->ClientName(ClientID)); + Mute(&Addr, g_Config.m_SvSpamMuteDuration, Server()->ClientName(ClientID)); m_apPlayers[ClientID]->m_ChatScore = 0; return 1; } diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index 8a3946b6d..5d47d312a 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -384,8 +384,8 @@ private: int m_NumMutes; CVoteMute m_aVoteMutes[MAX_VOTE_BANS]; int m_NumVoteMutes; - void Mute(IConsole::IResult *pResult, NETADDR *Addr, int Secs, const char *pDisplayName); - void VoteMute(IConsole::IResult *pResult, NETADDR *pAddr, int Secs, const char *pDisplayName, int AuthedID); + void Mute(const NETADDR *pAddr, int Secs, const char *pDisplayName); + void VoteMute(const NETADDR *pAddr, int Secs, const char *pDisplayName, int AuthedID); void Whisper(int ClientID, char *pStr); void WhisperID(int ClientID, int VictimID, char *pMessage); void Converse(int ClientID, char *pStr);