Showing the changes to interface/src/DiscoverabilityManager.cpp (1 of 2 files). Show all
Unified · Split
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <AddressManager.h> |
| 16 | 16 | #include <DomainHandler.h> |
| 17 | 17 | #include <NodeList.h> |
| 18 | +#include <UserActivityLogger.h> | |
| 18 | 19 | #include <UUID.h> |
| 19 | 20 | |
| 20 | 21 | #include "DiscoverabilityManager.h" |
| @@ -44,6 +45,7 @@ void DiscoverabilityManager::updateLocation() { · 23 unmodified lines | ||
| 44 | 45 | QJsonObject rootObject; |
| 45 | 46 | |
| 46 | 47 | QJsonObject locationObject; |
| 48 | + | |
| 47 | 49 | |
| 48 | 50 | QString pathString = addressManager->currentPath(); |
| 49 | 51 | |
| @@ -56,13 +58,22 @@ void DiscoverabilityManager::updateLocation() { · 6 unmodified lines | ||
| 56 | 58 | const QString PLACE_ID_KEY_IN_LOCATION = "place_id"; |
| 57 | 59 | locationObject.insert(PLACE_ID_KEY_IN_LOCATION, |
| 58 | 60 | uuidStringWithoutCurlyBraces(addressManager->getRootPlaceID())); |
| 59 | − | |
| 60 | − } else { | |
| 61 | + } | |
| 62 | + | |
| 63 | + if (!domainHandler.getUUID().isNull()) { | |
| 61 | 64 | const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id"; |
| 62 | 65 | locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, |
| 63 | 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 | 77 | const QString FRIENDS_ONLY_KEY_IN_LOCATION = "friends_only"; |
| 67 | 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 | 83 | QNetworkAccessManager::PutOperation, |
| 73 | 84 | JSONCallbackParameters(), QJsonDocument(rootObject).toJson()); |
| 74 | 85 | } |
| 75 | − } else { | |
| 86 | + } else if (UserActivityLogger::getInstance().isEnabled()) { | |
| 76 | 87 | // we still send a heartbeat to the metaverse server for stats collection |
| 77 | 88 | const QString API_USER_HEARTBEAT_PATH = "/api/v1/user/heartbeat"; |
| 78 | 89 | accountManager.sendRequest(API_USER_HEARTBEAT_PATH, AccountManagerAuth::Required, QNetworkAccessManager::PutOperation); |