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];
|
char aBuf[128];
|
||||||
int Found = 0;
|
int Found = 0;
|
||||||
|
|
||||||
|
Addr->port = 0; // ignore port number for mutes
|
||||||
|
|
||||||
// find a matching mute for this ip, update expiration time if found
|
// find a matching mute for this ip, update expiration time if found
|
||||||
for (int i = 0; i < m_NumMutes; i++)
|
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 (Found)
|
||||||
|
{
|
||||||
|
if (pDisplayName)
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof aBuf, "'%s' has been muted for %d seconds.",
|
str_format(aBuf, sizeof aBuf, "'%s' has been muted for %d seconds.",
|
||||||
pDisplayName, Secs);
|
pDisplayName, Secs);
|
||||||
SendChat(-1, CHAT_ALL, aBuf);
|
SendChat(-1, CHAT_ALL, aBuf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // no free slot found
|
else // no free slot found
|
||||||
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "mutes", "mute array is full");
|
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",
|
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "mutes",
|
||||||
"Invalid network address to mute");
|
"Invalid network address to mute");
|
||||||
}
|
}
|
||||||
pSelf->Mute(pResult, &Addr, clamp(pResult->GetInteger(1), 1, 86400),
|
pSelf->Mute(pResult, &Addr, clamp(pResult->GetInteger(1), 1, 86400), NULL);
|
||||||
pResult->GetString(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// unmute by mute list index
|
// unmute by mute list index
|
||||||
|
|
|
@ -3097,6 +3097,7 @@ int CGameContext::ProcessSpamProtection(int ClientID)
|
||||||
m_apPlayers[ClientID]->m_LastChat = Server()->Tick();
|
m_apPlayers[ClientID]->m_LastChat = Server()->Tick();
|
||||||
NETADDR Addr;
|
NETADDR Addr;
|
||||||
Server()->GetClientAddr(ClientID, &Addr);
|
Server()->GetClientAddr(ClientID, &Addr);
|
||||||
|
Addr.port = 0; // ignore port number for mutes
|
||||||
int Muted = 0;
|
int Muted = 0;
|
||||||
|
|
||||||
for(int i = 0; i < m_NumMutes && !Muted; i++)
|
for(int i = 0; i < m_NumMutes && !Muted; i++)
|
||||||
|
|
Loading…
Reference in a new issue