remove ConDnsblStatus copypasta

This commit is contained in:
eeeee 2017-06-06 19:45:42 -07:00 committed by Learath2
parent e4b3c17829
commit 9c5ade24da
2 changed files with 13 additions and 44 deletions

View file

@ -1995,7 +1995,7 @@ void CServer::ConKick(IConsole::IResult *pResult, void *pUser)
((CServer *)pUser)->Kick(pResult->GetInteger(0), "Kicked by console");
}
void CServer::ConStatus(IConsole::IResult *pResult, void *pUser)
void CServer::StatusImpl(IConsole::IResult *pResult, void *pUser, bool DnsblBlacklistedOnly)
{
char aBuf[1024];
char aAddrStr[NETADDR_MAXSTRSIZE];
@ -2005,7 +2005,10 @@ void CServer::ConStatus(IConsole::IResult *pResult, void *pUser)
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(pThis->m_aClients[i].m_State != CClient::STATE_EMPTY)
if(
pThis->m_aClients[i].m_State != CClient::STATE_EMPTY
&& (!DnsblBlacklistedOnly || pThis->m_aClients[i].m_DnsblState == CClient::DNSBL_STATE_BLACKLISTED)
)
{
net_addr_str(pThis->m_NetServer.ClientAddr(i), aAddrStr, sizeof(aAddrStr), true);
if(pThis->m_aClients[i].m_State == CClient::STATE_INGAME)
@ -2032,55 +2035,19 @@ void CServer::ConStatus(IConsole::IResult *pResult, void *pUser)
else
str_format(aBuf, sizeof(aBuf), "id=%d connecting", i);
}
pThis->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Server", aBuf);
}
}
}
void CServer::ConStatus(IConsole::IResult *pResult, void *pUser)
{
StatusImpl(pResult, pUser, false);
}
void CServer::ConDnsblStatus(IConsole::IResult *pResult, void *pUser)
{
// dump blacklisted clients
char aBuf[1024];
char aAddrStr[NETADDR_MAXSTRSIZE];
CServer *pThis = static_cast<CServer *>(pUser);
bool CanSeeAddress = pThis->m_aClients[pResult->m_ClientID].m_Authed > CServer::AUTHED_MOD;
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(pThis->m_aClients[i].m_State != CClient::STATE_EMPTY &&
pThis->m_aClients[i].m_DnsblState == CClient::DNSBL_STATE_BLACKLISTED)
{
net_addr_str(pThis->m_NetServer.ClientAddr(i), aAddrStr, sizeof(aAddrStr), true);
if(pThis->m_aClients[i].m_State == CClient::STATE_INGAME)
{
const char *pAuthStr = pThis->m_aClients[i].m_Authed == CServer::AUTHED_ADMIN ? "(Admin)" :
pThis->m_aClients[i].m_Authed == CServer::AUTHED_MOD ? "(Mod)" :
pThis->m_aClients[i].m_Authed == CServer::AUTHED_HELPER ? "(Helper)" : "";
char aAuthStr[128];
aAuthStr[0] = '\0';
if(pThis->m_aClients[i].m_AuthKey >= 0)
str_format(aAuthStr, sizeof(aAuthStr), "key=%s %s", pThis->m_AuthManager.KeyIdent(pThis->m_aClients[i].m_AuthKey), pAuthStr);
if (CanSeeAddress)
str_format(aBuf, sizeof(aBuf), "id=%d addr=%s name='%s' score=%d client=%d secure=%s %s", i, aAddrStr,
pThis->m_aClients[i].m_aName, pThis->m_aClients[i].m_Score, pThis->GameServer()->GetClientVersion(i), pThis->m_NetServer.HasSecurityToken(i) ? "yes" : "no", aAuthStr);
else
str_format(aBuf, sizeof(aBuf), "id=%d name='%s' score=%d client=%d secure=%s %s", i,
pThis->m_aClients[i].m_aName, pThis->m_aClients[i].m_Score, pThis->GameServer()->GetClientVersion(i), pThis->m_NetServer.HasSecurityToken(i) ? "yes" : "no", aAuthStr);
}
else
{
if (CanSeeAddress)
str_format(aBuf, sizeof(aBuf), "id=%d addr=%s connecting", i, aAddrStr);
else
str_format(aBuf, sizeof(aBuf), "id=%d connecting", i);
}
pThis->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Server", aBuf);
}
}
StatusImpl(pResult, pUser, true);
}
static int GetAuthLevel(const char *pLevel)

View file

@ -299,6 +299,8 @@ public:
static void ConAuthRemove(IConsole::IResult *pResult, void *pUser);
static void ConAuthList(IConsole::IResult *pResult, void *pUser);
static void StatusImpl(IConsole::IResult *pResult, void *pUser, bool DnsblBlacklistedOnly);
#if defined (CONF_SQL)
// console commands for sqlmasters
static void ConAddSqlServer(IConsole::IResult *pResult, void *pUserData);