sneedmc/launcher/minecraft/auth/AuthSession.cpp

38 lines
806 B
C++
Raw Normal View History

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