mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
remove ConDnsblStatus copypasta
This commit is contained in:
parent
e4b3c17829
commit
9c5ade24da
|
@ -1995,7 +1995,7 @@ void CServer::ConKick(IConsole::IResult *pResult, void *pUser)
|
||||||
((CServer *)pUser)->Kick(pResult->GetInteger(0), "Kicked by console");
|
((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 aBuf[1024];
|
||||||
char aAddrStr[NETADDR_MAXSTRSIZE];
|
char aAddrStr[NETADDR_MAXSTRSIZE];
|
||||||
|
@ -2005,7 +2005,10 @@ void CServer::ConStatus(IConsole::IResult *pResult, void *pUser)
|
||||||
|
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
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);
|
net_addr_str(pThis->m_NetServer.ClientAddr(i), aAddrStr, sizeof(aAddrStr), true);
|
||||||
if(pThis->m_aClients[i].m_State == CClient::STATE_INGAME)
|
if(pThis->m_aClients[i].m_State == CClient::STATE_INGAME)
|
||||||
|
@ -2032,55 +2035,19 @@ void CServer::ConStatus(IConsole::IResult *pResult, void *pUser)
|
||||||
else
|
else
|
||||||
str_format(aBuf, sizeof(aBuf), "id=%d connecting", i);
|
str_format(aBuf, sizeof(aBuf), "id=%d connecting", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
pThis->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Server", aBuf);
|
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)
|
void CServer::ConDnsblStatus(IConsole::IResult *pResult, void *pUser)
|
||||||
{
|
{
|
||||||
// dump blacklisted clients
|
StatusImpl(pResult, pUser, true);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GetAuthLevel(const char *pLevel)
|
static int GetAuthLevel(const char *pLevel)
|
||||||
|
|
|
@ -299,6 +299,8 @@ public:
|
||||||
static void ConAuthRemove(IConsole::IResult *pResult, void *pUser);
|
static void ConAuthRemove(IConsole::IResult *pResult, void *pUser);
|
||||||
static void ConAuthList(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)
|
#if defined (CONF_SQL)
|
||||||
// console commands for sqlmasters
|
// console commands for sqlmasters
|
||||||
static void ConAddSqlServer(IConsole::IResult *pResult, void *pUserData);
|
static void ConAddSqlServer(IConsole::IResult *pResult, void *pUserData);
|
||||||
|
|
Loading…
Reference in a new issue