mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-05 15:48:19 +00:00
Tell why DNSBL isn't allowing to vote (fixes #2466)
This commit is contained in:
parent
b44ff4cc56
commit
66c7bf8851
|
@ -223,6 +223,8 @@ public:
|
|||
virtual int* GetIdMap(int ClientID) = 0;
|
||||
|
||||
virtual bool DnsblWhite(int ClientID) = 0;
|
||||
virtual bool DnsblPending(int ClientID) = 0;
|
||||
virtual bool DnsblBlack(int ClientID) = 0;
|
||||
virtual const char *GetAnnouncementLine(char const *FileName) = 0;
|
||||
virtual bool ClientPrevIngame(int ClientID) = 0;
|
||||
virtual const char *GetNetErrorString(int ClientID) = 0;
|
||||
|
|
|
@ -442,6 +442,14 @@ public:
|
|||
return m_aClients[ClientID].m_DnsblState == CClient::DNSBL_STATE_NONE ||
|
||||
m_aClients[ClientID].m_DnsblState == CClient::DNSBL_STATE_WHITELISTED;
|
||||
}
|
||||
bool DnsblPending(int ClientID)
|
||||
{
|
||||
return m_aClients[ClientID].m_DnsblState == CClient::DNSBL_STATE_PENDING;
|
||||
}
|
||||
bool DnsblBlack(int ClientID)
|
||||
{
|
||||
return m_aClients[ClientID].m_DnsblState == CClient::DNSBL_STATE_BLACKLISTED;
|
||||
}
|
||||
|
||||
void AuthRemoveKey(int KeySlot);
|
||||
bool ClientPrevIngame(int ClientID) { return m_aPrevStates[ClientID] == CClient::STATE_INGAME; };
|
||||
|
|
|
@ -3894,11 +3894,18 @@ bool CGameContext::RateLimitPlayerVote(int ClientID)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (g_Config.m_SvDnsblVote && !m_pServer->DnsblWhite(ClientID) && Server()->DistinctClientCount() > 1)
|
||||
if(g_Config.m_SvDnsblVote && Server()->DistinctClientCount() > 1)
|
||||
{
|
||||
// blacklisted by dnsbl
|
||||
SendChatTarget(ClientID, "You are not allowed to vote due to DNSBL.");
|
||||
return true;
|
||||
if(m_pServer->DnsblPending(ClientID))
|
||||
{
|
||||
SendChatTarget(ClientID, "You are not allowed to vote due to pending DNSBL request. Try again in ~30 seconds.");
|
||||
return true;
|
||||
}
|
||||
else if(m_pServer->DnsblBlack(ClientID))
|
||||
{
|
||||
SendChatTarget(ClientID, "You are not allowed to vote due to DNSBL. Try connecting without a VPN.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(g_Config.m_SvSpamprotection && pPlayer->m_LastVoteTry && pPlayer->m_LastVoteTry + TickSpeed * 3 > Now)
|
||||
|
|
Loading…
Reference in a new issue