2014-01-27 07:30:49 +05:30
|
|
|
#include "AuthSession.h"
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QJsonArray>
|
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QStringList>
|
|
|
|
|
|
|
|
QString AuthSession::serializeUserProperties()
|
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
QJsonObject userAttrs;
|
2021-07-27 01:14:11 +05:30
|
|
|
/*
|
2018-07-15 18:21:05 +05:30
|
|
|
for (auto key : u.properties.keys())
|
|
|
|
{
|
|
|
|
auto array = QJsonArray::fromStringList(u.properties.values(key));
|
|
|
|
userAttrs.insert(key, array);
|
|
|
|
}
|
2021-07-27 01:14:11 +05:30
|
|
|
*/
|
2018-07-15 18:21:05 +05:30
|
|
|
QJsonDocument value(userAttrs);
|
|
|
|
return value.toJson(QJsonDocument::Compact);
|
2014-01-27 07:30:49 +05:30
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AuthSession::MakeOffline(QString offline_playername)
|
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
if (status != PlayableOffline && status != PlayableOnline)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
session = "-";
|
|
|
|
player_name = offline_playername;
|
|
|
|
status = PlayableOffline;
|
|
|
|
return true;
|
2014-01-27 07:30:49 +05:30
|
|
|
}
|
2021-12-31 01:56:29 +05:30
|
|
|
|
|
|
|
void AuthSession::MakeDemo() {
|
|
|
|
player_name = "Player";
|
|
|
|
demo = true;
|
|
|
|
}
|