SL-19533 Special COF handling

meow-7.2.2
Andrey Kleshchev 2023-04-25 01:34:35 +03:00
parent 4c3a7b1064
commit 9c2b0c709b
5 changed files with 50 additions and 0 deletions

View File

@ -592,6 +592,40 @@ void AISAPI::FetchCategoryCategories(const LLUUID &catId, ITEM_TYPE type, bool r
EnqueueAISCommand("FetchCategoryCategories", proc);
}
/*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)
{
@ -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
{

View File

@ -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;

View File

@ -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 &&

View File

@ -65,6 +65,7 @@ public:
bool inventoryFetchInProgress() const;
void findLostItems();
void fetchCOF();
void incrFetchCount(S32 fetching);
void incrFetchFolderCount(S32 fetching);

View File

@ -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