From 92b8cd2d1e888e23d66d10c54ff939c5ef56b817 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 13 Jan 2015 15:02:04 -0800 Subject: [PATCH] handle storage of user location in new format --- interface/src/Application.cpp | 19 ++++++++++++++----- libraries/networking/src/AddressManager.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6960f2d025..c156de03ca 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3124,23 +3124,32 @@ void Application::updateWindowTitle(){ void Application::updateLocationInServer() { AccountManager& accountManager = AccountManager::getInstance(); + AddressManager::SharedPointer addressManager = DependencyManager::get(); DomainHandler& domainHandler = NodeList::getInstance()->getDomainHandler(); - if (accountManager.isLoggedIn() && domainHandler.isConnected() && !domainHandler.getUUID().isNull()) { + if (accountManager.isLoggedIn() && domainHandler.isConnected() + && (!addressManager->getRootPlaceID().isNull() || !domainHandler.getUUID().isNull())) { // construct a QJsonObject given the user's current address information QJsonObject rootObject; QJsonObject locationObject; - QString pathString = DependencyManager::get()->currentPath(); + QString pathString = addressManager->currentPath(); const QString LOCATION_KEY_IN_ROOT = "location"; - const QString PATH_KEY_IN_LOCATION = "path"; - const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id"; + const QString PATH_KEY_IN_LOCATION = "path"; locationObject.insert(PATH_KEY_IN_LOCATION, pathString); - locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, domainHandler.getUUID().toString()); + + if (!addressManager->getRootPlaceID().isNull()) { + const QString PLACE_ID_KEY_IN_LOCATION = "place_id"; + locationObject.insert(PLACE_ID_KEY_IN_LOCATION, addressManager->getRootPlaceID().toString()); + + } else { + const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id"; + locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, domainHandler.getUUID().toString()); + } rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject); diff --git a/libraries/networking/src/AddressManager.h b/libraries/networking/src/AddressManager.h index e98526689b..a8adf57741 100644 --- a/libraries/networking/src/AddressManager.h +++ b/libraries/networking/src/AddressManager.h @@ -42,6 +42,7 @@ public: const QUrl currentAddress() const; const QString currentPath(bool withOrientation = true) const; + const QUuid& getRootPlaceID() const { return _rootPlaceID; } const QString& getRootPlaceName() const { return _rootPlaceName; } void attemptPlaceNameLookup(const QString& lookupString);