From 4dc118c75212e1a14295c5cc3df4b7c1a817aab0 Mon Sep 17 00:00:00 2001 From: def Date: Sat, 13 Jan 2018 10:50:31 +0100 Subject: [PATCH] Mutes work independent of port, don't announce IP in chat (fixes #908) --- src/game/server/ddracecommands.cpp | 15 ++++++++++----- src/game/server/gamecontext.cpp | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index c9bac81fe..a2a864a3e 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -351,6 +351,9 @@ void CGameContext::Mute(IConsole::IResult *pResult, NETADDR *Addr, int Secs, { 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++) { @@ -375,9 +378,12 @@ void CGameContext::Mute(IConsole::IResult *pResult, NETADDR *Addr, int Secs, } if (Found) { - str_format(aBuf, sizeof aBuf, "'%s' has been muted for %d seconds.", - pDisplayName, Secs); - SendChat(-1, CHAT_ALL, aBuf); + if (pDisplayName) + { + str_format(aBuf, sizeof aBuf, "'%s' has been muted for %d seconds.", + pDisplayName, Secs); + SendChat(-1, CHAT_ALL, aBuf); + } } else // no free slot found Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "mutes", "mute array is full"); @@ -415,8 +421,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), - pResult->GetString(0)); + pSelf->Mute(pResult, &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 d0af0f102..e3148e1ea 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3097,6 +3097,7 @@ 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++)