From ab08dc6bd6abee1ba54c2bcc0ee3b15af42e3d16 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 4 Oct 2017 12:33:58 -0700 Subject: [PATCH] Progress? --- .../resources/qml/hifi/commerce/checkout/Checkout.qml | 1 + .../qml/hifi/commerce/purchases/PurchasedItem.qml | 1 + interface/src/commerce/Ledger.cpp | 4 ++-- interface/src/commerce/QmlCommerce.cpp | 6 ++++++ interface/src/commerce/QmlCommerce.h | 2 ++ libraries/entities/src/EntityTree.cpp | 11 +++++++---- libraries/entities/src/EntityTree.h | 1 - 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml index 32f324aea9..80c9a3ec0f 100644 --- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml @@ -579,6 +579,7 @@ Rectangle { } rezzedNotifContainer.visible = true; rezzedNotifContainerTimer.start(); + commerce.updatePopLocation(root.itemId); } } RalewaySemiBold { diff --git a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml index a026a818c0..361a89d047 100644 --- a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml +++ b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml @@ -343,6 +343,7 @@ Item { if (urlHandler.canHandleUrl(root.itemHref)) { urlHandler.handleUrl(root.itemHref); } + commerce.updatePopLocation(root.itemId); rezzedNotifContainer.visible = true; rezzedNotifContainerTimer.start(); } diff --git a/interface/src/commerce/Ledger.cpp b/interface/src/commerce/Ledger.cpp index a68a6fe929..e926d8918e 100644 --- a/interface/src/commerce/Ledger.cpp +++ b/interface/src/commerce/Ledger.cpp @@ -221,8 +221,8 @@ void Ledger::account() { } // The api/failResponse is called just for the side effect of logging. -void Ledger::updateLocationSuccess(QNetworkReply& reply) { apiResponse("reset", reply); } -void Ledger::updateLocationFailure(QNetworkReply& reply) { failResponse("reset", reply); } +void Ledger::updateLocationSuccess(QNetworkReply& reply) { apiResponse("updateLocation", reply); } +void Ledger::updateLocationFailure(QNetworkReply& reply) { failResponse("updateLocation", reply); } void Ledger::updateLocation(const QString& asset_id, const QString location, const bool controlledFailure) { auto wallet = DependencyManager::get(); QStringList keys = wallet->listPublicKeys(); diff --git a/interface/src/commerce/QmlCommerce.cpp b/interface/src/commerce/QmlCommerce.cpp index dbd84594bc..8c22542d94 100644 --- a/interface/src/commerce/QmlCommerce.cpp +++ b/interface/src/commerce/QmlCommerce.cpp @@ -149,3 +149,9 @@ void QmlCommerce::account() { auto ledger = DependencyManager::get(); ledger->account(); } + +void QmlCommerce::updatePopLocation(const QString& popId, const bool controlledFailure) { + auto ledger = DependencyManager::get(); + auto nodeList = DependencyManager::get(); + ledger->updateLocation(popId, nodeList->getDomainHandler().getUUID().toString(), controlledFailure); +} diff --git a/interface/src/commerce/QmlCommerce.h b/interface/src/commerce/QmlCommerce.h index 8e6af6da65..b1d179aae8 100644 --- a/interface/src/commerce/QmlCommerce.h +++ b/interface/src/commerce/QmlCommerce.h @@ -70,6 +70,8 @@ protected: Q_INVOKABLE void generateKeyPair(); Q_INVOKABLE void reset(); Q_INVOKABLE void account(); + + Q_INVOKABLE void updatePopLocation(const QString& popId, const bool controlledFailure = false); }; #endif // hifi_QmlCommerce_h diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index e067637db8..112066a2f8 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -1107,9 +1107,6 @@ void EntityTree::popStatusSuccess(QNetworkReply& reply) { // qCDebug(entities) << "'transfer_status' is 'failed', deleting entity" << entityItemID; // deleteEntity(entityItemID, true); //} else { - // //auto challengeOwnershipPacket = NLPacket::create(PacketType::ChallengeOwnership, NUM_BYTES_RFC4122_UUID + sizeof(encryptedText)); - // //challengeOwnershipPacket->write(senderNode->getUUID()); - // //challengeOwnershipPacket->writePrimitive(KillAvatarReason::TheirAvatarEnteredYourBubble); //} } @@ -1358,9 +1355,15 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c qCDebug(entities) << "Sending" << endpoint << QJsonDocument(request).toJson(QJsonDocument::Compact); accountManager->sendRequest(URL + endpoint, AccountManagerAuth::None, - QNetworkAccessManager::PostOperation, + QNetworkAccessManager::GetOperation, callbackParams, QJsonDocument(request).toJson()); + + // Second, challenge ownership of the PoP cert + //auto challengeOwnershipPacket = NLPacket::create(PacketType::ChallengeOwnership, NUM_BYTES_RFC4122_UUID + sizeof(encryptedText)); + //challengeOwnershipPacket->write(senderNode->getUUID()); + //challengeOwnershipPacket->writePrimitive(KillAvatarReason::TheirAvatarEnteredYourBubble); + //// Kickoff a 10-second timeout timer that deletes the entity if we don't get an ownership response in time } } diff --git a/libraries/entities/src/EntityTree.h b/libraries/entities/src/EntityTree.h index 8c26cd0791..3ea48c113a 100644 --- a/libraries/entities/src/EntityTree.h +++ b/libraries/entities/src/EntityTree.h @@ -18,7 +18,6 @@ #include "AccountManager.h" #include #include -#include #include #include