From 17af76fae18e305d0a42192a326648f00c84d1f3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 18 Apr 2013 13:56:16 -0400 Subject: SH-4128 WIP - use the AISv3 inventory cap when available for cof link deletion, hook in to callback mechanism so all link operations should be done before outfit is worn. --- indra/newview/llviewerinventory.cpp | 101 ++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) mode change 100644 => 100755 indra/newview/llviewerinventory.cpp (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp old mode 100644 new mode 100755 index fff9821e86..316fca7769 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1179,6 +1179,107 @@ void move_inventory_item( gAgent.sendReliableMessage(); } +void handle_item_deletion(const LLUUID& item_id) +{ + LLPointer obj = gInventory.getItem(item_id); + if(obj) + { + // From item removeFromServer() + LLInventoryModel::LLCategoryUpdate up(obj->getParentUUID(), -1); + gInventory.accountForUpdate(up); + + // From purgeObject() + LLPreview::hide(item_id); + gInventory.deleteObject(item_id); + } +} + +class RemoveItemResponder: public LLHTTPClient::Responder +{ +public: + RemoveItemResponder(const LLUUID& item_id, LLPointer callback): + mItemUUID(item_id), + mCallback(callback) + { + } + /* virtual */ void httpSuccess() + { + const LLSD& content = getContent(); + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); + return; + } + llinfos << "succeeded: " << ll_pretty_print_sd(content) << llendl; + + handle_item_deletion(mItemUUID); + + if (mCallback) + { + mCallback->fire(mItemUUID); + } + } + /*virtual*/ void httpFailure() + { + const LLSD& content = getContent(); + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); + return; + } + llwarns << "failed for " << mItemUUID << " content: " << ll_pretty_print_sd(content) << llendl; + } +private: + LLPointer mCallback; + const LLUUID mItemUUID; +}; + +void remove_inventory_item( + const LLUUID& item_id, + LLPointer cb) +{ + llinfos << "item_id: [" << item_id << "] " << llendl; + LLPointer obj = gInventory.getItem(item_id); + if(obj) + { + std::string cap; + if (gAgent.getRegion()) + { + cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); + } + if (!cap.empty()) + { + std::string url = cap + std::string("/item/") + item_id.asString(); + llinfos << "url: " << url << llendl; + LLCurl::ResponderPtr responder_ptr = new RemoveItemResponder(item_id,cb); + LLHTTPClient::del(url,responder_ptr); + } + else // no cap + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_RemoveInventoryItem); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_InventoryData); + msg->addUUIDFast(_PREHASH_ItemID, item_id); + gAgent.sendReliableMessage(); + + // Update inventory and call callback immediately since + // message-based system has no callback mechanism (!) + handle_item_deletion(item_id); + if (cb) + { + cb->fire(item_id); + } + } + } + else + { + llwarns << "remove_inventory_item called for nonexistent item " << item_id << llendl; + } +} + const LLUUID get_folder_by_itemtype(const LLInventoryItem *src) { LLUUID retval = LLUUID::null; -- cgit v1.2.3 From d73588eaddb1ada6ac896850c3aa9d25307e076a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 24 Apr 2013 18:38:40 -0400 Subject: SH-4128 WIP - misc cleanup --- indra/newview/llviewerinventory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 316fca7769..06efeb86d9 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1276,7 +1276,7 @@ void remove_inventory_item( } else { - llwarns << "remove_inventory_item called for nonexistent item " << item_id << llendl; + llwarns << "remove_inventory_item called for invalid or nonexistent item " << item_id << llendl; } } -- cgit v1.2.3 From d843a0d8bef5d36d3a4ef838b1b0335b4532147b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 25 Apr 2013 17:09:05 -0400 Subject: SH-4137 WIP - added callback-based support for purge descendents, remove category --- indra/newview/llviewerinventory.cpp | 286 ++++++++++++++++++++++++++++-------- 1 file changed, 224 insertions(+), 62 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 06efeb86d9..fbd6b292bd 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -65,6 +65,7 @@ #include "llavataractions.h" #include "lllogininstance.h" #include "llfavoritesbar.h" +#include "llclipboard.h" // Two do-nothing ops for use in callbacks. void no_op_inventory_func(const LLUUID&) {} @@ -345,24 +346,6 @@ void LLViewerInventoryItem::cloneViewerItem(LLPointer& ne } } -void LLViewerInventoryItem::removeFromServer() -{ - lldebugs << "Removing inventory item " << mUUID << " from server." - << llendl; - - LLInventoryModel::LLCategoryUpdate up(mParentUUID, -1); - gInventory.accountForUpdate(up); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_RemoveInventoryItem); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_InventoryData); - msg->addUUIDFast(_PREHASH_ItemID, mUUID); - gAgent.sendReliableMessage(); -} - void LLViewerInventoryItem::updateServer(BOOL is_new) const { if(!mIsComplete) @@ -637,30 +620,6 @@ void LLViewerInventoryCategory::updateServer(BOOL is_new) const gAgent.sendReliableMessage(); } -void LLViewerInventoryCategory::removeFromServer( void ) -{ - llinfos << "Removing inventory category " << mUUID << " from server." - << llendl; - // communicate that change with the server. - if(LLFolderType::lookupIsProtectedType(mPreferredType)) - { - LLNotificationsUtil::add("CannotRemoveProtectedCategories"); - return; - } - - LLInventoryModel::LLCategoryUpdate up(mParentUUID, -1); - gInventory.accountForUpdate(up); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_RemoveInventoryFolder); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_FolderData); - msg->addUUIDFast(_PREHASH_FolderID, mUUID); - gAgent.sendReliableMessage(); -} - S32 LLViewerInventoryCategory::getVersion() const { return mVersion; @@ -1179,25 +1138,10 @@ void move_inventory_item( gAgent.sendReliableMessage(); } -void handle_item_deletion(const LLUUID& item_id) -{ - LLPointer obj = gInventory.getItem(item_id); - if(obj) - { - // From item removeFromServer() - LLInventoryModel::LLCategoryUpdate up(obj->getParentUUID(), -1); - gInventory.accountForUpdate(up); - - // From purgeObject() - LLPreview::hide(item_id); - gInventory.deleteObject(item_id); - } -} - -class RemoveItemResponder: public LLHTTPClient::Responder +class RemoveObjectResponder: public LLHTTPClient::Responder { public: - RemoveItemResponder(const LLUUID& item_id, LLPointer callback): + RemoveObjectResponder(const LLUUID& item_id, LLPointer callback): mItemUUID(item_id), mCallback(callback) { @@ -1212,7 +1156,7 @@ public: } llinfos << "succeeded: " << ll_pretty_print_sd(content) << llendl; - handle_item_deletion(mItemUUID); + gInventory.onObjectDeletedFromServer(mItemUUID); if (mCallback) { @@ -1251,7 +1195,7 @@ void remove_inventory_item( { std::string url = cap + std::string("/item/") + item_id.asString(); llinfos << "url: " << url << llendl; - LLCurl::ResponderPtr responder_ptr = new RemoveItemResponder(item_id,cb); + LLCurl::ResponderPtr responder_ptr = new RemoveObjectResponder(item_id,cb); LLHTTPClient::del(url,responder_ptr); } else // no cap @@ -1267,7 +1211,7 @@ void remove_inventory_item( // Update inventory and call callback immediately since // message-based system has no callback mechanism (!) - handle_item_deletion(item_id); + gInventory.onObjectDeletedFromServer(item_id); if (cb) { cb->fire(item_id); @@ -1280,6 +1224,224 @@ void remove_inventory_item( } } +class LLRemoveObjectOnDestroy: public LLInventoryCallback +{ +public: + LLRemoveObjectOnDestroy(const LLUUID& item_id, LLPointer cb): + mID(item_id), + mCB(cb) + { + } + /* virtual */ void fire(const LLUUID& item_id) {} + ~LLRemoveObjectOnDestroy() + { + remove_inventory_object(mID, mCB); + } +private: + LLUUID mID; + LLPointer mCB; +}; + +void remove_inventory_category( + const LLUUID& cat_id, + LLPointer cb) +{ + llinfos << "cat_id: [" << cat_id << "] " << llendl; + LLPointer obj = gInventory.getCategory(cat_id); + if(obj) + { + if(LLFolderType::lookupIsProtectedType(obj->getPreferredType())) + { + LLNotificationsUtil::add("CannotRemoveProtectedCategories"); + return; + } + LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(cat_id); + if(children != LLInventoryModel::CHILDREN_NO) + { + llinfos << "Will purge descendents first before deleting category " << cat_id << llendl; + LLPointer wrap_cb = new LLRemoveObjectOnDestroy(cat_id,cb); + purge_descendents_of(cat_id, wrap_cb); + return; + } + + std::string cap; + if (gAgent.getRegion()) + { + cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); + } + if (!cap.empty()) + { + std::string url = cap + std::string("/category/") + cat_id.asString(); + llinfos << "url: " << url << llendl; + LLCurl::ResponderPtr responder_ptr = new RemoveObjectResponder(cat_id,cb); + LLHTTPClient::del(url,responder_ptr); + } + else // no cap + { + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_RemoveInventoryFolder); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_FolderData); + msg->addUUIDFast(_PREHASH_FolderID, cat_id); + gAgent.sendReliableMessage(); + + // Update inventory and call callback immediately since + // message-based system has no callback mechanism (!) + gInventory.onObjectDeletedFromServer(cat_id); + if (cb) + { + cb->fire(cat_id); + } + } + } + else + { + llwarns << "remove_inventory_category called for invalid or nonexistent item " << cat_id << llendl; + } +} + +void remove_inventory_object( + const LLUUID& object_id, + LLPointer cb) +{ + if (gInventory.getCategory(object_id)) + { + remove_inventory_category(object_id, cb); + } + else + { + remove_inventory_item(object_id, cb); + } +} + +class PurgeDescendentsResponder: public LLHTTPClient::Responder +{ +public: + PurgeDescendentsResponder(const LLUUID& item_id, LLPointer callback): + mItemUUID(item_id), + mCallback(callback) + { + } + /* virtual */ void httpSuccess() + { + const LLSD& content = getContent(); + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); + return; + } + llinfos << "succeeded: " << ll_pretty_print_sd(content) << llendl; + + gInventory.onDescendentsPurgedFromServer(mItemUUID); + + if (mCallback) + { + mCallback->fire(mItemUUID); + } + } + /*virtual*/ void httpFailure() + { + const LLSD& content = getContent(); + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); + return; + } + llwarns << "failed for " << mItemUUID << " content: " << ll_pretty_print_sd(content) << llendl; + } +private: + LLPointer mCallback; + const LLUUID mItemUUID; +}; + +// This is a method which collects the descendents of the id +// provided. If the category is not found, no action is +// taken. This method goes through the long winded process of +// cancelling any calling cards, removing server representation of +// folders, items, etc in a fairly efficient manner. +void purge_descendents_of(const LLUUID& id, LLPointer cb) +{ + LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(id); + if(children == LLInventoryModel::CHILDREN_NO) + { + llinfos << "No descendents to purge for " << id << llendl; + return; + } + LLPointer cat = gInventory.getCategory(id); + if (cat.notNull()) + { + if (LLClipboard::instance().hasContents() && LLClipboard::instance().isCutMode()) + { + // Something on the clipboard is in "cut mode" and needs to be preserved + llinfos << "purge_descendents_of clipboard case " << cat->getName() + << " iterate and purge non hidden items" << llendl; + LLInventoryModel::cat_array_t* categories; + LLInventoryModel::item_array_t* items; + // Get the list of direct descendants in tha categoy passed as argument + gInventory.getDirectDescendentsOf(id, categories, items); + std::vector list_uuids; + // Make a unique list with all the UUIDs of the direct descendants (items and categories are not treated differently) + // Note: we need to do that shallow copy as purging things will invalidate the categories or items lists + for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); it != categories->end(); ++it) + { + list_uuids.push_back((*it)->getUUID()); + } + for (LLInventoryModel::item_array_t::const_iterator it = items->begin(); it != items->end(); ++it) + { + list_uuids.push_back((*it)->getUUID()); + } + // Iterate through the list and only purge the UUIDs that are not on the clipboard + for (std::vector::const_iterator it = list_uuids.begin(); it != list_uuids.end(); ++it) + { + if (!LLClipboard::instance().isOnClipboard(*it)) + { + remove_inventory_object(*it, NULL); + } + } + } + else + { + std::string cap; + if (gAgent.getRegion()) + { + cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); + } + if (!cap.empty()) + { + std::string url = cap + std::string("/category/") + id.asString() + "/children"; + llinfos << "url: " << url << llendl; + LLCurl::ResponderPtr responder_ptr = new PurgeDescendentsResponder(id,cb); + LLHTTPClient::del(url,responder_ptr); + } + else // no cap + { + // Fast purge + llinfos << "purge_descendents_of fast case " << cat->getName() << llendl; + + // send it upstream + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("PurgeInventoryDescendents"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("InventoryData"); + msg->addUUID("FolderID", id); + gAgent.sendReliableMessage(); + + // Update model immediately because there is no callback mechanism. + gInventory.onDescendentsPurgedFromServer(id); + if (cb) + { + cb->fire(id); + } + } + } + } +} + const LLUUID get_folder_by_itemtype(const LLInventoryItem *src) { LLUUID retval = LLUUID::null; -- cgit v1.2.3 From 638514ca0cbc666a324e757c8de4cceaaaeeadd4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 26 Apr 2013 10:01:09 -0400 Subject: SH-4142 FIX - avoid stack overflow in an AISv3 responder failure case. --- indra/newview/llviewerinventory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index fbd6b292bd..c44552d7d2 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1168,7 +1168,7 @@ public: const LLSD& content = getContent(); if (!content.isMap()) { - failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); + llwarns << "Malformed response contents" << content << llendl; return; } llwarns << "failed for " << mItemUUID << " content: " << ll_pretty_print_sd(content) << llendl; @@ -1347,7 +1347,7 @@ public: const LLSD& content = getContent(); if (!content.isMap()) { - failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); + llwarns << "Malformed response contents" << content << llendl; return; } llwarns << "failed for " << mItemUUID << " content: " << ll_pretty_print_sd(content) << llendl; -- cgit v1.2.3 From fb51bab6cd2e3f037142ce7c5f547113d76f0504 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 26 Apr 2013 10:17:41 -0400 Subject: SH-4142 FIX - made error messages a bit more informative --- indra/newview/llviewerinventory.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index c44552d7d2..3eab85b8b3 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1166,12 +1166,14 @@ public: /*virtual*/ void httpFailure() { const LLSD& content = getContent(); + S32 status = getStatus(); + const std::string& reason = getReason(); if (!content.isMap()) { - llwarns << "Malformed response contents" << content << llendl; + llwarns << "Malformed response contents " << content << " id " << mItemUUID << " status " << status << " reason " << reason << llendl; return; } - llwarns << "failed for " << mItemUUID << " content: " << ll_pretty_print_sd(content) << llendl; + llwarns << "failed for " << mItemUUID << " content: " << ll_pretty_print_sd(content) << " status " << status << " reason " << reason << llendl; } private: LLPointer mCallback; @@ -1345,12 +1347,14 @@ public: /*virtual*/ void httpFailure() { const LLSD& content = getContent(); + S32 status = getStatus(); + const std::string& reason = getReason(); if (!content.isMap()) { - llwarns << "Malformed response contents" << content << llendl; + llwarns << "Malformed response contents " << content << " id " << mItemUUID << " status " << status << " reason " << reason << llendl; return; } - llwarns << "failed for " << mItemUUID << " content: " << ll_pretty_print_sd(content) << llendl; + llwarns << "failed for " << mItemUUID << " content: " << ll_pretty_print_sd(content) << " status " << status << " reason " << reason << llendl; } private: LLPointer mCallback; -- cgit v1.2.3 From e4c96827d237a489873ce8453640d3a13f83d01a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 29 Apr 2013 14:24:05 -0400 Subject: SH-4144 FIX - Debug setting now disables use of AISv3 by default. This is just a workaround for the problem of aditi advertising the cap when it isn't really present. Once we have aditi in a consistent state we should remove the setting, or at least default it to true. --- indra/newview/llviewerinventory.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 3eab85b8b3..d45512df9c 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -627,6 +627,10 @@ S32 LLViewerInventoryCategory::getVersion() const void LLViewerInventoryCategory::setVersion(S32 version) { + if (mPreferredType == LLFolderType::FT_CURRENT_OUTFIT) + { + llinfos << "cof version change " << mVersion << " => " << version << llendl; + } mVersion = version; } @@ -1189,7 +1193,7 @@ void remove_inventory_item( if(obj) { std::string cap; - if (gAgent.getRegion()) + if (gAgent.getRegion() && gSavedSettings.getBOOL("UseAISv3Inventory")) { cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); } @@ -1267,7 +1271,7 @@ void remove_inventory_category( } std::string cap; - if (gAgent.getRegion()) + if (gAgent.getRegion() && gSavedSettings.getBOOL("UseAISv3Inventory")) { cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); } @@ -1409,7 +1413,7 @@ void purge_descendents_of(const LLUUID& id, LLPointer cb) else { std::string cap; - if (gAgent.getRegion()) + if (gAgent.getRegion() && gSavedSettings.getBOOL("UseAISv3Inventory")) { cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); } -- cgit v1.2.3 From 9caeb5ad5045352c4bb77195c5c0bc71575bc3fd Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 29 Apr 2013 14:31:15 -0400 Subject: removed debugging code that got pushed incorrectly. --- indra/newview/llviewerinventory.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index d45512df9c..b39dbd51a1 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -627,10 +627,12 @@ S32 LLViewerInventoryCategory::getVersion() const void LLViewerInventoryCategory::setVersion(S32 version) { +#if 0 if (mPreferredType == LLFolderType::FT_CURRENT_OUTFIT) { llinfos << "cof version change " << mVersion << " => " << version << llendl; } +#endif mVersion = version; } -- cgit v1.2.3 From ae53d22141288ab1b5ba4a5927d11cf84c59d445 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 29 Apr 2013 16:59:10 -0400 Subject: SH-4140 FIX, SH-3860 FIX - appearance on first-time login should now be reliable without depending on retries of appearance update requests. May still see COF mismatch errors in the log - these will only be fixed, if at all, with AISv3 integration. --- indra/newview/llviewerinventory.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index b39dbd51a1..d45512df9c 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -627,12 +627,10 @@ S32 LLViewerInventoryCategory::getVersion() const void LLViewerInventoryCategory::setVersion(S32 version) { -#if 0 if (mPreferredType == LLFolderType::FT_CURRENT_OUTFIT) { llinfos << "cof version change " << mVersion << " => " << version << llendl; } -#endif mVersion = version; } -- cgit v1.2.3 From b322c1dbaceaa9359243e030a125e312c54448f3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 30 Apr 2013 16:54:52 -0400 Subject: SH-4140 FIX - removed a gratuitous log message --- indra/newview/llviewerinventory.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index d45512df9c..f9afdee4f9 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -627,10 +627,6 @@ S32 LLViewerInventoryCategory::getVersion() const void LLViewerInventoryCategory::setVersion(S32 version) { - if (mPreferredType == LLFolderType::FT_CURRENT_OUTFIT) - { - llinfos << "cof version change " << mVersion << " => " << version << llendl; - } mVersion = version; } -- cgit v1.2.3 From b1998cabc487c434555276a389ed19847b98f998 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 13 May 2013 17:08:37 -0400 Subject: SH-4168 WIP, SH-4155 WIP - update inventory model based on ais returns, try to maintain loading... string more consistently in folder bridge --- indra/newview/llviewerinventory.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index f9afdee4f9..5ffd560942 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1154,8 +1154,8 @@ public: failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); return; } - llinfos << "succeeded: " << ll_pretty_print_sd(content) << llendl; - + gInventory.onAISUpdateReceived("removeObjectResponder " + mItemUUID.asString(), content); + // FIXME - not needed after AIS starts returning deleted item in its response. gInventory.onObjectDeletedFromServer(mItemUUID); if (mCallback) @@ -1335,9 +1335,7 @@ public: failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); return; } - llinfos << "succeeded: " << ll_pretty_print_sd(content) << llendl; - - gInventory.onDescendentsPurgedFromServer(mItemUUID); + gInventory.onAISUpdateReceived("purgeDescendentsResponder " + mItemUUID.asString(), content); if (mCallback) { -- cgit v1.2.3 From 931410211e1d644028f5b09cbf77b179e0e75aab Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 15 May 2013 09:45:10 -0400 Subject: SH-4144 FIX - removed UseAISv3Inventory debug settings - cap is now managed sim-side --- indra/newview/llviewerinventory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 5ffd560942..e819479923 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1189,7 +1189,7 @@ void remove_inventory_item( if(obj) { std::string cap; - if (gAgent.getRegion() && gSavedSettings.getBOOL("UseAISv3Inventory")) + if (gAgent.getRegion()) { cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); } @@ -1267,7 +1267,7 @@ void remove_inventory_category( } std::string cap; - if (gAgent.getRegion() && gSavedSettings.getBOOL("UseAISv3Inventory")) + if (gAgent.getRegion()) { cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); } @@ -1407,7 +1407,7 @@ void purge_descendents_of(const LLUUID& id, LLPointer cb) else { std::string cap; - if (gAgent.getRegion() && gSavedSettings.getBOOL("UseAISv3Inventory")) + if (gAgent.getRegion()) { cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); } -- cgit v1.2.3 From 2ed3746aee81901435f3f28f71a497d234d680d2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 15 May 2013 13:27:16 -0400 Subject: SH-4197 FIX - also simplified the category remove flow for AIS, don't need to purge descendents first. --- indra/newview/llviewerinventory.cpp | 39 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index e819479923..202ed43caa 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1155,8 +1155,6 @@ public: return; } gInventory.onAISUpdateReceived("removeObjectResponder " + mItemUUID.asString(), content); - // FIXME - not needed after AIS starts returning deleted item in its response. - gInventory.onObjectDeletedFromServer(mItemUUID); if (mCallback) { @@ -1226,18 +1224,26 @@ void remove_inventory_item( } } -class LLRemoveObjectOnDestroy: public LLInventoryCallback +class LLRemoveCategoryOnDestroy: public LLInventoryCallback { public: - LLRemoveObjectOnDestroy(const LLUUID& item_id, LLPointer cb): - mID(item_id), + LLRemoveCategoryOnDestroy(const LLUUID& cat_id, LLPointer cb): + mID(cat_id), mCB(cb) { } /* virtual */ void fire(const LLUUID& item_id) {} - ~LLRemoveObjectOnDestroy() + ~LLRemoveCategoryOnDestroy() { - remove_inventory_object(mID, mCB); + LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(mID); + if(children != LLInventoryModel::CHILDREN_NO) + { + llwarns << "remove descendents failed, cannot remove category " << llendl; + } + else + { + remove_inventory_category(mID, mCB); + } } private: LLUUID mID; @@ -1257,15 +1263,6 @@ void remove_inventory_category( LLNotificationsUtil::add("CannotRemoveProtectedCategories"); return; } - LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(cat_id); - if(children != LLInventoryModel::CHILDREN_NO) - { - llinfos << "Will purge descendents first before deleting category " << cat_id << llendl; - LLPointer wrap_cb = new LLRemoveObjectOnDestroy(cat_id,cb); - purge_descendents_of(cat_id, wrap_cb); - return; - } - std::string cap; if (gAgent.getRegion()) { @@ -1280,6 +1277,16 @@ void remove_inventory_category( } else // no cap { + // RemoveInventoryFolder does not remove children, so must + // clear descendents first. + LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(cat_id); + if(children != LLInventoryModel::CHILDREN_NO) + { + llinfos << "Will purge descendents first before deleting category " << cat_id << llendl; + LLPointer wrap_cb = new LLRemoveCategoryOnDestroy(cat_id, cb); + purge_descendents_of(cat_id, wrap_cb); + return; + } LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RemoveInventoryFolder); -- cgit v1.2.3 From 8a4add76b44bab32633c5432f8852e5351770c91 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 15 May 2013 18:08:12 -0400 Subject: SH-4175 WIP - Avoid add to outfit or remove from outfit when an outfit change is already in progress --- indra/newview/llviewerinventory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 202ed43caa..18ea812471 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1182,8 +1182,8 @@ void remove_inventory_item( const LLUUID& item_id, LLPointer cb) { - llinfos << "item_id: [" << item_id << "] " << llendl; LLPointer obj = gInventory.getItem(item_id); + llinfos << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; if(obj) { std::string cap; -- cgit v1.2.3 From d09db5949050ac23547e1cd06712ebbf9a980b2a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 17 May 2013 18:01:52 -0400 Subject: SH-4200 WIP - added AISCommand classes with retry capabilities. --- indra/newview/llviewerinventory.cpp | 205 +++++++++++++++++++++++------------- 1 file changed, 131 insertions(+), 74 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 18ea812471..31ff3bb5d6 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -66,6 +66,7 @@ #include "lllogininstance.h" #include "llfavoritesbar.h" #include "llclipboard.h" +#include "llhttpretrypolicy.h" // Two do-nothing ops for use in callbacks. void no_op_inventory_func(const LLUUID&) {} @@ -1138,44 +1139,156 @@ void move_inventory_item( gAgent.sendReliableMessage(); } -class RemoveObjectResponder: public LLHTTPClient::Responder +class AISCommand: public LLHTTPClient::Responder { public: - RemoveObjectResponder(const LLUUID& item_id, LLPointer callback): - mItemUUID(item_id), + typedef boost::function command_func_type; + + AISCommand(LLPointer callback): mCallback(callback) { + llinfos << "constructor" << llendl; + mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10); + } + + virtual ~AISCommand() + { + llinfos << "destructor" << llendl; + } + + void run_command() + { + mCommandFunc(); + } + + void setCommandFunc(command_func_type command_func) + { + mCommandFunc = command_func; + } + + // Need to do command-specific parsing to get an id here. May or + // may not need to bother, since most LLInventoryCallbacks do + // their work in the destructor. + virtual bool getResponseUUID(const LLSD& content, LLUUID& id) + { + return false; } + /* virtual */ void httpSuccess() { + // Command func holds a reference to self, need to release it + // after a success or final failure. + setCommandFunc(no_op); + const LLSD& content = getContent(); if (!content.isMap()) { failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); return; } - gInventory.onAISUpdateReceived("removeObjectResponder " + mItemUUID.asString(), content); + mRetryPolicy->onSuccess(); + + gInventory.onAISUpdateReceived("AISCommand", content); if (mCallback) { - mCallback->fire(mItemUUID); + LLUUID item_id; // will default to null if parse fails. + getResponseUUID(content,item_id); + mCallback->fire(item_id); } } + /*virtual*/ void httpFailure() { const LLSD& content = getContent(); S32 status = getStatus(); const std::string& reason = getReason(); + const LLSD& headers = getResponseHeaders(); if (!content.isMap()) { - llwarns << "Malformed response contents " << content << " id " << mItemUUID << " status " << status << " reason " << reason << llendl; - return; + llwarns << "Malformed response contents " << content + << " status " << status << " reason " << reason << llendl; + } + else + { + llwarns << "failed with content: " << ll_pretty_print_sd(content) + << " status " << status << " reason " << reason << llendl; + } + mRetryPolicy->onFailure(status, headers); + F32 seconds_to_wait; + if (mRetryPolicy->shouldRetry(seconds_to_wait)) + { + doAfterInterval(boost::bind(&AISCommand::run_command,this),seconds_to_wait); + } + else + { + // Command func holds a reference to self, need to release it + // after a success or final failure. + setCommandFunc(no_op); } - llwarns << "failed for " << mItemUUID << " content: " << ll_pretty_print_sd(content) << " status " << status << " reason " << reason << llendl; } + + static bool getCap(std::string& cap) + { + if (gAgent.getRegion()) + { + cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); + } + if (!cap.empty()) + { + return true; + } + return false; + } + private: + command_func_type mCommandFunc; + LLPointer mRetryPolicy; LLPointer mCallback; - const LLUUID mItemUUID; +}; + +class RemoveObjectCommand: public AISCommand +{ +public: + RemoveObjectCommand(const LLUUID& item_id, + LLPointer callback): + AISCommand(callback) + { + std::string cap; + if (!getCap(cap)) + { + return; + } + const std::string url = cap + std::string("/item/") + item_id.asString(); + llinfos << "url: " << url << llendl; + LLHTTPClient::ResponderPtr responder = this; + LLSD headers; + F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); + setCommandFunc(cmd); + } +}; + +class PurgeDescendentsCommand: public AISCommand +{ +public: + PurgeDescendentsCommand(const LLUUID& item_id, + LLPointer callback): + AISCommand(callback) + { + std::string cap; + if (!getCap(cap)) + { + return; + } + std::string url = cap + std::string("/category/") + item_id.asString() + "/children"; + llinfos << "url: " << url << llendl; + LLCurl::ResponderPtr responder = this; + LLSD headers; + F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); + setCommandFunc(cmd); + } }; void remove_inventory_item( @@ -1187,16 +1300,10 @@ void remove_inventory_item( if(obj) { std::string cap; - if (gAgent.getRegion()) - { - cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); - } - if (!cap.empty()) + if (AISCommand::getCap(cap)) { - std::string url = cap + std::string("/item/") + item_id.asString(); - llinfos << "url: " << url << llendl; - LLCurl::ResponderPtr responder_ptr = new RemoveObjectResponder(item_id,cb); - LLHTTPClient::del(url,responder_ptr); + LLPointer cmd_ptr = new RemoveObjectCommand(item_id, cb); + cmd_ptr->run_command(); } else // no cap { @@ -1264,16 +1371,12 @@ void remove_inventory_category( return; } std::string cap; - if (gAgent.getRegion()) - { - cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); - } - if (!cap.empty()) + if (AISCommand::getCap(cap)) { std::string url = cap + std::string("/category/") + cat_id.asString(); llinfos << "url: " << url << llendl; - LLCurl::ResponderPtr responder_ptr = new RemoveObjectResponder(cat_id,cb); - LLHTTPClient::del(url,responder_ptr); + LLPointer cmd_ptr = new RemoveObjectCommand(cat_id, cb); + cmd_ptr->run_command(); } else // no cap { @@ -1326,46 +1429,6 @@ void remove_inventory_object( } } -class PurgeDescendentsResponder: public LLHTTPClient::Responder -{ -public: - PurgeDescendentsResponder(const LLUUID& item_id, LLPointer callback): - mItemUUID(item_id), - mCallback(callback) - { - } - /* virtual */ void httpSuccess() - { - const LLSD& content = getContent(); - if (!content.isMap()) - { - failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); - return; - } - gInventory.onAISUpdateReceived("purgeDescendentsResponder " + mItemUUID.asString(), content); - - if (mCallback) - { - mCallback->fire(mItemUUID); - } - } - /*virtual*/ void httpFailure() - { - const LLSD& content = getContent(); - S32 status = getStatus(); - const std::string& reason = getReason(); - if (!content.isMap()) - { - llwarns << "Malformed response contents " << content << " id " << mItemUUID << " status " << status << " reason " << reason << llendl; - return; - } - llwarns << "failed for " << mItemUUID << " content: " << ll_pretty_print_sd(content) << " status " << status << " reason " << reason << llendl; - } -private: - LLPointer mCallback; - const LLUUID mItemUUID; -}; - // This is a method which collects the descendents of the id // provided. If the category is not found, no action is // taken. This method goes through the long winded process of @@ -1414,16 +1477,10 @@ void purge_descendents_of(const LLUUID& id, LLPointer cb) else { std::string cap; - if (gAgent.getRegion()) - { - cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); - } - if (!cap.empty()) + if (AISCommand::getCap(cap)) { - std::string url = cap + std::string("/category/") + id.asString() + "/children"; - llinfos << "url: " << url << llendl; - LLCurl::ResponderPtr responder_ptr = new PurgeDescendentsResponder(id,cb); - LLHTTPClient::del(url,responder_ptr); + LLPointer cmd_ptr = new PurgeDescendentsCommand(id, cb); + cmd_ptr->run_command(); } else // no cap { -- cgit v1.2.3 From 0f6a4a3389cdce6d5bb92cd6f4861a46def284cc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 20 May 2013 18:06:26 -0400 Subject: SH-4200 FIX - retry ais ops on 5xx errors, dialed back some verbose logging. --- indra/newview/llviewerinventory.cpp | 67 ++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 23 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 31ff3bb5d6..50d67463c7 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1147,13 +1147,11 @@ public: AISCommand(LLPointer callback): mCallback(callback) { - llinfos << "constructor" << llendl; mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10); } virtual ~AISCommand() { - llinfos << "destructor" << llendl; } void run_command() @@ -1206,13 +1204,13 @@ public: const LLSD& headers = getResponseHeaders(); if (!content.isMap()) { - llwarns << "Malformed response contents " << content - << " status " << status << " reason " << reason << llendl; + LL_DEBUGS("Inventory") << "Malformed response contents " << content + << " status " << status << " reason " << reason << llendl; } else { - llwarns << "failed with content: " << ll_pretty_print_sd(content) - << " status " << status << " reason " << reason << llendl; + LL_DEBUGS("Inventory") << "failed with content: " << ll_pretty_print_sd(content) + << " status " << status << " reason " << reason << llendl; } mRetryPolicy->onFailure(status, headers); F32 seconds_to_wait; @@ -1247,20 +1245,44 @@ private: LLPointer mCallback; }; -class RemoveObjectCommand: public AISCommand +class RemoveItemCommand: public AISCommand { public: - RemoveObjectCommand(const LLUUID& item_id, - LLPointer callback): + RemoveItemCommand(const LLUUID& item_id, + LLPointer callback): AISCommand(callback) { std::string cap; if (!getCap(cap)) { + llwarns << "No cap found" << llendl; return; } - const std::string url = cap + std::string("/item/") + item_id.asString(); - llinfos << "url: " << url << llendl; + std::string url = cap + std::string("/item/") + item_id.asString(); + LL_DEBUGS("Inventory") << "url: " << url << llendl; + LLHTTPClient::ResponderPtr responder = this; + LLSD headers; + F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); + setCommandFunc(cmd); + } +}; + +class RemoveCategoryCommand: public AISCommand +{ +public: + RemoveCategoryCommand(const LLUUID& item_id, + LLPointer callback): + AISCommand(callback) + { + std::string cap; + if (!getCap(cap)) + { + llwarns << "No cap found" << llendl; + return; + } + std::string url = cap + std::string("/category/") + item_id.asString(); + LL_DEBUGS("Inventory") << "url: " << url << llendl; LLHTTPClient::ResponderPtr responder = this; LLSD headers; F32 timeout = HTTP_REQUEST_EXPIRY_SECS; @@ -1279,10 +1301,11 @@ public: std::string cap; if (!getCap(cap)) { + llwarns << "No cap found" << llendl; return; } std::string url = cap + std::string("/category/") + item_id.asString() + "/children"; - llinfos << "url: " << url << llendl; + LL_DEBUGS("Inventory") << "url: " << url << llendl; LLCurl::ResponderPtr responder = this; LLSD headers; F32 timeout = HTTP_REQUEST_EXPIRY_SECS; @@ -1296,13 +1319,13 @@ void remove_inventory_item( LLPointer cb) { LLPointer obj = gInventory.getItem(item_id); - llinfos << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; + LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; if(obj) { std::string cap; if (AISCommand::getCap(cap)) { - LLPointer cmd_ptr = new RemoveObjectCommand(item_id, cb); + LLPointer cmd_ptr = new RemoveItemCommand(item_id, cb); cmd_ptr->run_command(); } else // no cap @@ -1361,7 +1384,7 @@ void remove_inventory_category( const LLUUID& cat_id, LLPointer cb) { - llinfos << "cat_id: [" << cat_id << "] " << llendl; + LL_DEBUGS("Inventory") << "cat_id: [" << cat_id << "] " << llendl; LLPointer obj = gInventory.getCategory(cat_id); if(obj) { @@ -1373,9 +1396,7 @@ void remove_inventory_category( std::string cap; if (AISCommand::getCap(cap)) { - std::string url = cap + std::string("/category/") + cat_id.asString(); - llinfos << "url: " << url << llendl; - LLPointer cmd_ptr = new RemoveObjectCommand(cat_id, cb); + LLPointer cmd_ptr = new RemoveCategoryCommand(cat_id, cb); cmd_ptr->run_command(); } else // no cap @@ -1385,7 +1406,7 @@ void remove_inventory_category( LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(cat_id); if(children != LLInventoryModel::CHILDREN_NO) { - llinfos << "Will purge descendents first before deleting category " << cat_id << llendl; + LL_DEBUGS("Inventory") << "Will purge descendents first before deleting category " << cat_id << llendl; LLPointer wrap_cb = new LLRemoveCategoryOnDestroy(cat_id, cb); purge_descendents_of(cat_id, wrap_cb); return; @@ -1439,7 +1460,7 @@ void purge_descendents_of(const LLUUID& id, LLPointer cb) LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(id); if(children == LLInventoryModel::CHILDREN_NO) { - llinfos << "No descendents to purge for " << id << llendl; + LL_DEBUGS("Inventory") << "No descendents to purge for " << id << llendl; return; } LLPointer cat = gInventory.getCategory(id); @@ -1448,8 +1469,8 @@ void purge_descendents_of(const LLUUID& id, LLPointer cb) if (LLClipboard::instance().hasContents() && LLClipboard::instance().isCutMode()) { // Something on the clipboard is in "cut mode" and needs to be preserved - llinfos << "purge_descendents_of clipboard case " << cat->getName() - << " iterate and purge non hidden items" << llendl; + LL_DEBUGS("Inventory") << "purge_descendents_of clipboard case " << cat->getName() + << " iterate and purge non hidden items" << llendl; LLInventoryModel::cat_array_t* categories; LLInventoryModel::item_array_t* items; // Get the list of direct descendants in tha categoy passed as argument @@ -1485,7 +1506,7 @@ void purge_descendents_of(const LLUUID& id, LLPointer cb) else // no cap { // Fast purge - llinfos << "purge_descendents_of fast case " << cat->getName() << llendl; + LL_DEBUGS("Inventory") << "purge_descendents_of fast case " << cat->getName() << llendl; // send it upstream LLMessageSystem* msg = gMessageSystem; -- cgit v1.2.3 From 6c56c77ec575141963c5de8dfa228253fe175bc3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 24 May 2013 08:53:21 -0400 Subject: SH-4027 WIP - initial implementation of item update via AIS. --- indra/newview/llviewerinventory.cpp | 510 +++++++++++++++++++++++++----------- 1 file changed, 354 insertions(+), 156 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 50d67463c7..90fef3b5ed 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -259,6 +259,240 @@ public: LLInventoryHandler gInventoryHandler; +///---------------------------------------------------------------------------- +/// Classes for AISv3 support. +///---------------------------------------------------------------------------- +class AISCommand: public LLHTTPClient::Responder +{ +public: + typedef boost::function command_func_type; + + AISCommand(LLPointer callback): + mCallback(callback) + { + mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10); + } + + virtual ~AISCommand() + { + } + + void run_command() + { + mCommandFunc(); + } + + void setCommandFunc(command_func_type command_func) + { + mCommandFunc = command_func; + } + + // Need to do command-specific parsing to get an id here. May or + // may not need to bother, since most LLInventoryCallbacks do + // their work in the destructor. + virtual bool getResponseUUID(const LLSD& content, LLUUID& id) + { + return false; + } + + /* virtual */ void httpSuccess() + { + // Command func holds a reference to self, need to release it + // after a success or final failure. + setCommandFunc(no_op); + + const LLSD& content = getContent(); + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); + return; + } + mRetryPolicy->onSuccess(); + + gInventory.onAISUpdateReceived("AISCommand", content); + + if (mCallback) + { + LLUUID item_id; // will default to null if parse fails. + getResponseUUID(content,item_id); + mCallback->fire(item_id); + } + } + + /*virtual*/ void httpFailure() + { + const LLSD& content = getContent(); + S32 status = getStatus(); + const std::string& reason = getReason(); + const LLSD& headers = getResponseHeaders(); + if (!content.isMap()) + { + LL_DEBUGS("Inventory") << "Malformed response contents " << content + << " status " << status << " reason " << reason << llendl; + } + else + { + LL_DEBUGS("Inventory") << "failed with content: " << ll_pretty_print_sd(content) + << " status " << status << " reason " << reason << llendl; + } + mRetryPolicy->onFailure(status, headers); + F32 seconds_to_wait; + if (mRetryPolicy->shouldRetry(seconds_to_wait)) + { + doAfterInterval(boost::bind(&AISCommand::run_command,this),seconds_to_wait); + } + else + { + // Command func holds a reference to self, need to release it + // after a success or final failure. + setCommandFunc(no_op); + } + } + + static bool getCap(std::string& cap) + { + if (gAgent.getRegion()) + { + cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); + } + if (!cap.empty()) + { + return true; + } + return false; + } + +private: + command_func_type mCommandFunc; + LLPointer mRetryPolicy; + LLPointer mCallback; +}; + +class RemoveItemCommand: public AISCommand +{ +public: + RemoveItemCommand(const LLUUID& item_id, + LLPointer callback): + AISCommand(callback) + { + std::string cap; + if (!getCap(cap)) + { + llwarns << "No cap found" << llendl; + return; + } + std::string url = cap + std::string("/item/") + item_id.asString(); + LL_DEBUGS("Inventory") << "url: " << url << llendl; + LLHTTPClient::ResponderPtr responder = this; + LLSD headers; + F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); + setCommandFunc(cmd); + } +}; + +class RemoveCategoryCommand: public AISCommand +{ +public: + RemoveCategoryCommand(const LLUUID& item_id, + LLPointer callback): + AISCommand(callback) + { + std::string cap; + if (!getCap(cap)) + { + llwarns << "No cap found" << llendl; + return; + } + std::string url = cap + std::string("/category/") + item_id.asString(); + LL_DEBUGS("Inventory") << "url: " << url << llendl; + LLHTTPClient::ResponderPtr responder = this; + LLSD headers; + F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); + setCommandFunc(cmd); + } +}; + +class PurgeDescendentsCommand: public AISCommand +{ +public: + PurgeDescendentsCommand(const LLUUID& item_id, + LLPointer callback): + AISCommand(callback) + { + std::string cap; + if (!getCap(cap)) + { + llwarns << "No cap found" << llendl; + return; + } + std::string url = cap + std::string("/category/") + item_id.asString() + "/children"; + LL_DEBUGS("Inventory") << "url: " << url << llendl; + LLCurl::ResponderPtr responder = this; + LLSD headers; + F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); + setCommandFunc(cmd); + } +}; + +class UpdateItemCommand: public AISCommand +{ +public: + UpdateItemCommand(const LLUUID& item_id, + const LLSD& updates, + LLPointer callback): + mUpdates(updates), + AISCommand(callback) + { + std::string cap; + if (!getCap(cap)) + { + llwarns << "No cap found" << llendl; + return; + } + std::string url = cap + std::string("/item/") + item_id.asString(); + LL_DEBUGS("Inventory") << "url: " << url << llendl; + LLCurl::ResponderPtr responder = this; + LLSD headers; + headers["Content-Type"] = "application/llsd+xml"; + F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + command_func_type cmd = boost::bind(&LLHTTPClient::patch, url, mUpdates, responder, headers, timeout); + setCommandFunc(cmd); + } +private: + LLSD mUpdates; +}; + +class UpdateCategoryCommand: public AISCommand +{ +public: + UpdateCategoryCommand(const LLUUID& item_id, + const LLSD& updates, + LLPointer callback): + mUpdates(updates), + AISCommand(callback) + { + std::string cap; + if (!getCap(cap)) + { + llwarns << "No cap found" << llendl; + return; + } + std::string url = cap + std::string("/category/") + item_id.asString(); + LL_DEBUGS("Inventory") << "url: " << url << llendl; + LLCurl::ResponderPtr responder = this; + LLSD headers; + headers["Content-Type"] = "application/llsd+xml"; + F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + command_func_type cmd = boost::bind(&LLHTTPClient::patch, url, mUpdates, responder, headers, timeout); + setCommandFunc(cmd); + } +private: + LLSD mUpdates; +}; + ///---------------------------------------------------------------------------- /// Class LLViewerInventoryItem ///---------------------------------------------------------------------------- @@ -456,6 +690,20 @@ void LLViewerInventoryItem::setTransactionID(const LLTransactionID& transaction_ // virtual void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const { + static const LLSD updates; + packUpdateMessage(msg,updates); +} + +void LLViewerInventoryItem::packUpdateMessage(LLMessageSystem* msg, const LLSD& updates) const +{ + for (LLSD::map_const_iterator it = updates.beginMap(); it != updates.endMap(); ++it) + { + if ((it->first != "desc") && (it->first != "name")) + { + llerrs << "unhandled field: " << it->first << llendl; + } + } + msg->addUUIDFast(_PREHASH_ItemID, mUUID); msg->addUUIDFast(_PREHASH_FolderID, mParentUUID); mPermissions.packMessage(msg); @@ -466,12 +714,29 @@ void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const msg->addS8Fast(_PREHASH_InvType, type); msg->addU32Fast(_PREHASH_Flags, mFlags); mSaleInfo.packMessage(msg); - msg->addStringFast(_PREHASH_Name, mName); - msg->addStringFast(_PREHASH_Description, mDescription); + if (updates.has("name")) + { + std::string new_name = updates["name"].asString(); + LLInventoryObject::correctInventoryName(new_name); + msg->addStringFast(_PREHASH_Name, new_name); + } + else + { + msg->addStringFast(_PREHASH_Name, mName); + } + if (updates.has("desc")) + { + msg->addStringFast(_PREHASH_Description, updates["desc"].asString()); + } + else + { + msg->addStringFast(_PREHASH_Description, mDescription); + } msg->addS32Fast(_PREHASH_CreationDate, mCreationDate); U32 crc = getCRC32(); msg->addU32Fast(_PREHASH_CRC, crc); } + // virtual BOOL LLViewerInventoryItem::importFile(LLFILE* fp) { @@ -583,6 +848,32 @@ void LLViewerInventoryCategory::copyViewerCategory(const LLViewerInventoryCatego } +void LLViewerInventoryCategory::packUpdateMessage(LLMessageSystem* msg, const LLSD& updates) const +{ + for (LLSD::map_const_iterator it = updates.beginMap(); it != updates.endMap(); ++it) + { + if (it->first != "name") + { + llerrs << "unhandled field: " << it->first << llendl; + } + } + + msg->addUUIDFast(_PREHASH_FolderID, mUUID); + msg->addUUIDFast(_PREHASH_ParentID, mParentUUID); + S8 type = static_cast(mPreferredType); + msg->addS8Fast(_PREHASH_Type, type); + if (updates.has("name")) + { + std::string new_name = updates["name"].asString(); + LLInventoryObject::correctInventoryName(new_name); + msg->addStringFast(_PREHASH_Name, new_name); + } + else + { + msg->addStringFast(_PREHASH_Name, mName); + } +} + void LLViewerInventoryCategory::updateParentOnServer(BOOL restamp) const { LLMessageSystem* msg = gMessageSystem; @@ -1139,180 +1430,87 @@ void move_inventory_item( gAgent.sendReliableMessage(); } -class AISCommand: public LLHTTPClient::Responder +// Note this only supports updating an existing item. Goes through AISv3 +// code path where available. Not all uses of item->updateServer() can +// easily be switched to this paradigm. +void update_inventory_item( + const LLUUID& item_id, + const LLSD& updates, + LLPointer cb) { -public: - typedef boost::function command_func_type; - - AISCommand(LLPointer callback): - mCallback(callback) - { - mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10); - } - - virtual ~AISCommand() - { - } - - void run_command() - { - mCommandFunc(); - } - - void setCommandFunc(command_func_type command_func) - { - mCommandFunc = command_func; - } - - // Need to do command-specific parsing to get an id here. May or - // may not need to bother, since most LLInventoryCallbacks do - // their work in the destructor. - virtual bool getResponseUUID(const LLSD& content, LLUUID& id) - { - return false; - } - - /* virtual */ void httpSuccess() - { - // Command func holds a reference to self, need to release it - // after a success or final failure. - setCommandFunc(no_op); - - const LLSD& content = getContent(); - if (!content.isMap()) - { - failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); - return; - } - mRetryPolicy->onSuccess(); - - gInventory.onAISUpdateReceived("AISCommand", content); - - if (mCallback) - { - LLUUID item_id; // will default to null if parse fails. - getResponseUUID(content,item_id); - mCallback->fire(item_id); - } - } - - /*virtual*/ void httpFailure() + LLPointer obj = gInventory.getItem(item_id); + LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; + if(obj) { - const LLSD& content = getContent(); - S32 status = getStatus(); - const std::string& reason = getReason(); - const LLSD& headers = getResponseHeaders(); - if (!content.isMap()) - { - LL_DEBUGS("Inventory") << "Malformed response contents " << content - << " status " << status << " reason " << reason << llendl; - } - else - { - LL_DEBUGS("Inventory") << "failed with content: " << ll_pretty_print_sd(content) - << " status " << status << " reason " << reason << llendl; - } - mRetryPolicy->onFailure(status, headers); - F32 seconds_to_wait; - if (mRetryPolicy->shouldRetry(seconds_to_wait)) + std::string cap; + if (AISCommand::getCap(cap)) { - doAfterInterval(boost::bind(&AISCommand::run_command,this),seconds_to_wait); + LLPointer cmd_ptr = new UpdateItemCommand(item_id, updates, cb); + cmd_ptr->run_command(); } - else + else // no cap { - // Command func holds a reference to self, need to release it - // after a success or final failure. - setCommandFunc(no_op); - } - } + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_UpdateInventoryItem); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_TransactionID, obj->getTransactionID()); + msg->nextBlockFast(_PREHASH_InventoryData); + msg->addU32Fast(_PREHASH_CallbackID, 0); + obj->packUpdateMessage(msg, updates); + gAgent.sendReliableMessage(); - static bool getCap(std::string& cap) - { - if (gAgent.getRegion()) - { - cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); - } - if (!cap.empty()) - { - return true; + gInventory.onItemUpdated(item_id, updates); + if (cb) + { + cb->fire(item_id); + } } - return false; } +} -private: - command_func_type mCommandFunc; - LLPointer mRetryPolicy; - LLPointer mCallback; -}; - -class RemoveItemCommand: public AISCommand +void update_inventory_category( + const LLUUID& cat_id, + const LLSD& updates, + LLPointer cb) { -public: - RemoveItemCommand(const LLUUID& item_id, - LLPointer callback): - AISCommand(callback) + LLPointer obj = gInventory.getCategory(cat_id); + LL_DEBUGS("Inventory") << "cat_id: [" << cat_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; + if(obj) { - std::string cap; - if (!getCap(cap)) + if (LLFolderType::lookupIsProtectedType(obj->getPreferredType())) { - llwarns << "No cap found" << llendl; + LLNotificationsUtil::add("CannotModifyProtectedCategories"); return; } - std::string url = cap + std::string("/item/") + item_id.asString(); - LL_DEBUGS("Inventory") << "url: " << url << llendl; - LLHTTPClient::ResponderPtr responder = this; - LLSD headers; - F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); - setCommandFunc(cmd); - } -}; -class RemoveCategoryCommand: public AISCommand -{ -public: - RemoveCategoryCommand(const LLUUID& item_id, - LLPointer callback): - AISCommand(callback) - { - std::string cap; - if (!getCap(cap)) + //std::string cap; + // FIXME - restore this once the back-end work has been done. + if (0) // if (AISCommand::getCap(cap)) { - llwarns << "No cap found" << llendl; - return; + LLPointer cmd_ptr = new UpdateCategoryCommand(cat_id, updates, cb); + cmd_ptr->run_command(); } - std::string url = cap + std::string("/category/") + item_id.asString(); - LL_DEBUGS("Inventory") << "url: " << url << llendl; - LLHTTPClient::ResponderPtr responder = this; - LLSD headers; - F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); - setCommandFunc(cmd); - } -}; - -class PurgeDescendentsCommand: public AISCommand -{ -public: - PurgeDescendentsCommand(const LLUUID& item_id, - LLPointer callback): - AISCommand(callback) - { - std::string cap; - if (!getCap(cap)) + else // no cap { - llwarns << "No cap found" << llendl; - return; + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_UpdateInventoryFolder); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_FolderData); + obj->packUpdateMessage(msg, updates); + gAgent.sendReliableMessage(); + + gInventory.onCategoryUpdated(cat_id, updates); + if (cb) + { + cb->fire(cat_id); + } } - std::string url = cap + std::string("/category/") + item_id.asString() + "/children"; - LL_DEBUGS("Inventory") << "url: " << url << llendl; - LLCurl::ResponderPtr responder = this; - LLSD headers; - F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); - setCommandFunc(cmd); } -}; +} void remove_inventory_item( const LLUUID& item_id, -- cgit v1.2.3 From 34d2cd03765b6b9b582035a933f4ec11fb262ff4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 24 May 2013 15:51:33 -0400 Subject: SH-4207 WIP - use item updates with callback when updating link descriptions. Reworked updateAppearanceFromCOF() cof-validation stages. --- indra/newview/llviewerinventory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 90fef3b5ed..62bcfd20a7 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -726,7 +726,9 @@ void LLViewerInventoryItem::packUpdateMessage(LLMessageSystem* msg, const LLSD& } if (updates.has("desc")) { - msg->addStringFast(_PREHASH_Description, updates["desc"].asString()); + std::string new_desc = updates["desc"].asString(); + LLInventoryItem::correctInventoryDescription(new_desc); + msg->addStringFast(_PREHASH_Description, new_desc); } else { @@ -1461,7 +1463,7 @@ void update_inventory_item( obj->packUpdateMessage(msg, updates); gAgent.sendReliableMessage(); - gInventory.onItemUpdated(item_id, updates); + gInventory.onItemUpdated(item_id, updates,false); if (cb) { cb->fire(item_id); -- cgit v1.2.3 From faaf8ba5c75c925d9922dda8ce43293222cadb3b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 29 May 2013 14:54:59 -0400 Subject: SH-4222 FIX, SH-3635 WIP - start of stuck-appearance checker, always increment folder version when a contained item is updated. --- indra/newview/llviewerinventory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 62bcfd20a7..465a49d004 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1463,7 +1463,7 @@ void update_inventory_item( obj->packUpdateMessage(msg, updates); gAgent.sendReliableMessage(); - gInventory.onItemUpdated(item_id, updates,false); + gInventory.onItemUpdated(item_id, updates,true); if (cb) { cb->fire(item_id); -- cgit v1.2.3 From 63940048eff9c9a1929574ba7581f4c835af35d3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 3 Jun 2013 17:09:25 -0400 Subject: SH-4166 WIP - COF-slammer infrastructure working for non-AIS case. --- indra/newview/llviewerinventory.cpp | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 465a49d004..db8671d51b 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1828,6 +1828,54 @@ void create_new_item(const std::string& name, } +void slam_inventory_folder(const LLUUID& folder_id, + const LLSD& contents, + LLPointer cb) +{ + std::string cap; + if (AISCommand::getCap(cap)) + { + //LLPointer cmd_ptr = new SlamFolderCommand(folder_id, contents, cb); + //cmd_ptr->run_command(); + } + else // no cap + { + for (LLSD::array_const_iterator it = contents.beginArray(); + it != contents.endArray(); + ++it) + { + const LLSD& item_contents = *it; + link_inventory_item(gAgent.getID(), + item_contents["linked_id"].asUUID(), + folder_id, + item_contents["name"].asString(), + item_contents["desc"].asString(), + LLAssetType::EType(item_contents["type"].asInteger()), + cb); + } + remove_folder_contents(folder_id,false,cb); + } +} + +void remove_folder_contents(const LLUUID& category, bool keep_outfit_links, + LLPointer cb) +{ + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + gInventory.collectDescendents(category, cats, items, + LLInventoryModel::EXCLUDE_TRASH); + for (S32 i = 0; i < items.count(); ++i) + { + LLViewerInventoryItem *item = items.get(i); + if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER)) + continue; + if (item->getIsLinkType()) + { + remove_inventory_item(item->getUUID(), cb); + } + } +} + const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not) const std::string NEW_NOTECARD_NAME = "New Note"; // *TODO:Translate? (probably not) const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not) @@ -2263,3 +2311,5 @@ BOOL LLViewerInventoryItem::regenerateLink() gInventory.notifyObservers(); return TRUE; } + + -- cgit v1.2.3 From f7c9739fd9bb4355765ecff4b92e879b38302e49 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 5 Jun 2013 15:13:48 -0400 Subject: SH-3635 WIP - COF slammer works in AISv3 regions. Extensive rework of onAISUpdateReceived. --- indra/newview/llviewerinventory.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index db8671d51b..0608c46051 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -493,6 +493,34 @@ private: LLSD mUpdates; }; +class SlamFolderCommand: public AISCommand +{ +public: + SlamFolderCommand(const LLUUID& folder_id, const LLSD& contents, LLPointer callback): + mContents(contents), + AISCommand(callback) + { + std::string cap; + if (!getCap(cap)) + { + llwarns << "No cap found" << llendl; + return; + } + LLUUID tid; + tid.generate(); + std::string url = cap + std::string("/category/") + folder_id.asString() + "/links?tid=" + tid.asString(); + llinfos << url << llendl; + LLCurl::ResponderPtr responder = this; + LLSD headers; + headers["Content-Type"] = "application/llsd+xml"; + F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + command_func_type cmd = boost::bind(&LLHTTPClient::put, url, mContents, responder, headers, timeout); + setCommandFunc(cmd); + } +private: + LLSD mContents; +}; + ///---------------------------------------------------------------------------- /// Class LLViewerInventoryItem ///---------------------------------------------------------------------------- @@ -1835,8 +1863,8 @@ void slam_inventory_folder(const LLUUID& folder_id, std::string cap; if (AISCommand::getCap(cap)) { - //LLPointer cmd_ptr = new SlamFolderCommand(folder_id, contents, cb); - //cmd_ptr->run_command(); + LLPointer cmd_ptr = new SlamFolderCommand(folder_id, contents, cb); + cmd_ptr->run_command(); } else // no cap { -- cgit v1.2.3 From 89e3959cf393ce9eeb058304264d4f55f4fe9ca2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Jun 2013 12:58:04 -0400 Subject: SH-4216 WIP - moved AISv3 commands and responders to llaisapi.* files --- indra/newview/llviewerinventory.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 0608c46051..57d7d4fef6 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -31,6 +31,7 @@ #include "llsdserialize.h" #include "message.h" +#include "llaisapi.h" #include "llagent.h" #include "llagentcamera.h" #include "llagentwearables.h" @@ -258,6 +259,7 @@ public: }; LLInventoryHandler gInventoryHandler; +#if 0 // DELETE these when working in their new home ///---------------------------------------------------------------------------- /// Classes for AISv3 support. @@ -520,6 +522,7 @@ public: private: LLSD mContents; }; +#endif ///---------------------------------------------------------------------------- /// Class LLViewerInventoryItem -- cgit v1.2.3 From 6d46132ef5218cd17d8d201f16e5a7df4b1e39a6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Jun 2013 16:29:10 -0400 Subject: SH-4216 WIP - finished item/cat update and reorg of aisv3 code --- indra/newview/llviewerinventory.cpp | 351 +++--------------------------------- 1 file changed, 25 insertions(+), 326 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 57d7d4fef6..55575764b9 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -259,271 +259,6 @@ public: }; LLInventoryHandler gInventoryHandler; -#if 0 // DELETE these when working in their new home - -///---------------------------------------------------------------------------- -/// Classes for AISv3 support. -///---------------------------------------------------------------------------- -class AISCommand: public LLHTTPClient::Responder -{ -public: - typedef boost::function command_func_type; - - AISCommand(LLPointer callback): - mCallback(callback) - { - mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10); - } - - virtual ~AISCommand() - { - } - - void run_command() - { - mCommandFunc(); - } - - void setCommandFunc(command_func_type command_func) - { - mCommandFunc = command_func; - } - - // Need to do command-specific parsing to get an id here. May or - // may not need to bother, since most LLInventoryCallbacks do - // their work in the destructor. - virtual bool getResponseUUID(const LLSD& content, LLUUID& id) - { - return false; - } - - /* virtual */ void httpSuccess() - { - // Command func holds a reference to self, need to release it - // after a success or final failure. - setCommandFunc(no_op); - - const LLSD& content = getContent(); - if (!content.isMap()) - { - failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); - return; - } - mRetryPolicy->onSuccess(); - - gInventory.onAISUpdateReceived("AISCommand", content); - - if (mCallback) - { - LLUUID item_id; // will default to null if parse fails. - getResponseUUID(content,item_id); - mCallback->fire(item_id); - } - } - - /*virtual*/ void httpFailure() - { - const LLSD& content = getContent(); - S32 status = getStatus(); - const std::string& reason = getReason(); - const LLSD& headers = getResponseHeaders(); - if (!content.isMap()) - { - LL_DEBUGS("Inventory") << "Malformed response contents " << content - << " status " << status << " reason " << reason << llendl; - } - else - { - LL_DEBUGS("Inventory") << "failed with content: " << ll_pretty_print_sd(content) - << " status " << status << " reason " << reason << llendl; - } - mRetryPolicy->onFailure(status, headers); - F32 seconds_to_wait; - if (mRetryPolicy->shouldRetry(seconds_to_wait)) - { - doAfterInterval(boost::bind(&AISCommand::run_command,this),seconds_to_wait); - } - else - { - // Command func holds a reference to self, need to release it - // after a success or final failure. - setCommandFunc(no_op); - } - } - - static bool getCap(std::string& cap) - { - if (gAgent.getRegion()) - { - cap = gAgent.getRegion()->getCapability("InventoryAPIv3"); - } - if (!cap.empty()) - { - return true; - } - return false; - } - -private: - command_func_type mCommandFunc; - LLPointer mRetryPolicy; - LLPointer mCallback; -}; - -class RemoveItemCommand: public AISCommand -{ -public: - RemoveItemCommand(const LLUUID& item_id, - LLPointer callback): - AISCommand(callback) - { - std::string cap; - if (!getCap(cap)) - { - llwarns << "No cap found" << llendl; - return; - } - std::string url = cap + std::string("/item/") + item_id.asString(); - LL_DEBUGS("Inventory") << "url: " << url << llendl; - LLHTTPClient::ResponderPtr responder = this; - LLSD headers; - F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); - setCommandFunc(cmd); - } -}; - -class RemoveCategoryCommand: public AISCommand -{ -public: - RemoveCategoryCommand(const LLUUID& item_id, - LLPointer callback): - AISCommand(callback) - { - std::string cap; - if (!getCap(cap)) - { - llwarns << "No cap found" << llendl; - return; - } - std::string url = cap + std::string("/category/") + item_id.asString(); - LL_DEBUGS("Inventory") << "url: " << url << llendl; - LLHTTPClient::ResponderPtr responder = this; - LLSD headers; - F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); - setCommandFunc(cmd); - } -}; - -class PurgeDescendentsCommand: public AISCommand -{ -public: - PurgeDescendentsCommand(const LLUUID& item_id, - LLPointer callback): - AISCommand(callback) - { - std::string cap; - if (!getCap(cap)) - { - llwarns << "No cap found" << llendl; - return; - } - std::string url = cap + std::string("/category/") + item_id.asString() + "/children"; - LL_DEBUGS("Inventory") << "url: " << url << llendl; - LLCurl::ResponderPtr responder = this; - LLSD headers; - F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - command_func_type cmd = boost::bind(&LLHTTPClient::del, url, responder, headers, timeout); - setCommandFunc(cmd); - } -}; - -class UpdateItemCommand: public AISCommand -{ -public: - UpdateItemCommand(const LLUUID& item_id, - const LLSD& updates, - LLPointer callback): - mUpdates(updates), - AISCommand(callback) - { - std::string cap; - if (!getCap(cap)) - { - llwarns << "No cap found" << llendl; - return; - } - std::string url = cap + std::string("/item/") + item_id.asString(); - LL_DEBUGS("Inventory") << "url: " << url << llendl; - LLCurl::ResponderPtr responder = this; - LLSD headers; - headers["Content-Type"] = "application/llsd+xml"; - F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - command_func_type cmd = boost::bind(&LLHTTPClient::patch, url, mUpdates, responder, headers, timeout); - setCommandFunc(cmd); - } -private: - LLSD mUpdates; -}; - -class UpdateCategoryCommand: public AISCommand -{ -public: - UpdateCategoryCommand(const LLUUID& item_id, - const LLSD& updates, - LLPointer callback): - mUpdates(updates), - AISCommand(callback) - { - std::string cap; - if (!getCap(cap)) - { - llwarns << "No cap found" << llendl; - return; - } - std::string url = cap + std::string("/category/") + item_id.asString(); - LL_DEBUGS("Inventory") << "url: " << url << llendl; - LLCurl::ResponderPtr responder = this; - LLSD headers; - headers["Content-Type"] = "application/llsd+xml"; - F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - command_func_type cmd = boost::bind(&LLHTTPClient::patch, url, mUpdates, responder, headers, timeout); - setCommandFunc(cmd); - } -private: - LLSD mUpdates; -}; - -class SlamFolderCommand: public AISCommand -{ -public: - SlamFolderCommand(const LLUUID& folder_id, const LLSD& contents, LLPointer callback): - mContents(contents), - AISCommand(callback) - { - std::string cap; - if (!getCap(cap)) - { - llwarns << "No cap found" << llendl; - return; - } - LLUUID tid; - tid.generate(); - std::string url = cap + std::string("/category/") + folder_id.asString() + "/links?tid=" + tid.asString(); - llinfos << url << llendl; - LLCurl::ResponderPtr responder = this; - LLSD headers; - headers["Content-Type"] = "application/llsd+xml"; - F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - command_func_type cmd = boost::bind(&LLHTTPClient::put, url, mContents, responder, headers, timeout); - setCommandFunc(cmd); - } -private: - LLSD mContents; -}; -#endif - ///---------------------------------------------------------------------------- /// Class LLViewerInventoryItem ///---------------------------------------------------------------------------- @@ -718,23 +453,9 @@ void LLViewerInventoryItem::setTransactionID(const LLTransactionID& transaction_ { mTransactionID = transaction_id; } -// virtual -void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const -{ - static const LLSD updates; - packUpdateMessage(msg,updates); -} -void LLViewerInventoryItem::packUpdateMessage(LLMessageSystem* msg, const LLSD& updates) const +void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const { - for (LLSD::map_const_iterator it = updates.beginMap(); it != updates.endMap(); ++it) - { - if ((it->first != "desc") && (it->first != "name")) - { - llerrs << "unhandled field: " << it->first << llendl; - } - } - msg->addUUIDFast(_PREHASH_ItemID, mUUID); msg->addUUIDFast(_PREHASH_FolderID, mParentUUID); mPermissions.packMessage(msg); @@ -745,26 +466,8 @@ void LLViewerInventoryItem::packUpdateMessage(LLMessageSystem* msg, const LLSD& msg->addS8Fast(_PREHASH_InvType, type); msg->addU32Fast(_PREHASH_Flags, mFlags); mSaleInfo.packMessage(msg); - if (updates.has("name")) - { - std::string new_name = updates["name"].asString(); - LLInventoryObject::correctInventoryName(new_name); - msg->addStringFast(_PREHASH_Name, new_name); - } - else - { - msg->addStringFast(_PREHASH_Name, mName); - } - if (updates.has("desc")) - { - std::string new_desc = updates["desc"].asString(); - LLInventoryItem::correctInventoryDescription(new_desc); - msg->addStringFast(_PREHASH_Description, new_desc); - } - else - { - msg->addStringFast(_PREHASH_Description, mDescription); - } + msg->addStringFast(_PREHASH_Name, mName); + msg->addStringFast(_PREHASH_Description, mDescription); msg->addS32Fast(_PREHASH_CreationDate, mCreationDate); U32 crc = getCRC32(); msg->addU32Fast(_PREHASH_CRC, crc); @@ -881,30 +584,13 @@ void LLViewerInventoryCategory::copyViewerCategory(const LLViewerInventoryCatego } -void LLViewerInventoryCategory::packUpdateMessage(LLMessageSystem* msg, const LLSD& updates) const +void LLViewerInventoryCategory::packMessage(LLMessageSystem* msg) const { - for (LLSD::map_const_iterator it = updates.beginMap(); it != updates.endMap(); ++it) - { - if (it->first != "name") - { - llerrs << "unhandled field: " << it->first << llendl; - } - } - msg->addUUIDFast(_PREHASH_FolderID, mUUID); msg->addUUIDFast(_PREHASH_ParentID, mParentUUID); S8 type = static_cast(mPreferredType); msg->addS8Fast(_PREHASH_Type, type); - if (updates.has("name")) - { - std::string new_name = updates["name"].asString(); - LLInventoryObject::correctInventoryName(new_name); - msg->addStringFast(_PREHASH_Name, new_name); - } - else - { - msg->addStringFast(_PREHASH_Name, mName); - } + msg->addStringFast(_PREHASH_Name, mName); } void LLViewerInventoryCategory::updateParentOnServer(BOOL restamp) const @@ -1475,10 +1161,16 @@ void update_inventory_item( LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; if(obj) { + LLPointer new_item(new LLViewerInventoryItem); + new_item->copyViewerItem(obj); + new_item->fromLLSD(updates,false); + std::string cap; if (AISCommand::getCap(cap)) { - LLPointer cmd_ptr = new UpdateItemCommand(item_id, updates, cb); + LLSD new_llsd; + new_item->asLLSD(new_llsd); + LLPointer cmd_ptr = new UpdateItemCommand(item_id, new_llsd, cb); cmd_ptr->run_command(); } else // no cap @@ -1488,13 +1180,15 @@ void update_inventory_item( msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_TransactionID, obj->getTransactionID()); + msg->addUUIDFast(_PREHASH_TransactionID, new_item->getTransactionID()); msg->nextBlockFast(_PREHASH_InventoryData); msg->addU32Fast(_PREHASH_CallbackID, 0); - obj->packUpdateMessage(msg, updates); + new_item->packMessage(msg); gAgent.sendReliableMessage(); - gInventory.onItemUpdated(item_id, updates,true); + LLInventoryModel::LLCategoryUpdate up(new_item->getParentUUID(), 0); + gInventory.accountForUpdate(up); + gInventory.updateItem(new_item); if (cb) { cb->fire(item_id); @@ -1518,11 +1212,14 @@ void update_inventory_category( return; } + LLPointer new_cat = new LLViewerInventoryCategory(obj); + new_cat->fromLLSD(updates); //std::string cap; // FIXME - restore this once the back-end work has been done. if (0) // if (AISCommand::getCap(cap)) { - LLPointer cmd_ptr = new UpdateCategoryCommand(cat_id, updates, cb); + LLSD new_llsd = new_cat->asLLSD(); + LLPointer cmd_ptr = new UpdateCategoryCommand(cat_id, new_llsd, cb); cmd_ptr->run_command(); } else // no cap @@ -1533,10 +1230,12 @@ void update_inventory_category( msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_FolderData); - obj->packUpdateMessage(msg, updates); + new_cat->packMessage(msg); gAgent.sendReliableMessage(); - gInventory.onCategoryUpdated(cat_id, updates); + LLInventoryModel::LLCategoryUpdate up(new_cat->getParentUUID(), 0); + gInventory.accountForUpdate(up); + gInventory.updateCategory(new_cat); if (cb) { cb->fire(cat_id); -- cgit v1.2.3 From 27fc270c73fdf3db5c07e9ed43b7f4d0994b2cc2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 18 Jun 2013 16:51:37 -0400 Subject: SH-4262 WIP - fix for the reordering bug in AIS regions. --- indra/newview/llviewerinventory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 55575764b9..26aecd39d1 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -360,7 +360,8 @@ void LLViewerInventoryItem::updateServer(BOOL is_new) const if(gAgent.getID() != mPermissions.getOwner()) { // *FIX: deal with this better. - llwarns << "LLViewerInventoryItem::updateServer() - for unowned item" + llwarns << "LLViewerInventoryItem::updateServer() - for unowned item " + << ll_pretty_print_sd(this->asLLSD()) << llendl; return; } -- cgit v1.2.3 From 3e0e236f33a866a3962295a99495fd1159532ba8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 24 Jun 2013 15:42:27 -0400 Subject: SH-4243 WIP - cleaned up callback structure for createNewCategory, modified makeNewOutfitLinks() to wait for category creation before populating. --- indra/newview/llviewerinventory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 26aecd39d1..9725ea6456 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -69,8 +69,9 @@ #include "llclipboard.h" #include "llhttpretrypolicy.h" -// Two do-nothing ops for use in callbacks. +// do-nothing ops for use in callbacks. void no_op_inventory_func(const LLUUID&) {} +void no_op_llsd_func(const LLSD&) {} void no_op() {} ///---------------------------------------------------------------------------- -- cgit v1.2.3 From 62a6009fa265cd56c8711300a830446b03532785 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Jun 2013 16:15:47 -0400 Subject: Log slamming calls --- indra/newview/llviewerinventory.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 9725ea6456..c934dd991b 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1567,11 +1567,15 @@ void slam_inventory_folder(const LLUUID& folder_id, std::string cap; if (AISCommand::getCap(cap)) { + LL_DEBUGS("Avatar") << "using AISv3 to slam folder, id " << folder_id + << " new contents: " << ll_pretty_print_sd(contents) << llendl; LLPointer cmd_ptr = new SlamFolderCommand(folder_id, contents, cb); cmd_ptr->run_command(); } else // no cap { + LL_DEBUGS("Avatar") << "using item-by-item calls to slam folder, id " << folder_id + << " new contents: " << ll_pretty_print_sd(contents) << llendl; for (LLSD::array_const_iterator it = contents.beginArray(); it != contents.endArray(); ++it) -- cgit v1.2.3 From a85fa3b10a406218cabfecc0d592e816f8dfdb53 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 11 Jul 2013 15:15:04 -0700 Subject: Adding support for COPY methods to httpclient. Implementing viewer-side use of AISv3 COPY library folder operation. (SH-4304) --- indra/newview/llviewerinventory.cpp | 62 +++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 27 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index c934dd991b..5beae8ec24 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -430,7 +430,7 @@ void LLViewerInventoryItem::fetchFromServer(void) const } // virtual -BOOL LLViewerInventoryItem::unpackMessage(LLSD item) +BOOL LLViewerInventoryItem::unpackMessage(const LLSD& item) { BOOL rv = LLInventoryItem::fromLLSD(item); @@ -866,6 +866,21 @@ void LLViewerInventoryCategory::localizeName() LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName); } +// virtual +BOOL LLViewerInventoryCategory::unpackMessage(const LLSD& category) +{ + BOOL rv = LLInventoryCategory::fromLLSD(category); + localizeName(); + return rv; +} + +// virtual +void LLViewerInventoryCategory::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num) +{ + LLInventoryCategory::unpackMessage(msg, block, block_num); + localizeName(); +} + ///---------------------------------------------------------------------------- /// Local function definitions ///---------------------------------------------------------------------------- @@ -1159,24 +1174,22 @@ void update_inventory_item( const LLSD& updates, LLPointer cb) { - LLPointer obj = gInventory.getItem(item_id); - LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; - if(obj) + bool ais_ran = false; + if (AISCommand::isAPIAvailable()) { - LLPointer new_item(new LLViewerInventoryItem); - new_item->copyViewerItem(obj); - new_item->fromLLSD(updates,false); - - std::string cap; - if (AISCommand::getCap(cap)) - { - LLSD new_llsd; - new_item->asLLSD(new_llsd); - LLPointer cmd_ptr = new UpdateItemCommand(item_id, new_llsd, cb); - cmd_ptr->run_command(); - } - else // no cap + LLPointer cmd_ptr = new UpdateItemCommand(item_id, updates, cb); + ais_ran = cmd_ptr->run_command(); + } + if (!ais_ran) + { + LLPointer obj = gInventory.getItem(item_id); + LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; + if(obj) { + LLPointer new_item(new LLViewerInventoryItem); + new_item->copyViewerItem(obj); + new_item->fromLLSD(updates,false); + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_UpdateInventoryItem); msg->nextBlockFast(_PREHASH_AgentData); @@ -1216,9 +1229,8 @@ void update_inventory_category( LLPointer new_cat = new LLViewerInventoryCategory(obj); new_cat->fromLLSD(updates); - //std::string cap; // FIXME - restore this once the back-end work has been done. - if (0) // if (AISCommand::getCap(cap)) + if (0) // if (AISCommand::isAPIAvailable()) { LLSD new_llsd = new_cat->asLLSD(); LLPointer cmd_ptr = new UpdateCategoryCommand(cat_id, new_llsd, cb); @@ -1254,8 +1266,7 @@ void remove_inventory_item( LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; if(obj) { - std::string cap; - if (AISCommand::getCap(cap)) + if (AISCommand::isAPIAvailable()) { LLPointer cmd_ptr = new RemoveItemCommand(item_id, cb); cmd_ptr->run_command(); @@ -1325,8 +1336,7 @@ void remove_inventory_category( LLNotificationsUtil::add("CannotRemoveProtectedCategories"); return; } - std::string cap; - if (AISCommand::getCap(cap)) + if (AISCommand::isAPIAvailable()) { LLPointer cmd_ptr = new RemoveCategoryCommand(cat_id, cb); cmd_ptr->run_command(); @@ -1429,8 +1439,7 @@ void purge_descendents_of(const LLUUID& id, LLPointer cb) } else { - std::string cap; - if (AISCommand::getCap(cap)) + if (AISCommand::isAPIAvailable()) { LLPointer cmd_ptr = new PurgeDescendentsCommand(id, cb); cmd_ptr->run_command(); @@ -1564,8 +1573,7 @@ void slam_inventory_folder(const LLUUID& folder_id, const LLSD& contents, LLPointer cb) { - std::string cap; - if (AISCommand::getCap(cap)) + if (AISCommand::isAPIAvailable()) { LL_DEBUGS("Avatar") << "using AISv3 to slam folder, id " << folder_id << " new contents: " << ll_pretty_print_sd(contents) << llendl; -- cgit v1.2.3 From a428acf331dc63b2d6bac10101a8339e91a73adc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 16 Jul 2013 17:08:24 -0400 Subject: SH-4333 FIX - turned on category patch now that AISv3 has it --- indra/newview/llviewerinventory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 5beae8ec24..5b4ca97319 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1230,7 +1230,7 @@ void update_inventory_category( LLPointer new_cat = new LLViewerInventoryCategory(obj); new_cat->fromLLSD(updates); // FIXME - restore this once the back-end work has been done. - if (0) // if (AISCommand::isAPIAvailable()) + if (AISCommand::isAPIAvailable()) { LLSD new_llsd = new_cat->asLLSD(); LLPointer cmd_ptr = new UpdateCategoryCommand(cat_id, new_llsd, cb); -- cgit v1.2.3 From 3d8d4227f1930f986c3b70227de98c12830c874a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 19 Jul 2013 17:22:53 -0400 Subject: SH-3889 WIP - added callbacks to control ordering of operations after wearable save. --- indra/newview/llviewerinventory.cpp | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 5b4ca97319..bff6767617 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1166,6 +1166,49 @@ void move_inventory_item( gAgent.sendReliableMessage(); } +// Should call this with an update_item that's been copied and +// modified from an original source item, rather than modifying the +// source item directly. +void update_inventory_item( + LLViewerInventoryItem *update_item, + LLPointer cb) +{ + const LLUUID& item_id = update_item->getUUID(); + bool ais_ran = false; + if (AISCommand::isAPIAvailable()) + { + LLSD updates = update_item->asLLSD(); + LLPointer cmd_ptr = new UpdateItemCommand(item_id, updates, cb); + ais_ran = cmd_ptr->run_command(); + } + if (!ais_ran) + { + LLPointer obj = gInventory.getItem(item_id); + LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (update_item ? update_item->getName() : "(NOT FOUND)") << llendl; + if(obj) + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_UpdateInventoryItem); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_TransactionID, update_item->getTransactionID()); + msg->nextBlockFast(_PREHASH_InventoryData); + msg->addU32Fast(_PREHASH_CallbackID, 0); + update_item->packMessage(msg); + gAgent.sendReliableMessage(); + + LLInventoryModel::LLCategoryUpdate up(update_item->getParentUUID(), 0); + gInventory.accountForUpdate(up); + gInventory.updateItem(update_item); + if (cb) + { + cb->fire(item_id); + } + } + } +} + // Note this only supports updating an existing item. Goes through AISv3 // code path where available. Not all uses of item->updateServer() can // easily be switched to this paradigm. -- cgit v1.2.3 From 3ed3b88892adb4234c375d2d6bd5f0d2da5566c7 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 9 Aug 2013 13:36:36 -0700 Subject: Refactoring link creation calls in preparation for adding AIS v3 hook. --- indra/newview/llviewerinventory.cpp | 212 ++++++++++++++++++++++++------------ 1 file changed, 145 insertions(+), 67 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index bff6767617..33186a5a88 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1074,77 +1074,133 @@ void copy_inventory_item( gAgent.sendReliableMessage(); } -void link_inventory_item( - const LLUUID& agent_id, - const LLUUID& item_id, - const LLUUID& parent_id, - const std::string& new_name, - const std::string& new_description, - const LLAssetType::EType asset_type, - LLPointer cb) +// Create link to single inventory object. +void link_inventory_object(const LLUUID& category, + LLConstPointer baseobj, + LLPointer cb) { - const LLInventoryObject *baseobj = gInventory.getObject(item_id); if (!baseobj) { - llwarns << "attempt to link to unknown item, linked-to-item's itemID " << item_id << llendl; - return; - } - if (baseobj && baseobj->getIsLinkType()) - { - llwarns << "attempt to create a link to a link, linked-to-item's itemID " << item_id << llendl; + llwarns << "Attempt to link to non-existent object" << llendl; return; } - if (baseobj && !LLAssetType::lookupCanLink(baseobj->getType())) - { - // Fail if item can be found but is of a type that can't be linked. - // Arguably should fail if the item can't be found too, but that could - // be a larger behavioral change. - llwarns << "attempt to link an unlinkable item, type = " << baseobj->getActualType() << llendl; - return; - } - - LLUUID transaction_id; - LLInventoryType::EType inv_type = LLInventoryType::IT_NONE; - if (dynamic_cast(baseobj)) - { - inv_type = LLInventoryType::IT_CATEGORY; - } - else + LLInventoryObject::const_object_list_t obj_array; + obj_array.push_back(baseobj); + link_inventory_array(category, obj_array, cb); +} + +void link_inventory_object(const LLUUID& category, + const LLUUID& id, + LLPointer cb) +{ + LLConstPointer baseobj = gInventory.getObject(id); + link_inventory_object(category, baseobj, cb); +} + +// Create links to all listed inventory objects. +void link_inventory_array(const LLUUID& category, + LLInventoryObject::const_object_list_t& baseobj_array, + LLPointer cb, + bool resolve_links /* = false */) +{ +#ifndef LL_RELEASE_FOR_DOWNLOAD + const LLViewerInventoryCategory *cat = gInventory.getCategory(category); + const std::string cat_name = cat ? cat->getName() : "CAT NOT FOUND"; +#endif + LLInventoryObject::const_object_list_t::const_iterator it = baseobj_array.begin(); + LLInventoryObject::const_object_list_t::const_iterator end = baseobj_array.end(); + for (; it != end; ++it) { - const LLViewerInventoryItem *baseitem = dynamic_cast(baseobj); - if (baseitem) + const LLInventoryObject* baseobj = *it; + if (!baseobj) { - inv_type = baseitem->getInventoryType(); + llwarns << "attempt to link to unknown object" << llendl; + continue; + } + if (!resolve_links && baseobj->getIsLinkType()) + { + llwarns << "attempt to create a link to a link, linked-to-object's ID " << baseobj->getUUID() << llendl; + continue; } - } -#if 1 // debugging stuff - LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id); - lldebugs << "cat: " << cat << llendl; - + if (!LLAssetType::lookupCanLink(baseobj->getType())) + { + // Fail if item can be found but is of a type that can't be linked. + // Arguably should fail if the item can't be found too, but that could + // be a larger behavioral change. + llwarns << "attempt to link an unlinkable object, type = " << baseobj->getActualType() << llendl; + continue; + } + + LLUUID transaction_id; + LLInventoryType::EType inv_type = LLInventoryType::IT_NONE; + LLAssetType::EType asset_type = LLAssetType::AT_NONE; + std::string new_desc; + LLUUID linkee_id; + if (dynamic_cast(baseobj)) + { + inv_type = LLInventoryType::IT_CATEGORY; + asset_type = LLAssetType::AT_LINK_FOLDER; + linkee_id = baseobj->getUUID(); + } + else + { + const LLViewerInventoryItem *baseitem = dynamic_cast(baseobj); + if (baseitem) + { + inv_type = baseitem->getInventoryType(); + new_desc = baseitem->getActualDescription(); + switch (baseitem->getActualType()) + { + case LLAssetType::AT_LINK: + case LLAssetType::AT_LINK_FOLDER: + linkee_id = baseobj->getLinkedUUID(); + asset_type = baseitem->getActualType(); + break; + default: + linkee_id = baseobj->getUUID(); + asset_type = LLAssetType::AT_LINK; + break; + } + } + else + { + llwarns << "could not convert object into an item or category: " << baseobj->getUUID() << llendl; + continue; + } + } + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_LinkInventoryItem); + msg->nextBlock(_PREHASH_AgentData); + { + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + } + msg->nextBlock(_PREHASH_InventoryBlock); + { + msg->addU32Fast(_PREHASH_CallbackID, gInventoryCallbacks.registerCB(cb)); + msg->addUUIDFast(_PREHASH_FolderID, category); + msg->addUUIDFast(_PREHASH_TransactionID, transaction_id); + msg->addUUIDFast(_PREHASH_OldItemID, linkee_id); + msg->addS8Fast(_PREHASH_Type, (S8)asset_type); + msg->addS8Fast(_PREHASH_InvType, (S8)inv_type); + msg->addStringFast(_PREHASH_Name, baseobj->getName()); + msg->addStringFast(_PREHASH_Description, new_desc); + } + gAgent.sendReliableMessage(); +#ifndef LL_RELEASE_FOR_DOWNLOAD + LL_DEBUGS("Inventory") << "Linking Object [ name:" << baseobj->getName() + << " UUID:" << baseobj->getUUID() + << " ] into Category [ name:" << cat_name + << " UUID:" << category << " ] " << LL_ENDL; #endif - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_LinkInventoryItem); - msg->nextBlock(_PREHASH_AgentData); - { - msg->addUUIDFast(_PREHASH_AgentID, agent_id); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); } - msg->nextBlock(_PREHASH_InventoryBlock); - { - msg->addU32Fast(_PREHASH_CallbackID, gInventoryCallbacks.registerCB(cb)); - msg->addUUIDFast(_PREHASH_FolderID, parent_id); - msg->addUUIDFast(_PREHASH_TransactionID, transaction_id); - msg->addUUIDFast(_PREHASH_OldItemID, item_id); - msg->addS8Fast(_PREHASH_Type, (S8)asset_type); - msg->addS8Fast(_PREHASH_InvType, (S8)inv_type); - msg->addStringFast(_PREHASH_Name, new_name); - msg->addStringFast(_PREHASH_Description, new_description); - } - gAgent.sendReliableMessage(); } + + void move_inventory_item( const LLUUID& agent_id, const LLUUID& session_id, @@ -1301,14 +1357,41 @@ void update_inventory_category( } } +void remove_inventory_items( + LLInventoryObject::object_list_t& items_to_kill, + LLPointer cb) +{ + for (LLInventoryObject::object_list_t::iterator it = items_to_kill.begin(); + it != items_to_kill.end(); + ++it) + { + remove_inventory_item(*it, cb); + } +} + void remove_inventory_item( const LLUUID& item_id, LLPointer cb) { - LLPointer obj = gInventory.getItem(item_id); - LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; + LLPointer obj = gInventory.getItem(item_id); + if (obj) + { + remove_inventory_item(obj, cb); + } + else + { + LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << "(NOT FOUND)" << llendl; + } +} + +void remove_inventory_item( + LLPointer obj, + LLPointer cb) +{ if(obj) { + const LLUUID item_id(obj->getUUID()); + LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << obj->getName() << llendl; if (AISCommand::isAPIAvailable()) { LLPointer cmd_ptr = new RemoveItemCommand(item_id, cb); @@ -1336,7 +1419,8 @@ void remove_inventory_item( } else { - llwarns << "remove_inventory_item called for invalid or nonexistent item " << item_id << llendl; + // *TODO: Clean up callback? + llwarns << "remove_inventory_item called for invalid or nonexistent item." << llendl; } } @@ -1632,13 +1716,7 @@ void slam_inventory_folder(const LLUUID& folder_id, ++it) { const LLSD& item_contents = *it; - link_inventory_item(gAgent.getID(), - item_contents["linked_id"].asUUID(), - folder_id, - item_contents["name"].asString(), - item_contents["desc"].asString(), - LLAssetType::EType(item_contents["type"].asInteger()), - cb); + link_inventory_object(folder_id, item_contents["linked_id"].asUUID(), cb); } remove_folder_contents(folder_id,false,cb); } -- cgit v1.2.3 From c1af1a692a6bd0f3cdfb3f49cc2451717481b685 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 9 Aug 2013 14:52:54 -0700 Subject: Routing link creating through AISv3 when available. --- indra/newview/llviewerinventory.cpp | 65 +++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 20 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 33186a5a88..dc17da9009 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1110,6 +1110,7 @@ void link_inventory_array(const LLUUID& category, #endif LLInventoryObject::const_object_list_t::const_iterator it = baseobj_array.begin(); LLInventoryObject::const_object_list_t::const_iterator end = baseobj_array.end(); + LLSD links = LLSD::emptyArray(); for (; it != end; ++it) { const LLInventoryObject* baseobj = *it; @@ -1133,7 +1134,6 @@ void link_inventory_array(const LLUUID& category, continue; } - LLUUID transaction_id; LLInventoryType::EType inv_type = LLInventoryType::IT_NONE; LLAssetType::EType asset_type = LLAssetType::AT_NONE; std::string new_desc; @@ -1171,25 +1171,14 @@ void link_inventory_array(const LLUUID& category, } } - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_LinkInventoryItem); - msg->nextBlock(_PREHASH_AgentData); - { - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - } - msg->nextBlock(_PREHASH_InventoryBlock); - { - msg->addU32Fast(_PREHASH_CallbackID, gInventoryCallbacks.registerCB(cb)); - msg->addUUIDFast(_PREHASH_FolderID, category); - msg->addUUIDFast(_PREHASH_TransactionID, transaction_id); - msg->addUUIDFast(_PREHASH_OldItemID, linkee_id); - msg->addS8Fast(_PREHASH_Type, (S8)asset_type); - msg->addS8Fast(_PREHASH_InvType, (S8)inv_type); - msg->addStringFast(_PREHASH_Name, baseobj->getName()); - msg->addStringFast(_PREHASH_Description, new_desc); - } - gAgent.sendReliableMessage(); + LLSD link = LLSD::emptyMap(); + link["linked_id"] = linkee_id; + link["type"] = (S8)asset_type; + link["inv_type"] = (S8)inv_type; + link["name"] = baseobj->getName(); + link["desc"] = new_desc; + links.append(link); + #ifndef LL_RELEASE_FOR_DOWNLOAD LL_DEBUGS("Inventory") << "Linking Object [ name:" << baseobj->getName() << " UUID:" << baseobj->getUUID() @@ -1197,6 +1186,42 @@ void link_inventory_array(const LLUUID& category, << " UUID:" << category << " ] " << LL_ENDL; #endif } + + bool ais_ran = false; + if (AISCommand::isAPIAvailable()) + { + LLSD new_inventory = LLSD::emptyMap(); + new_inventory["links"] = links; + LLPointer cmd_ptr = new CreateInventoryCommand(category, new_inventory, cb); + ais_ran = cmd_ptr->run_command(); + } + + if (!ais_ran) + { + LLMessageSystem* msg = gMessageSystem; + for (LLSD::array_iterator iter = links.beginArray(); iter != links.endArray(); ++iter ) + { + msg->newMessageFast(_PREHASH_LinkInventoryItem); + msg->nextBlock(_PREHASH_AgentData); + { + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + } + msg->nextBlock(_PREHASH_InventoryBlock); + { + LLSD link = (*iter); + msg->addU32Fast(_PREHASH_CallbackID, gInventoryCallbacks.registerCB(cb)); + msg->addUUIDFast(_PREHASH_FolderID, category); + msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); + msg->addUUIDFast(_PREHASH_OldItemID, link["linked_id"].asUUID()); + msg->addS8Fast(_PREHASH_Type, link["type"].asInteger()); + msg->addS8Fast(_PREHASH_InvType, link["inv_type"].asInteger()); + msg->addStringFast(_PREHASH_Name, link["name"].asString()); + msg->addStringFast(_PREHASH_Description, link["desc"].asString()); + } + gAgent.sendReliableMessage(); + } + } } -- cgit v1.2.3 From 2157cf5e71f40ae4cc9eedaea6811a4c55718747 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 14 Aug 2013 14:25:22 -0400 Subject: SH-4422 FIX - fixed some recently introduced issues with link description fields, which among other things reduces the number of appearance requests sent. --- indra/newview/llviewerinventory.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index dc17da9009..b623b23e1a 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1101,8 +1101,7 @@ void link_inventory_object(const LLUUID& category, // Create links to all listed inventory objects. void link_inventory_array(const LLUUID& category, LLInventoryObject::const_object_list_t& baseobj_array, - LLPointer cb, - bool resolve_links /* = false */) + LLPointer cb) { #ifndef LL_RELEASE_FOR_DOWNLOAD const LLViewerInventoryCategory *cat = gInventory.getCategory(category); @@ -1119,11 +1118,6 @@ void link_inventory_array(const LLUUID& category, llwarns << "attempt to link to unknown object" << llendl; continue; } - if (!resolve_links && baseobj->getIsLinkType()) - { - llwarns << "attempt to create a link to a link, linked-to-object's ID " << baseobj->getUUID() << llendl; - continue; - } if (!LLAssetType::lookupCanLink(baseobj->getType())) { @@ -1741,7 +1735,9 @@ void slam_inventory_folder(const LLUUID& folder_id, ++it) { const LLSD& item_contents = *it; - link_inventory_object(folder_id, item_contents["linked_id"].asUUID(), cb); + LLViewerInventoryItem *item = new LLViewerInventoryItem; + item->fromLLSD(item_contents); + link_inventory_object(folder_id, item, cb); } remove_folder_contents(folder_id,false,cb); } -- cgit v1.2.3 From f878b032e8c96c4e4ae752864d7641bba2ea4102 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 9 Sep 2013 13:13:22 -0700 Subject: Using transaction_id instead of raw asset_id during aisv3 patch --- indra/newview/llviewerinventory.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index b623b23e1a..ede6eb8490 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1253,6 +1253,12 @@ void update_inventory_item( if (AISCommand::isAPIAvailable()) { LLSD updates = update_item->asLLSD(); + // Replace asset_id with transaction_id (hash_id) + if (updates.has("asset_id")) + { + updates.erase("asset_id"); + updates["hash_id"] = update_item->getTransactionID(); + } LLPointer cmd_ptr = new UpdateItemCommand(item_id, updates, cb); ais_ran = cmd_ptr->run_command(); } -- cgit v1.2.3 From 3a44c5c2a3e04ed8e7174bedb5753d29e6581019 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 10 Sep 2013 14:58:40 -0700 Subject: Fix for SH-4470 when modifying (no copy) or (no transfer) wearables. --- indra/newview/llviewerinventory.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ede6eb8490..b6a5534815 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1253,12 +1253,17 @@ void update_inventory_item( if (AISCommand::isAPIAvailable()) { LLSD updates = update_item->asLLSD(); - // Replace asset_id with transaction_id (hash_id) + // Replace asset_id and/or shadow_id with transaction_id (hash_id) if (updates.has("asset_id")) { updates.erase("asset_id"); updates["hash_id"] = update_item->getTransactionID(); } + if (updates.has("shadow_id")) + { + updates.erase("shadow_id"); + updates["hash_id"] = update_item->getTransactionID(); + } LLPointer cmd_ptr = new UpdateItemCommand(item_id, updates, cb); ais_ran = cmd_ptr->run_command(); } -- cgit v1.2.3 From 8179175e6e6078fab9dc16cf02b5ee744955cd7d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 18 Nov 2013 13:19:43 -0500 Subject: SH-4578 WIP - cleaner folder version accounting --- indra/newview/llviewerinventory.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index b6a5534815..2d9fb7d773 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -701,6 +701,19 @@ bool LLViewerInventoryCategory::fetch() return false; } +S32 LLViewerInventoryCategory::getViewerDescendentCount() const +{ + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(getUUID(), cats, items); + S32 descendents_actual = 0; + if(cats && items) + { + descendents_actual = cats->count() + items->count(); + } + return descendents_actual; +} + bool LLViewerInventoryCategory::importFileLocal(LLFILE* fp) { // *NOTE: This buffer size is hard coded into scanf() below. -- cgit v1.2.3 From 487ca1bad37883be0325b564ab557a8f77575388 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 14 May 2014 17:50:59 -0400 Subject: v-r -> s-e merge WIP --- indra/newview/llviewerinventory.cpp | 42 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 3e3e385905..b236bba3b7 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -709,7 +709,7 @@ S32 LLViewerInventoryCategory::getViewerDescendentCount() const S32 descendents_actual = 0; if(cats && items) { - descendents_actual = cats->count() + items->count(); + descendents_actual = cats->size() + items->size(); } return descendents_actual; } @@ -1128,7 +1128,7 @@ void link_inventory_array(const LLUUID& category, const LLInventoryObject* baseobj = *it; if (!baseobj) { - llwarns << "attempt to link to unknown object" << llendl; + LL_WARNS() << "attempt to link to unknown object" << LL_ENDL; continue; } @@ -1137,7 +1137,7 @@ void link_inventory_array(const LLUUID& category, // Fail if item can be found but is of a type that can't be linked. // Arguably should fail if the item can't be found too, but that could // be a larger behavioral change. - llwarns << "attempt to link an unlinkable object, type = " << baseobj->getActualType() << llendl; + LL_WARNS() << "attempt to link an unlinkable object, type = " << baseobj->getActualType() << LL_ENDL; continue; } @@ -1173,7 +1173,7 @@ void link_inventory_array(const LLUUID& category, } else { - llwarns << "could not convert object into an item or category: " << baseobj->getUUID() << llendl; + LL_WARNS() << "could not convert object into an item or category: " << baseobj->getUUID() << LL_ENDL; continue; } } @@ -1281,7 +1281,7 @@ void update_inventory_item( if (!ais_ran) { LLPointer obj = gInventory.getItem(item_id); - LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (update_item ? update_item->getName() : "(NOT FOUND)") << llendl; + LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (update_item ? update_item->getName() : "(NOT FOUND)") << LL_ENDL; if(obj) { LLMessageSystem* msg = gMessageSystem; @@ -1323,7 +1323,7 @@ void update_inventory_item( if (!ais_ran) { LLPointer obj = gInventory.getItem(item_id); - LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; + LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << LL_ENDL; if(obj) { LLPointer new_item(new LLViewerInventoryItem); @@ -1358,7 +1358,7 @@ void update_inventory_category( LLPointer cb) { LLPointer obj = gInventory.getCategory(cat_id); - LL_DEBUGS("Inventory") << "cat_id: [" << cat_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << llendl; + LL_DEBUGS("Inventory") << "cat_id: [" << cat_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << LL_ENDL; if(obj) { if (LLFolderType::lookupIsProtectedType(obj->getPreferredType())) @@ -1421,7 +1421,7 @@ void remove_inventory_item( } else { - LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << "(NOT FOUND)" << llendl; + LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << "(NOT FOUND)" << LL_ENDL; } } @@ -1432,7 +1432,7 @@ void remove_inventory_item( if(obj) { const LLUUID item_id(obj->getUUID()); - LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << obj->getName() << llendl; + LL_DEBUGS("Inventory") << "item_id: [" << item_id << "] name " << obj->getName() << LL_ENDL; if (AISCommand::isAPIAvailable()) { LLPointer cmd_ptr = new RemoveItemCommand(item_id, cb); @@ -1461,7 +1461,7 @@ void remove_inventory_item( else { // *TODO: Clean up callback? - llwarns << "remove_inventory_item called for invalid or nonexistent item." << llendl; + LL_WARNS() << "remove_inventory_item called for invalid or nonexistent item." << LL_ENDL; } } @@ -1479,7 +1479,7 @@ public: LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(mID); if(children != LLInventoryModel::CHILDREN_NO) { - llwarns << "remove descendents failed, cannot remove category " << llendl; + LL_WARNS() << "remove descendents failed, cannot remove category " << LL_ENDL; } else { @@ -1495,7 +1495,7 @@ void remove_inventory_category( const LLUUID& cat_id, LLPointer cb) { - LL_DEBUGS("Inventory") << "cat_id: [" << cat_id << "] " << llendl; + LL_DEBUGS("Inventory") << "cat_id: [" << cat_id << "] " << LL_ENDL; LLPointer obj = gInventory.getCategory(cat_id); if(obj) { @@ -1516,7 +1516,7 @@ void remove_inventory_category( LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(cat_id); if(children != LLInventoryModel::CHILDREN_NO) { - LL_DEBUGS("Inventory") << "Will purge descendents first before deleting category " << cat_id << llendl; + LL_DEBUGS("Inventory") << "Will purge descendents first before deleting category " << cat_id << LL_ENDL; LLPointer wrap_cb = new LLRemoveCategoryOnDestroy(cat_id, cb); purge_descendents_of(cat_id, wrap_cb); return; @@ -1542,7 +1542,7 @@ void remove_inventory_category( } else { - llwarns << "remove_inventory_category called for invalid or nonexistent item " << cat_id << llendl; + LL_WARNS() << "remove_inventory_category called for invalid or nonexistent item " << cat_id << LL_ENDL; } } @@ -1570,7 +1570,7 @@ void purge_descendents_of(const LLUUID& id, LLPointer cb) LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(id); if(children == LLInventoryModel::CHILDREN_NO) { - LL_DEBUGS("Inventory") << "No descendents to purge for " << id << llendl; + LL_DEBUGS("Inventory") << "No descendents to purge for " << id << LL_ENDL; return; } LLPointer cat = gInventory.getCategory(id); @@ -1580,7 +1580,7 @@ void purge_descendents_of(const LLUUID& id, LLPointer cb) { // Something on the clipboard is in "cut mode" and needs to be preserved LL_DEBUGS("Inventory") << "purge_descendents_of clipboard case " << cat->getName() - << " iterate and purge non hidden items" << llendl; + << " iterate and purge non hidden items" << LL_ENDL; LLInventoryModel::cat_array_t* categories; LLInventoryModel::item_array_t* items; // Get the list of direct descendants in tha categoy passed as argument @@ -1615,7 +1615,7 @@ void purge_descendents_of(const LLUUID& id, LLPointer cb) else // no cap { // Fast purge - LL_DEBUGS("Inventory") << "purge_descendents_of fast case " << cat->getName() << llendl; + LL_DEBUGS("Inventory") << "purge_descendents_of fast case " << cat->getName() << LL_ENDL; // send it upstream LLMessageSystem* msg = gMessageSystem; @@ -1744,14 +1744,14 @@ void slam_inventory_folder(const LLUUID& folder_id, if (AISCommand::isAPIAvailable()) { LL_DEBUGS("Avatar") << "using AISv3 to slam folder, id " << folder_id - << " new contents: " << ll_pretty_print_sd(contents) << llendl; + << " new contents: " << ll_pretty_print_sd(contents) << LL_ENDL; LLPointer cmd_ptr = new SlamFolderCommand(folder_id, contents, cb); cmd_ptr->run_command(); } else // no cap { LL_DEBUGS("Avatar") << "using item-by-item calls to slam folder, id " << folder_id - << " new contents: " << ll_pretty_print_sd(contents) << llendl; + << " new contents: " << ll_pretty_print_sd(contents) << LL_ENDL; for (LLSD::array_const_iterator it = contents.beginArray(); it != contents.endArray(); ++it) @@ -1772,9 +1772,9 @@ void remove_folder_contents(const LLUUID& category, bool keep_outfit_links, LLInventoryModel::item_array_t items; gInventory.collectDescendents(category, cats, items, LLInventoryModel::EXCLUDE_TRASH); - for (S32 i = 0; i < items.count(); ++i) + for (S32 i = 0; i < items.size(); ++i) { - LLViewerInventoryItem *item = items.get(i); + LLViewerInventoryItem *item = items.at(i); if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER)) continue; if (item->getIsLinkType()) -- cgit v1.2.3