From f98c1403fb47990181c504acfbf5d35a393225b7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 18 Mar 2023 01:15:27 +0200 Subject: SL-18674 Reenable folder creation via AIS v3 Add item fetching via AIS v3 --- indra/newview/llaisapi.cpp | 5 --- indra/newview/llaisapi.h | 1 - indra/newview/llinventorymodel.cpp | 3 +- indra/newview/llviewerinventory.cpp | 89 ++++++++++++++++++++----------------- 4 files changed, 49 insertions(+), 49 deletions(-) diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index 5e243476d8..ece03d6988 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -632,11 +632,6 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht LL_DEBUGS("Inventory") << result << LL_ENDL; onUpdateReceived("AISCommand", result, type, body); - if (type == FETCHITEM) - { - LL_WARNS() << "test" << LL_ENDL; - } - if (callback && !callback.empty()) { bool needs_callback = true; diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index 93bbbedb3b..dd02951cd4 100644 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -58,7 +58,6 @@ public: static void FetchItem(const LLUUID &itemId, ITEM_TYPE type, completion_t callback = completion_t()); static void FetchCategoryChildren(const LLUUID &catId, ITEM_TYPE type = AISAPI::ITEM_TYPE::INVENTORY, bool recursive = false, completion_t callback = completion_t(), S32 depth = 0); static void FetchCategoryCategories(const LLUUID &catId, ITEM_TYPE type = AISAPI::ITEM_TYPE::INVENTORY, bool recursive = false, completion_t callback = completion_t(), S32 depth = 0); - static void FetchCOF(completion_t callback = completion_t()); static void CopyLibraryCategory(const LLUUID& sourceId, const LLUUID& destId, bool copySubfolders, completion_t callback = completion_t()); private: diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 43bfaf454c..52121d644f 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -996,7 +996,6 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type)); } -#ifdef USE_AIS_FOR_NC // D567 currently this doesn't really work due to limitations in // AIS3, also violates the common caller assumption that we can // assign the id and return immediately. @@ -1047,7 +1046,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, }); return; } -#endif + LLViewerRegion* viewer_region = gAgent.getRegion(); std::string url; if ( viewer_region ) diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 2f2bc3f91f..6f18d72be0 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -430,48 +430,50 @@ void LLViewerInventoryItem::fetchFromServer(void) const { if(!mIsComplete) { - std::string url; + if (AISAPI::isAvailable()) // AIS v 3 + { + if (gAgent.getID() != mPermissions.getOwner()) + { + AISAPI::FetchItem(mUUID, AISAPI::LIBRARY); + } + else + { + AISAPI::FetchItem(mUUID, AISAPI::INVENTORY); + } + } + else + { + std::string url; - LLViewerRegion* region = gAgent.getRegion(); - // we have to check region. It can be null after region was destroyed. See EXT-245 - if (region) - { - if (gAgent.getID() != mPermissions.getOwner()) - { - url = region->getCapability("FetchLib2"); - } - else - { - url = region->getCapability("FetchInventory2"); - } - } - else - { - LL_WARNS(LOG_INV) << "Agent Region is absent" << LL_ENDL; - } + LLViewerRegion* region = gAgent.getRegion(); + // we have to check region. It can be null after region was destroyed. See EXT-245 + if (region) + { + if (gAgent.getID() != mPermissions.getOwner()) + { + url = region->getCapability("FetchLib2"); + } + else + { + url = region->getCapability("FetchInventory2"); + } + } + else + { + LL_WARNS(LOG_INV) << "Agent Region is absent" << LL_ENDL; + } - if (!url.empty()) - { - LLSD body; - body["agent_id"] = gAgent.getID(); - body["items"][0]["owner_id"] = mPermissions.getOwner(); - body["items"][0]["item_id"] = mUUID; + if (!url.empty()) + { + LLSD body; + body["agent_id"] = gAgent.getID(); + body["items"][0]["owner_id"] = mPermissions.getOwner(); + body["items"][0]["item_id"] = mUUID; - LLCore::HttpHandler::ptr_t handler(new LLInventoryModel::FetchItemHttpHandler(body)); - gInventory.requestPost(true, url, body, handler, "Inventory Item"); - } - else - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("FetchInventory"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->nextBlock("InventoryData"); - msg->addUUID("OwnerID", mPermissions.getOwner()); - msg->addUUID("ItemID", mUUID); - gAgent.sendReliableMessage(); - } + LLCore::HttpHandler::ptr_t handler(new LLInventoryModel::FetchItemHttpHandler(body)); + gInventory.requestPost(true, url, body, handler, "Inventory Item"); + } + } } } @@ -1033,7 +1035,7 @@ void create_inventory_item( } #ifdef USE_AIS_FOR_NC - // D567 currently this doesn't work due to missing AIS3 support + // D567 18.03.2023 not yet implemented within AIS3 if (AISAPI::isAvailable()) { LLSD new_inventory = LLSD::emptyMap(); @@ -1067,12 +1069,17 @@ void create_inventory_item( 0 /*don't know yet, whenever server creates it*/); LLSD item_sd = item->asLLSD(); new_inventory["items"].append(item_sd); + AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); AISAPI::CreateInventory( parent_id, new_inventory, - nullptr); + cr); return; } + else + { + LL_WARNS() << "AIS v3 not available" << LL_ENDL; + } #endif LLMessageSystem* msg = gMessageSystem; -- cgit v1.2.3