1
0

issue 1253 - prevent multiple logins with same username

This commit is contained in:
Vincent
2014-11-29 00:36:15 -08:00
parent 883230abbc
commit 61e761fdc2
5 changed files with 58 additions and 0 deletions

View File

@@ -201,6 +201,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni, bool a_ShouldAuth)
m_Description = a_SettingsIni.GetValueSet("Server", "Description", "MCServer - in C++!");
m_MaxPlayers = a_SettingsIni.GetValueSetI("Server", "MaxPlayers", 100);
m_bIsHardcore = a_SettingsIni.GetValueSetB("Server", "HardcoreEnabled", false);
m_bAllowMultiLogin = a_SettingsIni.GetValueSetB("Server", "AllowMultiLogin", false);
m_PlayerCount = 0;
m_PlayerCountDiff = 0;
@@ -303,6 +304,22 @@ int cServer::GetNumPlayers(void) const
std::list<std::string> cServer::GetUsernames()
{
std::list<std::string> usernames;
cCSLock Lock(m_CSClients);
for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr)
{
std::string username = (*itr)->GetUsername();
usernames.insert(usernames.begin(),username);
}
return usernames;
}
void cServer::PrepareKeys(void)
{
LOGD("Generating protocol encryption keypair...");