-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuthSession.cpp
More file actions
42 lines (39 loc) · 997 Bytes
/
AuthSession.cpp
File metadata and controls
42 lines (39 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "AuthSession.h"
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#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 = "-";
access_token = "0";
player_name = offline_playername;
status = PlayableOffline;
return true;
}
void AuthSession::MakeDemo(QString name, QString u)
{
wants_online = false;
demo = true;
uuid = u;
session = "-";
access_token = "0";
player_name = name;
status = PlayableOnline; // needs online to download the assets
};