| 3508 | } |
| 3509 | |
| 3510 | void 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)); |
nothing calls this directly
no test coverage detected