|
@@ -47,6 +47,7 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
const Json::Value command = root["command"];
|
|
|
string cmd = command.asString();
|
|
|
+ qInfo() << QString::fromStdString("Received command " + cmd);
|
|
|
|
|
|
if (cmd == "status") {
|
|
|
emit footerSetStatus(root["response"].asString().c_str());
|
|
@@ -68,7 +69,12 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
|
|
|
else if (cmd == "connect") {
|
|
|
- if (root["accept"] == false) {
|
|
|
+ if(root["accept"].asBool()) {
|
|
|
+ write(outpipefd[1], (_USERNAME + "\n").toUtf8().constData(),
|
|
|
+ strlen((_USERNAME + "\n").toUtf8().constData()));
|
|
|
+ write(outpipefd[1], (_PASSWORD + "\n").toUtf8().constData(),
|
|
|
+ strlen((_PASSWORD + "\n").toUtf8().constData()));
|
|
|
+ } else {
|
|
|
emit ipPopupSetStatus(root["error"].asString().c_str());
|
|
|
close(outpipefd[1]);
|
|
|
close(inpipefd[0]);
|
|
@@ -76,12 +82,7 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
|
|
|
else if (cmd == "version") {
|
|
|
- if (root["accept"] == true) {
|
|
|
- write(outpipefd[1], _USERNAME.toUtf8().constData(),
|
|
|
- strlen(_USERNAME.toUtf8().constData()));
|
|
|
- write(outpipefd[1], _PASSWORD.toUtf8().constData(),
|
|
|
- strlen(_PASSWORD.toUtf8().constData()));
|
|
|
- } else {
|
|
|
+ if (root["accept"].asBool() == false) {
|
|
|
QString errorMessage = QString::fromStdString(string(
|
|
|
"Version mismatch: \nClient: " + root["clientversion"].asString() +
|
|
|
"\nServer: " + root["serverversion"].asString()));
|
|
@@ -92,7 +93,7 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
|
|
|
else if (cmd == "login") {
|
|
|
- if (root["accept"] == true) {
|
|
|
+ if (root["accept"].asBool() == true) {
|
|
|
emit ipPopupClose();
|
|
|
} else {
|
|
|
emit ipPopupSetStatus(root["error"].asString().c_str());
|