sneedmc/launcher/minecraft/auth/AuthSession.cpp
Petr Mrázek 3a53349e33 GH-3392 dirty initial MSA support that shares logic with Mojang flows
Both act as the first step of AuthContext.
2021-08-15 23:18:50 +02:00

33 lines
727 B
C++

#include "AuthSession.h"
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
#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 = "-";
player_name = offline_playername;
status = PlayableOffline;
return true;
}