From c8b84257ae6bd45573beabac0fd8c4313436f3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 23 Oct 2013 02:08:39 +0200 Subject: [PATCH] Actually use QJson for Yggdrasil requests --- logic/net/LoginTask.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/logic/net/LoginTask.cpp b/logic/net/LoginTask.cpp index 4098783b..5717aa9f 100644 --- a/logic/net/LoginTask.cpp +++ b/logic/net/LoginTask.cpp @@ -213,14 +213,16 @@ void LoginTask::yggdrasilLogin() clientToken.remove('{'); clientToken.remove('}'); // create the request - QString requestConstent; - requestConstent += "{"; - requestConstent += " \"agent\":{\"name\":\"Minecraft\",\"version\":1},\n"; - requestConstent += " \"username\":\"" + uInfo.username + "\",\n"; - requestConstent += " \"password\":\"" + uInfo.password + "\",\n"; - requestConstent += " \"clientToken\":\"" + clientToken + "\"\n"; - requestConstent += "}"; - netReply = worker->post(netRequest, requestConstent.toUtf8()); + QJsonObject root; + QJsonObject agent; + 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("clientToken", clientToken); + QJsonDocument requestDoc(root); + netReply = worker->post(netRequest, requestDoc.toJson()); } /*