mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 12:09:52 +02:00
fix sessionID pull and re-sent for HB
This commit is contained in:
parent
839c7fb8c2
commit
a5d09e268d
3 changed files with 18 additions and 5 deletions
|
@ -107,12 +107,10 @@ void DiscoverabilityManager::updateLocation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply) {
|
void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply) {
|
||||||
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply.readAll()).object();
|
auto dataObject = AccountManager::dataObjectFromResponse(requestReply);
|
||||||
|
|
||||||
static const QString STATUS_KEY = "status";
|
if (!dataObject.isEmpty()) {
|
||||||
|
_sessionID = dataObject[SESSION_ID_KEY].toString();
|
||||||
if (jsonObject.contains(STATUS_KEY) && jsonObject[STATUS_KEY] == "success") {
|
|
||||||
_sessionID = jsonObject[SESSION_ID_KEY].toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,19 @@ JSONCallbackParameters::JSONCallbackParameters(QObject* jsonCallbackReceiver, co
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QJsonObject AccountManager::dataObjectFromResponse(QNetworkReply &requestReply) {
|
||||||
|
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply.readAll()).object();
|
||||||
|
|
||||||
|
static const QString STATUS_KEY = "status";
|
||||||
|
static const QString DATA_KEY = "data";
|
||||||
|
|
||||||
|
if (jsonObject.contains(STATUS_KEY) && jsonObject[STATUS_KEY] == "success" && jsonObject.contains(DATA_KEY)) {
|
||||||
|
return jsonObject[DATA_KEY].toObject();
|
||||||
|
} else {
|
||||||
|
return QJsonObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AccountManager::AccountManager() :
|
AccountManager::AccountManager() :
|
||||||
_authURL(),
|
_authURL(),
|
||||||
_pendingCallbackMap()
|
_pendingCallbackMap()
|
||||||
|
|
|
@ -77,6 +77,8 @@ public:
|
||||||
|
|
||||||
DataServerAccountInfo& getAccountInfo() { return _accountInfo; }
|
DataServerAccountInfo& getAccountInfo() { return _accountInfo; }
|
||||||
|
|
||||||
|
static QJsonObject dataObjectFromResponse(QNetworkReply& requestReply);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void requestAccessToken(const QString& login, const QString& password);
|
void requestAccessToken(const QString& login, const QString& password);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue