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

Method LogoutClient

src/engine/server/server.cpp:4179–4214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4177}
4178
4179void CServer::LogoutClient(int ClientId, const char *pReason)
4180{
4181 if(!IsSixup(ClientId))
4182 {
4183 CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS, true);
4184 Msg.AddInt(0); //authed
4185 Msg.AddInt(0); //cmdlist
4186 SendMsg(&Msg, MSGFLAG_VITAL, ClientId);
4187 }
4188 else
4189 {
4190 CMsgPacker Msg(protocol7::NETMSG_RCON_AUTH_OFF, true, true);
4191 SendMsg(&Msg, MSGFLAG_VITAL, ClientId);
4192 }
4193
4194 m_aClients[ClientId].m_AuthTries = 0;
4195 m_aClients[ClientId].m_pRconCmdToSend = nullptr;
4196 m_aClients[ClientId].m_MaplistEntryToSend = CClient::MAPLIST_UNINITIALIZED;
4197
4198 if(*pReason)
4199 {
4200 char aBuf[64];
4201 str_format(aBuf, sizeof(aBuf), "Logged out by %s.", pReason);
4202 SendRconLine(ClientId, aBuf);
4203 log_info("server", "ClientId=%d with key='%s' logged out by %s", ClientId, m_AuthManager.KeyIdent(m_aClients[ClientId].m_AuthKey), pReason);
4204 }
4205 else
4206 {
4207 SendRconLine(ClientId, "Logout successful.");
4208 log_info("server", "ClientId=%d with key='%s' logged out", ClientId, m_AuthManager.KeyIdent(m_aClients[ClientId].m_AuthKey));
4209 }
4210
4211 m_aClients[ClientId].m_AuthKey = -1;
4212
4213 GameServer()->OnSetAuthed(ClientId, AUTHED_NO);
4214}
4215
4216void CServer::LogoutKey(int Key, const char *pReason)
4217{

Callers 1

ConLogoutMethod · 0.80

Calls 4

str_formatFunction · 0.85
AddIntMethod · 0.80
KeyIdentMethod · 0.80
OnSetAuthedMethod · 0.80

Tested by

no test coverage detected