diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-11-22 01:04:14 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-11-22 01:04:14 +0100 |
commit | 7f5eb5d61ad5c94da5e3a0443ffbcd9088285496 (patch) | |
tree | 89e4b8db259233d3377d2f46e30244db12b09ad5 | |
parent | 57a9dadb08a2a7ebfeba3d5f5234145b3db6c794 (diff) | |
download | MultiMC-7f5eb5d61ad5c94da5e3a0443ffbcd9088285496.tar MultiMC-7f5eb5d61ad5c94da5e3a0443ffbcd9088285496.tar.gz MultiMC-7f5eb5d61ad5c94da5e3a0443ffbcd9088285496.tar.lz MultiMC-7f5eb5d61ad5c94da5e3a0443ffbcd9088285496.tar.xz MultiMC-7f5eb5d61ad5c94da5e3a0443ffbcd9088285496.zip |
Implement user info stub for newest minecraft snapshot
-rw-r--r-- | gui/MainWindow.cpp | 2 | ||||
-rw-r--r-- | logic/InstanceLauncher.cpp | 2 | ||||
-rw-r--r-- | logic/OneSixInstance.cpp | 2 | ||||
-rw-r--r-- | logic/OneSixRule.h | 1 | ||||
-rw-r--r-- | logic/OneSixVersion.cpp | 2 | ||||
-rw-r--r-- | logic/lists/BaseVersionList.h | 1 | ||||
-rw-r--r-- | logic/lists/ForgeVersionList.h | 1 | ||||
-rw-r--r-- | logic/lists/InstanceList.h | 1 | ||||
-rw-r--r-- | logic/lists/JavaVersionList.h | 1 | ||||
-rw-r--r-- | logic/lists/MinecraftVersionList.h | 1 | ||||
-rw-r--r-- | logic/net/HttpMetaCache.h | 1 | ||||
-rw-r--r-- | logic/net/LoginTask.cpp | 15 | ||||
-rw-r--r-- | logic/net/LoginTask.h | 15 |
13 files changed, 25 insertions, 20 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index edc00762..842014d3 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -589,7 +589,7 @@ void MainWindow::doAutoLogin() void MainWindow::doLogin(QString username, QString password) { - UserInfo uInfo{username, password}; + PasswordLogin uInfo{username, password}; ProgressDialog *tDialog = new ProgressDialog(this); LoginTask *loginTask = new LoginTask(uInfo, tDialog); diff --git a/logic/InstanceLauncher.cpp b/logic/InstanceLauncher.cpp index 9f78e55b..f587e583 100644 --- a/logic/InstanceLauncher.cpp +++ b/logic/InstanceLauncher.cpp @@ -63,7 +63,7 @@ void InstanceLauncher::doLogin(const QString &errorMsg) loginDlg->exec(); if (loginDlg->result() == QDialog::Accepted) { - UserInfo uInfo{loginDlg->getUsername(), loginDlg->getPassword()}; + PasswordLogin uInfo{loginDlg->getUsername(), loginDlg->getPassword()}; ProgressDialog *tDialog = new ProgressDialog(nullptr); LoginTask *loginTask = new LoginTask(uInfo, tDialog); diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp index 5c93236b..7e0d48fd 100644 --- a/logic/OneSixInstance.cpp +++ b/logic/OneSixInstance.cpp @@ -93,6 +93,8 @@ QStringList OneSixInstance::processMinecraftArgs(LoginResponse response) token_mapping["game_directory"] = absRootDir; QString absAssetsDir = QDir("assets/").absolutePath(); token_mapping["game_assets"] = absAssetsDir; + //TODO: this is something new and not even fully implemented in the vanilla launcher. + token_mapping["user_properties"] = "{ }"; QStringList parts = args_pattern.split(' ', QString::SkipEmptyParts); for (int i = 0; i < parts.length(); i++) diff --git a/logic/OneSixRule.h b/logic/OneSixRule.h index 9cd1a226..5a13cbd9 100644 --- a/logic/OneSixRule.h +++ b/logic/OneSixRule.h @@ -16,7 +16,6 @@ #pragma once #include <QString> -#include <QSharedPointer> #include "logic/OneSixLibrary.h" diff --git a/logic/OneSixVersion.cpp b/logic/OneSixVersion.cpp index 01bf41f4..4e2bbda5 100644 --- a/logic/OneSixVersion.cpp +++ b/logic/OneSixVersion.cpp @@ -151,7 +151,7 @@ std::shared_ptr<OneSixVersion> OneSixVersion::fromJson(QJsonObject root) root.value("minimumLauncherVersion").toDouble(); // ADD MORE HERE :D - if (launcher_ver > 0 && launcher_ver <= 9) + if (launcher_ver > 0 && launcher_ver <= 10) return fromJsonV4(root, readVersion); else { diff --git a/logic/lists/BaseVersionList.h b/logic/lists/BaseVersionList.h index 5ac9369b..21b44e8d 100644 --- a/logic/lists/BaseVersionList.h +++ b/logic/lists/BaseVersionList.h @@ -18,7 +18,6 @@ #include <QObject> #include <QVariant> #include <QAbstractListModel> -#include <QSharedPointer> #include "logic/BaseVersion.h" diff --git a/logic/lists/ForgeVersionList.h b/logic/lists/ForgeVersionList.h index 0d10e1f3..bf9e87b2 100644 --- a/logic/lists/ForgeVersionList.h +++ b/logic/lists/ForgeVersionList.h @@ -17,7 +17,6 @@ #include <QObject> #include <QAbstractListModel> -#include <QSharedPointer> #include <QUrl> #include <QNetworkReply> diff --git a/logic/lists/InstanceList.h b/logic/lists/InstanceList.h index c3e3561d..d08501eb 100644 --- a/logic/lists/InstanceList.h +++ b/logic/lists/InstanceList.h @@ -16,7 +16,6 @@ #pragma once #include <QObject> -#include <QSharedPointer> #include <QAbstractListModel> #include "categorizedsortfilterproxymodel.h" #include <QIcon> diff --git a/logic/lists/JavaVersionList.h b/logic/lists/JavaVersionList.h index 4826ca0c..f816c932 100644 --- a/logic/lists/JavaVersionList.h +++ b/logic/lists/JavaVersionList.h @@ -17,7 +17,6 @@ #include <QObject> #include <QAbstractListModel> -#include <QSharedPointer> #include "BaseVersionList.h" #include "logic/tasks/Task.h" diff --git a/logic/lists/MinecraftVersionList.h b/logic/lists/MinecraftVersionList.h index 90b1ae86..82af1009 100644 --- a/logic/lists/MinecraftVersionList.h +++ b/logic/lists/MinecraftVersionList.h @@ -18,7 +18,6 @@ #include <QObject> #include <QList> #include <QSet> -#include <QSharedPointer> #include "BaseVersionList.h" #include "logic/tasks/Task.h" diff --git a/logic/net/HttpMetaCache.h b/logic/net/HttpMetaCache.h index e91d2684..08b39fe2 100644 --- a/logic/net/HttpMetaCache.h +++ b/logic/net/HttpMetaCache.h @@ -15,7 +15,6 @@ #pragma once #include <QString> -#include <QSharedPointer> #include <QMap> #include <qtimer.h> diff --git a/logic/net/LoginTask.cpp b/logic/net/LoginTask.cpp index 4a789bb4..5607447e 100644 --- a/logic/net/LoginTask.cpp +++ b/logic/net/LoginTask.cpp @@ -27,7 +27,8 @@ #include <QJsonParseError> #include <QJsonObject> -LoginTask::LoginTask(const UserInfo &uInfo, QObject *parent) : Task(parent), uInfo(uInfo) +LoginTask::LoginTask(const PasswordLogin &loginInfo, QObject *parent) + : Task(parent), loginInfo(loginInfo) { } @@ -49,8 +50,8 @@ void LoginTask::legacyLogin() "application/x-www-form-urlencoded"); QUrlQuery params; - params.addQueryItem("user", uInfo.username); - params.addQueryItem("password", uInfo.password); + params.addQueryItem("user", loginInfo.username); + params.addQueryItem("password", loginInfo.password); params.addQueryItem("version", "13"); netReply = worker->post(netRequest, params.query(QUrl::EncodeSpaces).toUtf8()); @@ -221,8 +222,8 @@ void LoginTask::yggdrasilLogin() agent.insert("name", QString("Minecraft")); agent.insert("version", QJsonValue(1)); root.insert("agent", agent); - root.insert("username", uInfo.username); - root.insert("password", uInfo.password); + root.insert("username", loginInfo.username); + root.insert("password", loginInfo.password); root.insert("clientToken", clientToken); QJsonDocument requestDoc(root); netReply = worker->post(netRequest, requestDoc.toJson()); @@ -247,6 +248,7 @@ void LoginTask::yggdrasilLogin() void LoginTask::parseYggdrasilReply(QByteArray data) { QJsonParseError jsonError; + QLOG_DEBUG() << data; QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError); if (jsonError.error != QJsonParseError::NoError) { @@ -273,6 +275,7 @@ void LoginTask::parseYggdrasilReply(QByteArray data) playerID = selectedProfileO.value("id").toString(); playerName = selectedProfileO.value("name").toString(); } + QString sessionID = "token:" + accessToken + ":" + playerID; /* struct LoginResponse @@ -285,6 +288,6 @@ void LoginTask::parseYggdrasilReply(QByteArray data) }; */ - result = {uInfo.username, sessionID, playerName, playerID, accessToken}; + result = {loginInfo.username, sessionID, playerName, playerID, accessToken}; emitSucceeded(); } diff --git a/logic/net/LoginTask.h b/logic/net/LoginTask.h index 26ac0808..fe4e6d2f 100644 --- a/logic/net/LoginTask.h +++ b/logic/net/LoginTask.h @@ -16,14 +16,20 @@ #pragma once #include "logic/tasks/Task.h" -#include <QSharedPointer> +#include <QMap> -struct UserInfo +struct PasswordLogin { QString username; QString password; }; +struct User +{ + QString id; + QMap<QString, QString> properties; +}; + struct LoginResponse { QString username; @@ -31,6 +37,7 @@ struct LoginResponse QString player_name; QString player_id; QString access_token; + User user; // FIXME: no idea what this really is yet. anything relevant? }; class QNetworkReply; @@ -39,7 +46,7 @@ class LoginTask : public Task { Q_OBJECT public: - explicit LoginTask(const UserInfo &uInfo, QObject *parent = 0); + explicit LoginTask(const PasswordLogin &loginInfo, QObject *parent = 0); LoginResponse getResult() { return result; @@ -65,5 +72,5 @@ protected: LoginResponse result; QNetworkReply *netReply; - UserInfo uInfo; + PasswordLogin loginInfo; }; |