mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Mutes work independent of port, don't announce IP in chat (fixes #908)
This commit is contained in:
parent
4682eaff56
commit
4dc118c752
|
@ -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++)
|
||||
{
|
||||
|
@ -374,11 +377,14 @@ void CGameContext::Mute(IConsole::IResult *pResult, NETADDR *Addr, int Secs,
|
|||
}
|
||||
}
|
||||
if (Found)
|
||||
{
|
||||
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
|
||||
|
|
|
@ -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++)
|
||||
|
|
Loading…
Reference in a new issue