Reacting to authentication success.
This commit is contained in:
@@ -857,10 +857,7 @@ ServerLobbyThread::HandleNetPacketInit(SessionWrapper session, const InitMessage
|
|||||||
SessionError(session, ERR_NET_VERSION_NOT_SUPPORTED);
|
SessionError(session, ERR_NET_VERSION_NOT_SUPPORTED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (initMessage.requestedVersion.major == 5 && (initMessage.requestedVersion.minor == 0 || initMessage.requestedVersion.minor == 1))
|
session.sessionData->SetMaxNumPlayers(MAX_NUMBER_OF_PLAYERS);
|
||||||
session.sessionData->SetMaxNumPlayers(7);
|
|
||||||
else
|
|
||||||
session.sessionData->SetMaxNumPlayers(MAX_NUMBER_OF_PLAYERS);
|
|
||||||
|
|
||||||
string playerName;
|
string playerName;
|
||||||
string password;
|
string password;
|
||||||
@@ -885,13 +882,6 @@ ServerLobbyThread::HandleNetPacketInit(SessionWrapper session, const InitMessage
|
|||||||
else
|
else
|
||||||
SessionError(session, ERR_NET_INVALID_PASSWORD);
|
SessionError(session, ERR_NET_INVALID_PASSWORD);
|
||||||
|
|
||||||
// Check the server password.
|
|
||||||
/* if (!CheckPassword(initData.password))
|
|
||||||
{
|
|
||||||
SessionError(session, ERR_NET_INVALID_PASSWORD);
|
|
||||||
return;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Check whether the player name is correct.
|
// Check whether the player name is correct.
|
||||||
// Partly, this is also done in netpacket.
|
// Partly, this is also done in netpacket.
|
||||||
// However, some disallowed names are checked only here.
|
// However, some disallowed names are checked only here.
|
||||||
@@ -1193,28 +1183,30 @@ ServerLobbyThread::HandleNetPacketChatRequest(SessionWrapper session, const Chat
|
|||||||
void
|
void
|
||||||
ServerLobbyThread::InitAfterLogin(SessionWrapper session)
|
ServerLobbyThread::InitAfterLogin(SessionWrapper session)
|
||||||
{
|
{
|
||||||
assert(session.playerData);
|
if (session.sessionData && session.playerData)
|
||||||
const MD5Buf &avatarMD5 = session.playerData->GetAvatarMD5();
|
|
||||||
string avatarFileName;
|
|
||||||
if (!avatarMD5.IsZero()
|
|
||||||
&& !GetAvatarManager().GetAvatarFileName(avatarMD5, avatarFileName))
|
|
||||||
{
|
{
|
||||||
bool avatarRecentlyRequested = false;
|
const MD5Buf &avatarMD5 = session.playerData->GetAvatarMD5();
|
||||||
|
string avatarFileName;
|
||||||
|
if (!avatarMD5.IsZero()
|
||||||
|
&& !GetAvatarManager().GetAvatarFileName(avatarMD5, avatarFileName))
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_timerAvatarClientAddressMapMutex);
|
bool avatarRecentlyRequested = false;
|
||||||
if (m_timerAvatarClientAddressMap.find(session.sessionData->GetClientAddr()) != m_timerAvatarClientAddressMap.end())
|
{
|
||||||
avatarRecentlyRequested = true;
|
boost::mutex::scoped_lock lock(m_timerAvatarClientAddressMapMutex);
|
||||||
|
if (m_timerAvatarClientAddressMap.find(session.sessionData->GetClientAddr()) != m_timerAvatarClientAddressMap.end())
|
||||||
|
avatarRecentlyRequested = true;
|
||||||
|
}
|
||||||
|
if (avatarRecentlyRequested)
|
||||||
|
SessionError(session, ERR_NET_AVATAR_UPLOAD_BLOCKED);
|
||||||
|
else
|
||||||
|
RequestPlayerAvatar(session);
|
||||||
}
|
}
|
||||||
if (avatarRecentlyRequested)
|
|
||||||
SessionError(session, ERR_NET_AVATAR_UPLOAD_BLOCKED);
|
|
||||||
else
|
else
|
||||||
RequestPlayerAvatar(session);
|
{
|
||||||
}
|
if (!avatarFileName.empty())
|
||||||
else
|
session.playerData->SetAvatarFile(avatarFileName);
|
||||||
{
|
EstablishSession(session);
|
||||||
if (!avatarFileName.empty())
|
}
|
||||||
session.playerData->SetAvatarFile(avatarFileName);
|
|
||||||
EstablishSession(session);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1263,6 +1255,7 @@ ServerLobbyThread::AuthenticatePlayer(SessionWrapper session, const std::string
|
|||||||
void
|
void
|
||||||
ServerLobbyThread::AuthenticationSuccess(unsigned playerId, db_id dbPlayerId)
|
ServerLobbyThread::AuthenticationSuccess(unsigned playerId, db_id dbPlayerId)
|
||||||
{
|
{
|
||||||
|
InitAfterLogin(m_sessionManager.GetSessionByUniquePlayerId(playerId, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user