mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #2468
2468: Tell why DNSBL isn't allowing to vote (fixes #2466) r=heinrich5991 a=def- Co-authored-by: def <dennis@felsin9.de> Co-authored-by: Dennis Felsing <dennis@felsin9.de>
This commit is contained in:
commit
70ff2f919d
|
@ -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 because we're currently checking for VPNs. Try again in ~30 seconds.");
|
||||
return true;
|
||||
}
|
||||
else if(m_pServer->DnsblBlack(ClientID))
|
||||
{
|
||||
SendChatTarget(ClientID, "You are not allowed to vote because you appear to be using a VPN. Try connecting without a VPN or contacting an admin if you think this is a mistake.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(g_Config.m_SvSpamprotection && pPlayer->m_LastVoteTry && pPlayer->m_LastVoteTry + TickSpeed * 3 > Now)
|
||||
|
|
Loading…
Reference in a new issue