diff options
author | Andrew <forkk@forkk.net> | 2013-11-04 19:58:56 -0600 |
---|---|---|
committer | Andrew <forkk@forkk.net> | 2013-11-04 19:58:56 -0600 |
commit | 5083a6a8090fa03d3c1800c1f9588079ca11e9f9 (patch) | |
tree | 7c2e88c7184a7f5acf5e7a03be5c5f0bf6904113 /logic/net/LoginTask.cpp | |
parent | dc3b0fcb2b74aeede37b08216b203cab284f7fce (diff) | |
parent | bb7e8985f6d189de0acac6a1c3033cb16378c1fb (diff) | |
download | PrismLauncher-5083a6a8090fa03d3c1800c1f9588079ca11e9f9.tar.gz PrismLauncher-5083a6a8090fa03d3c1800c1f9588079ca11e9f9.tar.bz2 PrismLauncher-5083a6a8090fa03d3c1800c1f9588079ca11e9f9.zip |
Merge branch 'develop' of github.com:MultiMC/MultiMC5 into develop
Diffstat (limited to 'logic/net/LoginTask.cpp')
-rw-r--r-- | logic/net/LoginTask.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/logic/net/LoginTask.cpp b/logic/net/LoginTask.cpp index 5717aa9f..4a789bb4 100644 --- a/logic/net/LoginTask.cpp +++ b/logic/net/LoginTask.cpp @@ -100,7 +100,9 @@ void LoginTask::processYggdrasilReply(QNetworkReply *reply) processReply(reply, &LoginTask::parseYggdrasilReply, &LoginTask::parseYggdrasilError); } -void LoginTask::processReply(QNetworkReply *reply, std::function<void (LoginTask*, QByteArray)> parser, std::function<QString (LoginTask*, QNetworkReply*)> errorHandler) +void LoginTask::processReply(QNetworkReply *reply, + std::function<void(LoginTask *, QByteArray)> parser, + std::function<QString(LoginTask *, QNetworkReply *)> errorHandler) { if (netReply != reply) return; @@ -147,7 +149,7 @@ QString LoginTask::parseLegacyError(QNetworkReply *reply) case 503: return tr("The login servers are currently unavailable. Check " - "http://help.mojang.com/ for more info."); + "http://help.mojang.com/ for more info."); default: QLOG_DEBUG() << "Login failed with QNetworkReply code:" << reply->error(); @@ -161,7 +163,8 @@ QString LoginTask::parseYggdrasilError(QNetworkReply *reply) QJsonParseError jsonError; QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError); - // If there are JSON errors fall back to using the legacy error handling using HTTP status codes + // If there are JSON errors fall back to using the legacy error handling using HTTP status + // codes if (jsonError.error != QJsonParseError::NoError) { return parseLegacyError(reply); @@ -174,10 +177,10 @@ QString LoginTask::parseYggdrasilError(QNetworkReply *reply) QJsonObject root = jsonDoc.object(); - //QString error = root.value("error").toString(); + // QString error = root.value("error").toString(); QString errorMessage = root.value("errorMessage").toString(); - if(errorMessage.isEmpty()) + if (errorMessage.isEmpty()) { return parseLegacyError(reply); } @@ -230,14 +233,14 @@ void LoginTask::yggdrasilLogin() "accessToken": "random access token", // hexadecimal "clientToken": "client identifier", // identical to the one received "availableProfiles": [ // only present if the agent field was received - { - "id": "profile identifier", // hexadecimal - "name": "player name" - } + { + "id": "profile identifier", // hexadecimal + "name": "player name" + } ], "selectedProfile": { // only present if the agent field was received - "id": "profile identifier", - "name": "player name" + "id": "profile identifier", + "name": "player name" } } */ @@ -264,7 +267,7 @@ void LoginTask::parseYggdrasilReply(QByteArray data) QString playerID; QString playerName; auto selectedProfile = root.value("selectedProfile"); - if(selectedProfile.isObject()) + if (selectedProfile.isObject()) { auto selectedProfileO = selectedProfile.toObject(); playerID = selectedProfileO.value("id").toString(); @@ -281,7 +284,7 @@ void LoginTask::parseYggdrasilReply(QByteArray data) QString client_id; }; */ - + result = {uInfo.username, sessionID, playerName, playerID, accessToken}; emitSucceeded(); } |