PrismLauncher/launcher/minecraft/auth/AuthSession.cpp

38 lines
825 B
C++
Raw Normal View History

#include "AuthSession.h"
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QStringList>
QString AuthSession::serializeUserProperties()
{
2018-07-15 13:51:05 +01:00
QJsonObject userAttrs;
/*
2018-07-15 13:51:05 +01:00
for (auto key : u.properties.keys())
{
auto array = QJsonArray::fromStringList(u.properties.values(key));
userAttrs.insert(key, array);
}
*/
2018-07-15 13:51:05 +01:00
QJsonDocument value(userAttrs);
return value.toJson(QJsonDocument::Compact);
}
bool AuthSession::MakeOffline(QString offline_playername)
{
if (status != PlayableOffline && status != PlayableOnline) {
2018-07-15 13:51:05 +01:00
return false;
}
session = "-";
access_token = "0";
2018-07-15 13:51:05 +01:00
player_name = offline_playername;
status = PlayableOffline;
return true;
}
void AuthSession::MakeDemo()
{
player_name = "Player";
demo = true;
}