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

@@ -1798,6 +1798,24 @@ bool cClientHandle::HandleHandshake(const AString & a_Username)
return false;
}
}
if (!(cRoot::Get()->GetServer()->isAllowMultiLogin()))
{
std::list<std::string> usernamesServer = cRoot::Get()->GetServer()->GetUsernames();
std::list<std::string> usernamesWorld = cRoot::Get()->GetDefaultWorld()-> GetUsernames();
usernamesServer.sort();
usernamesWorld.sort();
usernamesServer.merge(usernamesWorld);
for (std::list<std::string>::iterator itr = usernamesServer.begin(); itr != usernamesServer.end(); ++itr)
{
if ((*itr).compare(a_Username) == 0)
{
Kick("User already logged in.");
return false;
}
}
}
return true;
}