Actually use QJson for Yggdrasil requests

This commit is contained in:
Petr Mrázek 2013-10-23 02:08:39 +02:00
parent c65bab6efe
commit c8b84257ae

View File

@ -213,14 +213,16 @@ void LoginTask::yggdrasilLogin()
clientToken.remove('{'); clientToken.remove('{');
clientToken.remove('}'); clientToken.remove('}');
// create the request // create the request
QString requestConstent; QJsonObject root;
requestConstent += "{"; QJsonObject agent;
requestConstent += " \"agent\":{\"name\":\"Minecraft\",\"version\":1},\n"; agent.insert("name", QString("Minecraft"));
requestConstent += " \"username\":\"" + uInfo.username + "\",\n"; agent.insert("version", QJsonValue(1));
requestConstent += " \"password\":\"" + uInfo.password + "\",\n"; root.insert("agent", agent);
requestConstent += " \"clientToken\":\"" + clientToken + "\"\n"; root.insert("username", uInfo.username);
requestConstent += "}"; root.insert("password", uInfo.password);
netReply = worker->post(netRequest, requestConstent.toUtf8()); root.insert("clientToken", clientToken);
QJsonDocument requestDoc(root);
netReply = worker->post(netRequest, requestDoc.toJson());
} }
/* /*