MCPcopy Create free account
hub / github.com/ddnet/ddnet / ConStatus

Method ConStatus

src/engine/server/server.cpp:3510–3571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3508}
3509
3510void CServer::ConStatus(IConsole::IResult *pResult, void *pUser)
3511{
3512 char aBuf[1024];
3513 CServer *pThis = static_cast<CServer *>(pUser);
3514 const char *pName = pResult->NumArguments() == 1 ? pResult->GetString(0) : "";
3515
3516 for(int i = 0; i < MAX_CLIENTS; i++)
3517 {
3518 if(pThis->m_aClients[i].m_State == CClient::STATE_EMPTY)
3519 continue;
3520
3521 if(!str_utf8_find_nocase(pThis->m_aClients[i].m_aName, pName))
3522 continue;
3523
3524 if(pThis->m_aClients[i].m_State == CClient::STATE_INGAME)
3525 {
3526 char aDnsblStr[64];
3527 aDnsblStr[0] = '\0';
3528 if(pThis->Config()->m_SvDnsbl)
3529 {
3530 str_format(aDnsblStr, sizeof(aDnsblStr), " dnsbl=%s", DnsblStateStr(pThis->m_aClients[i].m_DnsblState));
3531 }
3532
3533 char aAuthStr[128];
3534 aAuthStr[0] = '\0';
3535 if(pThis->m_aClients[i].m_AuthKey >= 0)
3536 {
3537 const char *pAuthStr = "";
3538 const int AuthState = pThis->GetAuthedState(i);
3539
3540 if(AuthState == AUTHED_ADMIN)
3541 {
3542 pAuthStr = "(Admin)";
3543 }
3544 else if(AuthState == AUTHED_MOD)
3545 {
3546 pAuthStr = "(Mod)";
3547 }
3548 else if(AuthState == AUTHED_HELPER)
3549 {
3550 pAuthStr = "(Helper)";
3551 }
3552
3553 str_format(aAuthStr, sizeof(aAuthStr), " key='%s' %s", pThis->m_AuthManager.KeyIdent(pThis->m_aClients[i].m_AuthKey), pAuthStr);
3554 }
3555
3556 const char *pClientPrefix = "";
3557 if(pThis->m_aClients[i].m_Sixup)
3558 {
3559 pClientPrefix = "0.7:";
3560 }
3561 str_format(aBuf, sizeof(aBuf), "id=%d addr=<{%s}> name='%s' client=%s%d secure=%s flags=%d%s%s",
3562 i, pThis->ClientAddrString(i, true), pThis->m_aClients[i].m_aName, pClientPrefix, pThis->m_aClients[i].m_DDNetVersion,
3563 pThis->m_NetServer.HasSecurityToken(i) ? "yes" : "no", pThis->m_aClients[i].m_Flags, aDnsblStr, aAuthStr);
3564 }
3565 else
3566 {
3567 str_format(aBuf, sizeof(aBuf), "id=%d addr=<{%s}> connecting", i, pThis->ClientAddrString(i, true));

Callers

nothing calls this directly

Calls 11

str_utf8_find_nocaseFunction · 0.85
str_formatFunction · 0.85
NumArgumentsMethod · 0.80
GetAuthedStateMethod · 0.80
KeyIdentMethod · 0.80
ClientAddrStringMethod · 0.80
HasSecurityTokenMethod · 0.80
GetStringMethod · 0.45
ConfigMethod · 0.45
PrintMethod · 0.45
ConsoleMethod · 0.45

Tested by

no test coverage detected