|
|
@ -38,18 +38,17 @@ QByteArray Toxme::makeJsonRequest(QString url, QString json, QNetworkReply::Netw |
|
|
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); |
|
|
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); |
|
|
|
QNetworkReply* reply = netman.post(request,json.toUtf8()); |
|
|
|
QNetworkReply* reply = netman.post(request,json.toUtf8()); |
|
|
|
|
|
|
|
|
|
|
|
while (reply->isRunning()) { |
|
|
|
while (!reply->isFinished()) |
|
|
|
error = reply->error(); |
|
|
|
{ |
|
|
|
if (error) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reply->waitForReadyRead(100); |
|
|
|
|
|
|
|
qApp->processEvents(); |
|
|
|
qApp->processEvents(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
error = reply->error(); |
|
|
|
error = reply->error(); |
|
|
|
if (error) |
|
|
|
if (error) |
|
|
|
qWarning() << "makeJsonRequest: A network error occured:" << error.errorString(); |
|
|
|
{ |
|
|
|
|
|
|
|
qWarning() << "makeJsonRequest: A network error occured:" << reply->errorString(); |
|
|
|
|
|
|
|
return QByteArray(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return reply->readAll(); |
|
|
|
return reply->readAll(); |
|
|
|
} |
|
|
|
} |
|
|
@ -65,18 +64,17 @@ QByteArray Toxme::getServerPubkey(QString url, QNetworkReply::NetworkError &erro |
|
|
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); |
|
|
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); |
|
|
|
QNetworkReply* reply = netman.get(request); |
|
|
|
QNetworkReply* reply = netman.get(request); |
|
|
|
|
|
|
|
|
|
|
|
while (reply->isRunning()) { |
|
|
|
while (!reply->isFinished()) |
|
|
|
error = reply->error(); |
|
|
|
{ |
|
|
|
if (error) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reply->waitForReadyRead(100); |
|
|
|
|
|
|
|
qApp->processEvents(); |
|
|
|
qApp->processEvents(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
error = reply->error(); |
|
|
|
error = reply->error(); |
|
|
|
if (error) |
|
|
|
if (error) |
|
|
|
qWarning() << "getServerPubkey: A network error occured:" << error.errorString(); |
|
|
|
{ |
|
|
|
|
|
|
|
qWarning() << "getServerPubkey: A network error occured:" << reply->errorString(); |
|
|
|
|
|
|
|
return QByteArray(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Extract key
|
|
|
|
// Extract key
|
|
|
|
static const QByteArray pattern{"key\":\""}; |
|
|
|
static const QByteArray pattern{"key\":\""}; |
|
|
|