summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-04-25 01:34:35 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-04-25 01:34:35 +0300
commit9c2b0c709b3d1cf1a9243853a8df7089e2494057 (patch)
tree62d3198a733859066f8401b4ce23d682ffb1a9b6 /indra
parent4c3a7b106429f3ede827fd28acd25cc00fcb8649 (diff)
SL-19533 Special COF handling
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llaisapi.cpp40
-rw-r--r--indra/newview/llaisapi.h2
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp6
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.h1
-rw-r--r--indra/newview/llstartup.cpp1
5 files changed, 50 insertions, 0 deletions
diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index d39bb57304..117a596cd2 100644
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -593,6 +593,40 @@ void AISAPI::FetchCategoryCategories(const LLUUID &catId, ITEM_TYPE type, bool r
}
/*static*/
+// Will get COF folder, links in it and items those links point to
+void AISAPI::FetchCOF(completion_t callback)
+{
+ std::string cap = getInvCap();
+ if (cap.empty())
+ {
+ LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL;
+ if (callback)
+ {
+ callback(LLUUID::null);
+ }
+ return;
+ }
+ std::string url = cap + std::string("/category/current/links");
+
+ invokationFn_t getFn = boost::bind(
+ // Humans ignore next line. It is just a cast to specify which LLCoreHttpUtil::HttpCoroutineAdapter routine overload.
+ static_cast<LLSD(LLCoreHttpUtil::HttpCoroutineAdapter::*)(LLCore::HttpRequest::ptr_t, const std::string&, LLCore::HttpOptions::ptr_t, LLCore::HttpHeaders::ptr_t)>
+ //----
+ // _1 -> httpAdapter
+ // _2 -> httpRequest
+ // _3 -> url
+ // _4 -> body
+ // _5 -> httpOptions
+ // _6 -> httpHeaders
+ (&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
+
+ LLCoprocedureManager::CoProcedure_t proc(boost::bind(&AISAPI::InvokeAISCommandCoro,
+ _1, getFn, url, LLUUID::null, LLSD(), callback, FETCHCOF));
+
+ EnqueueAISCommand("FetchCOF", proc);
+}
+
+/*static*/
void AISAPI::FetchOrphans(completion_t callback)
{
std::string cap = getInvCap();
@@ -687,6 +721,7 @@ void AISAPI::onUpdateReceived(const std::string& context, const LLSD& update, CO
bool is_fetch = (type == FETCHITEM)
|| (type == FETCHCATEGORYCHILDREN)
|| (type == FETCHCATEGORYCATEGORIES)
+ || (type == FETCHCOF)
|| (type == FETCHORPHANS);
// parse update llsd into stuff to do or parse received items.
S32 depth = 0;
@@ -1095,6 +1130,11 @@ void AISUpdate::parseLink(const LLSD& link_map)
mCatDescendentDeltas[parent_id]++;
new_link->setComplete(true);
}
+
+ if (link_map.has("_embedded"))
+ {
+ parseEmbedded(link_map["_embedded"], S32_MAX);
+ }
}
else
{
diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h
index 4e1c6e5a7d..0ca0144d7b 100644
--- a/indra/newview/llaisapi.h
+++ b/indra/newview/llaisapi.h
@@ -59,6 +59,7 @@ public:
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 FetchCategoryChildren(const std::string &identifier, 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 FetchOrphans(completion_t callback = completion_t() );
static void CopyLibraryCategory(const LLUUID& sourceId, const LLUUID& destId, bool copySubfolders, completion_t callback = completion_t());
@@ -76,6 +77,7 @@ private:
FETCHITEM,
FETCHCATEGORYCHILDREN,
FETCHCATEGORYCATEGORIES,
+ FETCHCOF,
FETCHORPHANS,
} COMMAND_TYPE;
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index bfb5ad9d12..f56532ff8c 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -391,6 +391,12 @@ void LLInventoryModelBackgroundFetch::findLostItems()
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
+void LLInventoryModelBackgroundFetch::fetchCOF()
+{
+ // Will get COF folder, links in it and items those links point to
+ AISAPI::FetchCOF();
+}
+
void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
{
if (mRecursiveInventoryFetchStarted &&
diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
index 1881322e7a..db2d6db323 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.h
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -65,6 +65,7 @@ public:
bool inventoryFetchInProgress() const;
void findLostItems();
+ void fetchCOF();
void incrFetchCount(S32 fetching);
void incrFetchFolderCount(S32 fetching);
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index a1f2753ada..161beaff19 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1898,6 +1898,7 @@ bool idle_startup()
}
LLInventoryModelBackgroundFetch::instance().start();
+ LLInventoryModelBackgroundFetch::instance().fetchCOF();
gInventory.createCommonSystemCategories();
// It's debatable whether this flag is a good idea - sets all