diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-12-14 01:18:54 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-12-14 01:18:54 +0100 |
commit | bbd17b6224ea1cbccbe602a123b828b20ec5619f (patch) | |
tree | 317a73a487402deaadba6cf3a8941e72242d7b66 /logic/auth | |
parent | 1e96a0c8eba2d932e08a33ec909cf8141f1aaa43 (diff) | |
download | MultiMC-bbd17b6224ea1cbccbe602a123b828b20ec5619f.tar MultiMC-bbd17b6224ea1cbccbe602a123b828b20ec5619f.tar.gz MultiMC-bbd17b6224ea1cbccbe602a123b828b20ec5619f.tar.lz MultiMC-bbd17b6224ea1cbccbe602a123b828b20ec5619f.tar.xz MultiMC-bbd17b6224ea1cbccbe602a123b828b20ec5619f.zip |
Fix twitch
Diffstat (limited to 'logic/auth')
-rw-r--r-- | logic/auth/MojangAccount.cpp | 4 | ||||
-rw-r--r-- | logic/auth/MojangAccount.h | 5 | ||||
-rw-r--r-- | logic/auth/flows/AuthenticateTask.cpp | 6 | ||||
-rw-r--r-- | logic/auth/flows/RefreshTask.cpp | 9 |
4 files changed, 14 insertions, 10 deletions
diff --git a/logic/auth/MojangAccount.cpp b/logic/auth/MojangAccount.cpp index 185c735c..bc6af98f 100644 --- a/logic/auth/MojangAccount.cpp +++ b/logic/auth/MojangAccount.cpp @@ -68,6 +68,7 @@ MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object) User u; QJsonObject userStructure = object.value("user").toObject(); u.id = userStructure.value("id").toString(); + /* QJsonObject propMap = userStructure.value("properties").toObject(); for(auto key: propMap.keys()) { @@ -75,6 +76,7 @@ MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object) for(auto value: values) u.properties.insert(key, value.toString()); } + */ account->m_user = u; } account->m_username = username; @@ -119,6 +121,7 @@ QJsonObject MojangAccount::saveToJson() const QJsonObject userStructure; { userStructure.insert("id", m_user.id); + /* QJsonObject userAttrs; for(auto key: m_user.properties.keys()) { @@ -126,6 +129,7 @@ QJsonObject MojangAccount::saveToJson() const userAttrs.insert(key, array); } userStructure.insert("properties", userAttrs); + */ } json.insert("user", userStructure); diff --git a/logic/auth/MojangAccount.h b/logic/auth/MojangAccount.h index 9eecbc4f..325aa826 100644 --- a/logic/auth/MojangAccount.h +++ b/logic/auth/MojangAccount.h @@ -122,6 +122,11 @@ public: /* queries */ return m_profiles; } + const User & user() + { + return m_user; + } + //! Get the session ID required for legacy Minecraft versions QString sessionId() const { diff --git a/logic/auth/flows/AuthenticateTask.cpp b/logic/auth/flows/AuthenticateTask.cpp index cc26cd1b..f60be35d 100644 --- a/logic/auth/flows/AuthenticateTask.cpp +++ b/logic/auth/flows/AuthenticateTask.cpp @@ -162,23 +162,17 @@ bool AuthenticateTask::processResponse(QJsonObject responseData) } // this is what the vanilla launcher passes to the userProperties launch param - // doesn't seem to be used for anything so far? I don't get any of this data on my account - // (peterixxx) - // is it a good idea to log this? if (responseData.contains("user")) { User u; auto obj = responseData.value("user").toObject(); u.id = obj.value("id").toString(); - QLOG_DEBUG() << "User ID: " << u.id ; auto propArray = obj.value("properties").toArray(); - QLOG_DEBUG() << "User Properties: "; for (auto prop : propArray) { auto propTuple = prop.toObject(); auto name = propTuple.value("name").toString(); auto value = propTuple.value("value").toString(); - QLOG_DEBUG() << name << " : " << value; u.properties.insert(name, value); } m_account->m_user = u; diff --git a/logic/auth/flows/RefreshTask.cpp b/logic/auth/flows/RefreshTask.cpp index 16feac6e..5f68ccc7 100644 --- a/logic/auth/flows/RefreshTask.cpp +++ b/logic/auth/flows/RefreshTask.cpp @@ -112,20 +112,21 @@ bool RefreshTask::processResponse(QJsonObject responseData) // this is what the vanilla launcher passes to the userProperties launch param if (responseData.contains("user")) { + User u; auto obj = responseData.value("user").toObject(); - auto userId = obj.value("id").toString(); + u.id = obj.value("id").toString(); auto propArray = obj.value("properties").toArray(); - QLOG_DEBUG() << "User ID: " << userId; - QLOG_DEBUG() << "User Properties: "; for (auto prop : propArray) { auto propTuple = prop.toObject(); auto name = propTuple.value("name").toString(); auto value = propTuple.value("value").toString(); - QLOG_DEBUG() << name << " : " << value; + u.properties.insert(name, value); } + m_account->m_user = u; } + // We've made it through the minefield of possible errors. Return true to indicate that // we've succeeded. QLOG_DEBUG() << "Finished reading refresh response."; |