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:
bors[bot] 2020-07-08 20:30:51 +00:00 committed by GitHub
commit 70ff2f919d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View file

@ -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;

View file

@ -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; };

View file

@ -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)