Showing the changes to interface/src/DiscoverabilityManager.cpp (1 of 2 files). Show all
Unified · Split
| @@ -15,6 +15,7 @@ · 14 unmodified lines | |||
| 15 | #include <AddressManager.h> | 15 | #include <AddressManager.h> |
| 16 | #include <DomainHandler.h> | 16 | #include <DomainHandler.h> |
| 17 | #include <NodeList.h> | 17 | #include <NodeList.h> |
| 18 | #include <UserActivityLogger.h> | ||
| 18 | #include <UUID.h> | 19 | #include <UUID.h> |
| 19 | 20 | ||
| 20 | #include "DiscoverabilityManager.h" | 21 | #include "DiscoverabilityManager.h" |
| @@ -44,6 +45,7 @@ void DiscoverabilityManager::updateLocation() { · 23 unmodified lines | |||
| 44 | QJsonObject rootObject; | 45 | QJsonObject rootObject; |
| 45 | 46 | ||
| 46 | QJsonObject locationObject; | 47 | QJsonObject locationObject; |
| 48 | |||
| 47 | 49 | ||
| 48 | QString pathString = addressManager->currentPath(); | 50 | QString pathString = addressManager->currentPath(); |
| 49 | 51 | ||
| @@ -56,13 +58,22 @@ void DiscoverabilityManager::updateLocation() { · 6 unmodified lines | |||
| 56 | const QString PLACE_ID_KEY_IN_LOCATION = "place_id"; | 58 | const QString PLACE_ID_KEY_IN_LOCATION = "place_id"; |
| 57 | locationObject.insert(PLACE_ID_KEY_IN_LOCATION, | 59 | locationObject.insert(PLACE_ID_KEY_IN_LOCATION, |
| 58 | uuidStringWithoutCurlyBraces(addressManager->getRootPlaceID())); | 60 | uuidStringWithoutCurlyBraces(addressManager->getRootPlaceID())); |
| 59 | 61 | } | |
| 60 | } else { | 62 | |
| 63 | if (!domainHandler.getUUID().isNull()) { | ||
| 61 | const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id"; | 64 | const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id"; |
| 62 | locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, | 65 | locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, |
| 63 | uuidStringWithoutCurlyBraces(domainHandler.getUUID())); | 66 | uuidStringWithoutCurlyBraces(domainHandler.getUUID())); |
| 64 | } | 67 | } |
| 65 | 68 | ||
| 69 | // in case the place/domain isn't in the database, we send the network address and port | ||
| 70 | auto& domainSockAddr = domainHandler.getSockAddr(); | ||
| 71 | const QString NETWORK_ADRESS_KEY_IN_LOCATION = "network_address"; | ||
| 72 | locationObject.insert(NETWORK_ADRESS_KEY_IN_LOCATION, domainSockAddr.getAddress().toString()); | ||
| 73 | |||
| 74 | const QString NETWORK_ADDRESS_PORT_IN_LOCATION = "network_port"; | ||
| 75 | locationObject.insert(NETWORK_ADDRESS_PORT_IN_LOCATION, domainSockAddr.getPort()); | ||
| 76 | |||
| 66 | const QString FRIENDS_ONLY_KEY_IN_LOCATION = "friends_only"; | 77 | const QString FRIENDS_ONLY_KEY_IN_LOCATION = "friends_only"; |
| 67 | locationObject.insert(FRIENDS_ONLY_KEY_IN_LOCATION, (_mode.get() == Discoverability::Friends)); | 78 | locationObject.insert(FRIENDS_ONLY_KEY_IN_LOCATION, (_mode.get() == Discoverability::Friends)); |
| 68 | 79 | ||
| @@ -72,7 +83,7 @@ void DiscoverabilityManager::updateLocation() { · 3 unmodified lines | |||
| 72 | QNetworkAccessManager::PutOperation, | 83 | QNetworkAccessManager::PutOperation, |
| 73 | JSONCallbackParameters(), QJsonDocument(rootObject).toJson()); | 84 | JSONCallbackParameters(), QJsonDocument(rootObject).toJson()); |
| 74 | } | 85 | } |
| 75 | } else { | 86 | } else if (UserActivityLogger::getInstance().isEnabled()) { |
| 76 | // we still send a heartbeat to the metaverse server for stats collection | 87 | // we still send a heartbeat to the metaverse server for stats collection |
| 77 | const QString API_USER_HEARTBEAT_PATH = "/api/v1/user/heartbeat"; | 88 | const QString API_USER_HEARTBEAT_PATH = "/api/v1/user/heartbeat"; |
| 78 | accountManager.sendRequest(API_USER_HEARTBEAT_PATH, AccountManagerAuth::Required, QNetworkAccessManager::PutOperation); | 89 | accountManager.sendRequest(API_USER_HEARTBEAT_PATH, AccountManagerAuth::Required, QNetworkAccessManager::PutOperation); |