2014-01-27 02:00:49 +00:00
|
|
|
#include "AuthSession.h"
|
|
|
|
#include <QJsonArray>
|
|
|
|
#include <QJsonDocument>
|
2023-08-14 17:16:53 +01:00
|
|
|
#include <QJsonObject>
|
2014-01-27 02:00:49 +00:00
|
|
|
#include <QStringList>
|
|
|
|
|
|
|
|
QString AuthSession::serializeUserProperties()
|
|
|
|
{
|
|
|
|
QJsonObject userAttrs;
|
2021-07-26 20:44:11 +01:00
|
|
|
/*
|
2014-01-27 02:00:49 +00:00
|
|
|
for (auto key : u.properties.keys())
|
|
|
|
{
|
|
|
|
auto array = QJsonArray::fromStringList(u.properties.values(key));
|
|
|
|
userAttrs.insert(key, array);
|
|
|
|
}
|
2021-07-26 20:44:11 +01:00
|
|
|
*/
|
2014-01-27 02:00:49 +00:00
|
|
|
QJsonDocument value(userAttrs);
|
|
|
|
return value.toJson(QJsonDocument::Compact);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AuthSession::MakeOffline(QString offline_playername)
|
|
|
|
{
|
2023-08-14 17:16:53 +01:00
|
|
|
if (status != PlayableOffline && status != PlayableOnline) {
|
2014-01-27 02:00:49 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
session = "-";
|
2023-07-17 23:07:06 +01:00
|
|
|
access_token = "0";
|
2014-01-27 02:00:49 +00:00
|
|
|
player_name = offline_playername;
|
|
|
|
status = PlayableOffline;
|
|
|
|
return true;
|
|
|
|
}
|
2021-12-30 20:26:29 +00:00
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
void AuthSession::MakeDemo()
|
|
|
|
{
|
2021-12-30 20:26:29 +00:00
|
|
|
player_name = "Player";
|
|
|
|
demo = true;
|
|
|
|
}
|