From 6b0c7956559f895e23367f4f1a2db3ca8a1850ea Mon Sep 17 00:00:00 2001 From: Mattes D Date: Mon, 23 Jan 2017 17:42:52 +0100 Subject: Fixed ClientHandle:GetProtocolVersion returning wrong number. --- src/ClientHandle.cpp | 10 ++-------- src/ClientHandle.h | 2 +- src/Protocol/Protocol_1_8.cpp | 4 ++-- src/Protocol/Protocol_1_9.cpp | 4 ++-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 0d6655693..f82166820 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -680,7 +680,7 @@ void cClientHandle::HandlePing(void) -bool cClientHandle::HandleLogin(UInt32 a_ProtocolVersion, const AString & a_Username) +bool cClientHandle::HandleLogin(const AString & a_Username) { { cCSLock lock(m_CSState); @@ -696,16 +696,10 @@ bool cClientHandle::HandleLogin(UInt32 a_ProtocolVersion, const AString & a_User // LOGD("Handling login for client %s @ %s (%p), state = %d", a_Username.c_str(), m_IPString.c_str(), static_cast(this), m_State.load()); - // If the protocol version hasn't been set yet, set it now: - if (m_ProtocolVersion == 0) - { - m_ProtocolVersion = a_ProtocolVersion; - } - m_Username = a_Username; // Let the plugins know about this event, they may refuse the player: - if (cRoot::Get()->GetPluginManager()->CallHookLogin(*this, a_ProtocolVersion, a_Username)) + if (cRoot::Get()->GetPluginManager()->CallHookLogin(*this, m_ProtocolVersion, a_Username)) { Destroy(); return false; diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 95598838e..1953ab953 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -359,7 +359,7 @@ public: // tolua_export /** Called when the protocol has finished logging the user in. Return true to allow the user in; false to kick them. */ - bool HandleLogin(UInt32 a_ProtocolVersion, const AString & a_Username); + bool HandleLogin(const AString & a_Username); void SendData(const char * a_Data, size_t a_Size); diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index 2e7902303..07366210e 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -2201,7 +2201,7 @@ void cProtocol_1_8_0::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBu } StartEncryption(DecryptedKey); - m_Client->HandleLogin(4, m_Client->GetUsername()); + m_Client->HandleLogin(m_Client->GetUsername()); } @@ -2238,7 +2238,7 @@ void cProtocol_1_8_0::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer) return; } - m_Client->HandleLogin(4, Username); + m_Client->HandleLogin(Username); } diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index 69b8deb55..1bda4b853 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -2223,7 +2223,7 @@ void cProtocol_1_9_0::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBu } StartEncryption(DecryptedKey); - m_Client->HandleLogin(4, m_Client->GetUsername()); + m_Client->HandleLogin(m_Client->GetUsername()); } @@ -2260,7 +2260,7 @@ void cProtocol_1_9_0::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer) return; } - m_Client->HandleLogin(4, Username); + m_Client->HandleLogin(Username); } -- cgit v1.2.3