summaryrefslogtreecommitdiffstats
path: root/source/cClientHandle.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-30 10:19:19 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-30 10:19:19 +0200
commitfa93c0cf5434384aac5a75aa3cb3910d3f7679a6 (patch)
treec29ab301118136e1ae5d36b820ddec57abc1346f /source/cClientHandle.cpp
parentFixed the VC2010 project file (diff)
downloadcuberite-fa93c0cf5434384aac5a75aa3cb3910d3f7679a6.tar
cuberite-fa93c0cf5434384aac5a75aa3cb3910d3f7679a6.tar.gz
cuberite-fa93c0cf5434384aac5a75aa3cb3910d3f7679a6.tar.bz2
cuberite-fa93c0cf5434384aac5a75aa3cb3910d3f7679a6.tar.lz
cuberite-fa93c0cf5434384aac5a75aa3cb3910d3f7679a6.tar.xz
cuberite-fa93c0cf5434384aac5a75aa3cb3910d3f7679a6.tar.zst
cuberite-fa93c0cf5434384aac5a75aa3cb3910d3f7679a6.zip
Diffstat (limited to 'source/cClientHandle.cpp')
-rw-r--r--source/cClientHandle.cpp62
1 files changed, 4 insertions, 58 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 0fd1597c4..6d217e6af 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -426,66 +426,21 @@ void cClientHandle::HandlePing(void)
-void cClientHandle::HandleHandshake(const AString & a_Username)
-{
- AStringVector UserData = StringSplit(a_Username, ";"); // "FakeTruth;localhost:25565"
- if (UserData.empty())
- {
- Kick("Did not receive username");
- return;
- }
- m_Username = UserData[0];
-
- LOGD("HANDSHAKE %s", m_Username.c_str());
-
- if (cRoot::Get()->GetDefaultWorld()->GetNumPlayers() >= cRoot::Get()->GetDefaultWorld()->GetMaxPlayers())
- {
- Kick("The server is currently full :(-- Try again later");
- return;
- }
- cRoot::Get()->GetServer()->BroadcastChat(m_Username + " is connecting.", this);
-
- SendHandshake(cRoot::Get()->GetServer()->GetServerID());
- LOGD("User \"%s\" was sent a handshake", m_Username.c_str());
-}
-
-
-
-
-
-void cClientHandle::HandleLogin(int a_ProtocolVersion, const AString & a_Username)
+bool cClientHandle::HandleLogin(int a_ProtocolVersion, const AString & a_Username)
{
LOGD("LOGIN %s", a_Username.c_str());
- if (a_ProtocolVersion < m_ProtocolVersion)
- {
- Kick("Your client is outdated!");
- return;
- }
- else if (a_ProtocolVersion > m_ProtocolVersion)
- {
- Kick("Your client version is higher than the server!");
- return;
- }
- if (m_Username.compare(a_Username) != 0)
- {
- LOGWARNING("Login Username (\"%s\") does not match Handshake username (\"%s\") for client @ \"%s\")",
- a_Username.c_str(),
- m_Username.c_str(),
- m_Socket.GetIPString().c_str()
- );
- Kick("Hacked client"); // Don't tell them why we don't want them
- return;
- }
+ m_Username = a_Username;
if (cRoot::Get()->GetPluginManager()->CallHookLogin(this, a_ProtocolVersion, a_Username))
{
Destroy();
- return;
+ return false;
}
// Schedule for authentication; until then, let them wait (but do not block)
m_State = csAuthenticating;
cRoot::Get()->GetAuthenticator().Authenticate(GetUniqueID(), GetUsername(), cRoot::Get()->GetServer()->GetServerID());
+ return true;
}
@@ -1066,15 +1021,6 @@ void cClientHandle::SendDisconnect(const AString & a_Reason)
-void cClientHandle::SendHandshake(const AString & a_ServerName)
-{
- m_Protocol->SendHandshake(a_ServerName);
-}
-
-
-
-
-
void cClientHandle::SendInventorySlot(int a_WindowID, short a_SlotNum, const cItem & a_Item)
{
m_Protocol->SendInventorySlot(a_WindowID, a_SlotNum, a_Item);