summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/auth/AuthSession.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-02-27 19:58:40 +0100
committerPetr Mrázek <peterix@gmail.com>2016-02-27 19:58:40 +0100
commit17ad1e64f824fba6d8f153191effdb2af7d387c8 (patch)
tree3c0996cab5cff0dcf3807afe08df66dda3a50ec4 /logic/minecraft/auth/AuthSession.cpp
parent71e4b147ec3b8c5f3e2a004920ffbc0a3b6e18c8 (diff)
downloadMultiMC-17ad1e64f824fba6d8f153191effdb2af7d387c8.tar
MultiMC-17ad1e64f824fba6d8f153191effdb2af7d387c8.tar.gz
MultiMC-17ad1e64f824fba6d8f153191effdb2af7d387c8.tar.lz
MultiMC-17ad1e64f824fba6d8f153191effdb2af7d387c8.tar.xz
MultiMC-17ad1e64f824fba6d8f153191effdb2af7d387c8.zip
NOISSUE move files into paths that make more sense
Diffstat (limited to 'logic/minecraft/auth/AuthSession.cpp')
-rw-r--r--logic/minecraft/auth/AuthSession.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/logic/minecraft/auth/AuthSession.cpp b/logic/minecraft/auth/AuthSession.cpp
new file mode 100644
index 00000000..8758bfbd
--- /dev/null
+++ b/logic/minecraft/auth/AuthSession.cpp
@@ -0,0 +1,30 @@
+#include "AuthSession.h"
+#include <QJsonObject>
+#include <QJsonArray>
+#include <QJsonDocument>
+#include <QStringList>
+
+QString AuthSession::serializeUserProperties()
+{
+ QJsonObject userAttrs;
+ for (auto key : u.properties.keys())
+ {
+ auto array = QJsonArray::fromStringList(u.properties.values(key));
+ userAttrs.insert(key, array);
+ }
+ QJsonDocument value(userAttrs);
+ return value.toJson(QJsonDocument::Compact);
+
+}
+
+bool AuthSession::MakeOffline(QString offline_playername)
+{
+ if (status != PlayableOffline && status != PlayableOnline)
+ {
+ return false;
+ }
+ session = "-";
+ player_name = offline_playername;
+ status = PlayableOffline;
+ return true;
+}