summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-04-14 20:21:00 +0200
committermadmaxoft <github@xoft.cz>2014-04-14 20:21:00 +0200
commitd505ffc704d85cc1b31ae87647ba979fda84f46f (patch)
treee76696eff4fff2a070316dffcac190e3b34dd5b1 /src/ClientHandle.cpp
parentMerge remote-tracking branch 'daniel0916/YggdrasilAuthentication' into Proto176 (diff)
downloadcuberite-d505ffc704d85cc1b31ae87647ba979fda84f46f.tar
cuberite-d505ffc704d85cc1b31ae87647ba979fda84f46f.tar.gz
cuberite-d505ffc704d85cc1b31ae87647ba979fda84f46f.tar.bz2
cuberite-d505ffc704d85cc1b31ae87647ba979fda84f46f.tar.lz
cuberite-d505ffc704d85cc1b31ae87647ba979fda84f46f.tar.xz
cuberite-d505ffc704d85cc1b31ae87647ba979fda84f46f.tar.zst
cuberite-d505ffc704d85cc1b31ae87647ba979fda84f46f.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 615039949..7e8c11d67 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -31,6 +31,8 @@
#include "CompositeChat.h"
#include "Items/ItemSword.h"
+#include "md5/md5.h"
+
/** Maximum number of explosions to send this tick, server will start dropping if exceeded */
@@ -175,6 +177,28 @@ void cClientHandle::Destroy(void)
+void cClientHandle::GenerateOfflineUUID(void)
+{
+ // Proper format for a version 3 UUID is:
+ // xxxxxxxx-xxxx-3xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is one of 8, 9, A, or B
+
+ // Generate an md5 checksum, and use it as base for the ID:
+ MD5 Checksum(m_Username);
+ m_UUID = Checksum.hexdigest();
+ m_UUID[12] = '3'; // Version 3 UUID
+ m_UUID[16] = '8'; // Variant 1 UUID
+
+ // Now the digest doesn't have the UUID slashes, but the client requires them, so add them into the appropriate positions:
+ m_UUID.insert(8, "-");
+ m_UUID.insert(13, "-");
+ m_UUID.insert(18, "-");
+ m_UUID.insert(23, "-");
+}
+
+
+
+
+
void cClientHandle::Kick(const AString & a_Reason)
{
if (m_State >= csAuthenticating) // Don't log pings