summaryrefslogtreecommitdiffstats
path: root/test.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-12-01 02:00:42 +0100
committerPetr Mrázek <peterix@gmail.com>2013-12-01 02:00:42 +0100
commitf27a6c39ea796f946893ced1d9f80441ad9aa18c (patch)
treefed31b28bc7752f4fea85aefddfeff62701e13b7 /test.cpp
parent2eaf33816b0c4f6fd61ea2b086fa1c4f9fcba4c5 (diff)
downloadMultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.gz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.lz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.xz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.zip
Fix login and startup logging issues
Auth uses the refresh endpoint instead of validate. This means less password entering. Console will now only autoscroll when already scrolled all the way down. Better conformance with the Yggdrasil auth protocol (not complete yet, but Mojang launcher isn't complete either). Fix bug that prevented saving the account data (uninitialized variable). Accounts can now trigger account list saving, this is used for the refresh endpoint.
Diffstat (limited to 'test.cpp')
-rw-r--r--test.cpp60
1 files changed, 0 insertions, 60 deletions
diff --git a/test.cpp b/test.cpp
deleted file mode 100644
index 2b015454..00000000
--- a/test.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-
-#include <iostream>
-
-#include "keyring.h"
-#include "cmdutils.h"
-
-using namespace Util::Commandline;
-
-#include <QCoreApplication>
-
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
- app.setApplicationName("MMC Keyring test");
- app.setOrganizationName("Orochimarufan");
-
- Parser p;
- p.addArgument("user", false);
- p.addArgument("password", false);
- p.addSwitch("set");
- p.addSwitch("get");
- p.addSwitch("list");
- p.addOption("service", "Test");
- p.addShortOpt("service", 's');
-
- QHash<QString, QVariant> args;
- try {
- args = p.parse(app.arguments());
- } catch (ParsingError) {
- std::cout << "Syntax error." << std::endl;
- return 1;
- }
-
- if (args["set"].toBool()) {
- if (args["user"].isNull() || args["password"].isNull()) {
- std::cout << "set operation needs bot user and password set" << std::endl;
- return 1;
- }
-
- return Keyring::instance()->storePassword(args["service"].toString(),
- args["user"].toString(), args["password"].toString());
- } else if (args["get"].toBool()) {
- if (args["user"].isNull()) {
- std::cout << "get operation needs user set" << std::endl;
- return 1;
- }
-
- std::cout << "Password: " << qPrintable(Keyring::instance()->getPassword(args["service"].toString(),
- args["user"].toString())) << std::endl;
- return 0;
- } else if (args["list"].toBool()) {
- QStringList accounts = Keyring::instance()->getStoredAccounts(args["service"].toString());
- std::cout << "stored accounts:" << std::endl << '\t' << qPrintable(accounts.join("\n\t")) << std::endl;
- return 0;
- } else {
- std::cout << "No operation given!" << std::endl;
- std::cout << qPrintable(p.compileHelp(argv[0])) << std::endl;
- return 1;
- }
-}