summaryrefslogtreecommitdiff
path: root/indra/newview/llaisapi.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-05-16 13:52:40 +0800
committerErik Kundiman <erik@megapahit.org>2024-05-16 13:52:40 +0800
commit6d51e91895a7f2435c46a876410ccc6c63fe8c82 (patch)
treef2b48ebd99cb414227bf365f47665b8d4baa752b /indra/newview/llaisapi.cpp
parentd1b5917bb9c92e4e47eba19b43781e4d1328b1ca (diff)
parent094dcc07f8c1d90ae723dbe60eddacb90a09eae8 (diff)
Merge tag '7.1.7-release'
source for viewer 7.1.7.8974243247
Diffstat (limited to 'indra/newview/llaisapi.cpp')
-rw-r--r--indra/newview/llaisapi.cpp968
1 files changed, 484 insertions, 484 deletions
diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index f23ce13608..76271571cd 100644
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llaisapi.cpp
- * @brief classes and functions for interfacing with the v3+ ais inventory service.
+ * @brief classes and functions for interfacing with the v3+ ais inventory service.
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*
@@ -95,7 +95,7 @@ std::string AISAPI::getLibCap()
return std::string();
}
-/*static*/
+/*static*/
void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, completion_t callback)
{
std::string cap = getInvCap();
@@ -115,15 +115,15 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c
std::string url = cap + std::string("/category/") + parentId.asString() + "?tid=" + tid.asString();
LL_DEBUGS("Inventory") << "url: " << url << " parentID " << parentId << " newInventory " << newInventory << LL_ENDL;
- // I may be suffering from golden hammer here, but the first part of this bind
- // is actually a static cast for &HttpCoroutineAdapter::postAndSuspend so that
+ // I may be suffering from golden hammer here, but the first part of this bind
+ // is actually a static cast for &HttpCoroutineAdapter::postAndSuspend so that
// the compiler can identify the correct signature to select.
- //
+ //
// Reads as follows:
// LLSD - method returning LLSD
// (LLCoreHttpUtil::HttpCoroutineAdapter::*) - pointer to member function of HttpCoroutineAdapter
// (LLCore::HttpRequest::ptr_t, const std::string &, const LLSD &, LLCore::HttpOptions::ptr_t, LLCore::HttpHeaders::ptr_t) - signature of method
- //
+ //
invokationFn_t postFn = boost::bind(
// Humans ignore next line. It is just a cast.
static_cast<LLSD (LLCoreHttpUtil::HttpCoroutineAdapter::*)(LLCore::HttpRequest::ptr_t, const std::string &, const LLSD &, LLCore::HttpOptions::ptr_t, LLCore::HttpHeaders::ptr_t)>
@@ -131,7 +131,7 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::postAndSuspend), _1, _2, _3, _4, _5, _6);
@@ -141,7 +141,7 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c
EnqueueAISCommand("CreateInventory", proc);
}
-/*static*/
+/*static*/
void AISAPI::SlamFolder(const LLUUID& folderId, const LLSD& newInventory, completion_t callback)
{
std::string cap = getInvCap();
@@ -168,7 +168,7 @@ void AISAPI::SlamFolder(const LLUUID& folderId, const LLSD& newInventory, comple
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::putAndSuspend), _1, _2, _3, _4, _5, _6);
@@ -204,7 +204,7 @@ void AISAPI::RemoveCategory(const LLUUID &categoryId, completion_t callback)
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::deleteAndSuspend), _1, _2, _3, _5, _6);
@@ -215,7 +215,7 @@ void AISAPI::RemoveCategory(const LLUUID &categoryId, completion_t callback)
EnqueueAISCommand("RemoveCategory", proc);
}
-/*static*/
+/*static*/
void AISAPI::RemoveItem(const LLUUID &itemId, completion_t callback)
{
std::string cap;
@@ -241,7 +241,7 @@ void AISAPI::RemoveItem(const LLUUID &itemId, completion_t callback)
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::deleteAndSuspend), _1, _2, _3, _5, _6);
@@ -288,18 +288,18 @@ void AISAPI::CopyLibraryCategory(const LLUUID& sourceId, const LLUUID& destId, b
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::copyAndSuspend), _1, _2, _3, destination, _5, _6);
-
+
LLCoprocedureManager::CoProcedure_t proc(boost::bind(&AISAPI::InvokeAISCommandCoro,
_1, copyFn, url, destId, LLSD(), callback, COPYLIBRARYCATEGORY));
EnqueueAISCommand("CopyLibraryCategory", proc);
}
-/*static*/
+/*static*/
void AISAPI::PurgeDescendents(const LLUUID &categoryId, completion_t callback)
{
std::string cap;
@@ -325,7 +325,7 @@ void AISAPI::PurgeDescendents(const LLUUID &categoryId, completion_t callback)
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::deleteAndSuspend), _1, _2, _3, _5, _6);
@@ -361,7 +361,7 @@ void AISAPI::UpdateCategory(const LLUUID &categoryId, const LLSD &updates, compl
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::patchAndSuspend), _1, _2, _3, _4, _5, _6);
@@ -397,7 +397,7 @@ void AISAPI::UpdateItem(const LLUUID &itemId, const LLSD &updates, completion_t
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::patchAndSuspend), _1, _2, _3, _4, _5, _6);
@@ -411,36 +411,36 @@ void AISAPI::UpdateItem(const LLUUID &itemId, const LLSD &updates, completion_t
/*static*/
void AISAPI::FetchItem(const LLUUID &itemId, ITEM_TYPE type, completion_t callback)
{
- std::string cap;
+ std::string cap;
- cap = (type == INVENTORY) ? getInvCap() : getLibCap();
- if (cap.empty())
- {
- LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL;
+ cap = (type == INVENTORY) ? getInvCap() : getLibCap();
+ if (cap.empty())
+ {
+ LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL;
if (callback)
{
callback(LLUUID::null);
}
- return;
- }
- std::string url = cap + std::string("/item/") + itemId.asString();
-
- 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, itemId, LLSD(), callback, FETCHITEM));
-
- EnqueueAISCommand("FetchItem", proc);
+ return;
+ }
+ std::string url = cap + std::string("/item/") + itemId.asString();
+
+ 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, itemId, LLSD(), callback, FETCHITEM));
+
+ EnqueueAISCommand("FetchItem", proc);
}
/*static*/
@@ -480,7 +480,7 @@ void AISAPI::FetchCategoryChildren(const LLUUID &catId, ITEM_TYPE type, bool rec
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
@@ -533,7 +533,7 @@ void AISAPI::FetchCategoryChildren(const std::string &identifier, bool recursive
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
@@ -584,7 +584,7 @@ void AISAPI::FetchCategoryCategories(const LLUUID &catId, ITEM_TYPE type, bool r
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
@@ -661,7 +661,7 @@ void AISAPI::FetchCategorySubset(const LLUUID& catId,
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
@@ -698,7 +698,7 @@ void AISAPI::FetchCOF(completion_t callback)
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
@@ -771,7 +771,7 @@ void AISAPI::FetchOrphans(completion_t callback)
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend) , _1 , _2 , _3 , _5 , _6);
@@ -824,7 +824,7 @@ void AISAPI::onIdle(void *userdata)
pending_in_pool++;
}
}
-
+
if (sPostponedQuery.empty())
{
// Nothing to do anymore
@@ -848,8 +848,8 @@ void AISAPI::onUpdateReceived(const LLSD& update, COMMAND_TYPE type, const LLSD&
}
/*static*/
-void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter,
- invokationFn_t invoke, std::string url,
+void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter,
+ invokationFn_t invoke, std::string url,
LLUUID targetId, LLSD body, completion_t callback, COMMAND_TYPE type)
{
if (gDisconnected)
@@ -947,7 +947,7 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
LL_WARNS("Inventory") << ll_pretty_print_sd(result) << LL_ENDL;
}
- LL_DEBUGS("Inventory", "AIS3") << "Result: " << result << LL_ENDL;
+ LL_DEBUGS("Inventory", "AIS3") << "Result: " << result << LL_ENDL;
onUpdateReceived(result, type, body);
if (callback && !callback.empty())
@@ -1038,22 +1038,22 @@ AISUpdate::AISUpdate(const LLSD& update, AISAPI::COMMAND_TYPE type, const LLSD&
mTimer.setTimerExpirySec(AIS_EXPIRY_SECONDS);
mTimer.start();
- parseUpdate(update);
+ parseUpdate(update);
}
void AISUpdate::clearParseResults()
{
- mCatDescendentDeltas.clear();
- mCatDescendentsKnown.clear();
- mCatVersionsUpdated.clear();
- mItemsCreated.clear();
+ mCatDescendentDeltas.clear();
+ mCatDescendentsKnown.clear();
+ mCatVersionsUpdated.clear();
+ mItemsCreated.clear();
mItemsLost.clear();
- mItemsUpdated.clear();
- mCategoriesCreated.clear();
- mCategoriesUpdated.clear();
- mObjectsDeletedIds.clear();
- mItemIds.clear();
- mCategoryIds.clear();
+ mItemsUpdated.clear();
+ mCategoriesCreated.clear();
+ mCategoriesUpdated.clear();
+ mObjectsDeletedIds.clear();
+ mItemIds.clear();
+ mCategoryIds.clear();
}
void AISUpdate::checkTimeout()
@@ -1068,87 +1068,87 @@ void AISUpdate::checkTimeout()
void AISUpdate::parseUpdate(const LLSD& update)
{
- clearParseResults();
- parseMeta(update);
- parseContent(update);
+ clearParseResults();
+ parseMeta(update);
+ parseContent(update);
}
void AISUpdate::parseMeta(const LLSD& update)
{
- // parse _categories_removed -> mObjectsDeletedIds
- uuid_list_t cat_ids;
- parseUUIDArray(update,"_categories_removed",cat_ids);
- for (uuid_list_t::const_iterator it = cat_ids.begin();
- it != cat_ids.end(); ++it)
- {
- LLViewerInventoryCategory *cat = gInventory.getCategory(*it);
- if(cat)
- {
- mCatDescendentDeltas[cat->getParentUUID()]--;
- mObjectsDeletedIds.insert(*it);
- }
- else
- {
- LL_WARNS("Inventory") << "removed category not found " << *it << LL_ENDL;
- }
- }
-
- // parse _categories_items_removed -> mObjectsDeletedIds
- uuid_list_t item_ids;
- parseUUIDArray(update,"_category_items_removed",item_ids);
- parseUUIDArray(update,"_removed_items",item_ids);
- for (uuid_list_t::const_iterator it = item_ids.begin();
- it != item_ids.end(); ++it)
- {
- LLViewerInventoryItem *item = gInventory.getItem(*it);
- if(item)
- {
- mCatDescendentDeltas[item->getParentUUID()]--;
- mObjectsDeletedIds.insert(*it);
- }
- else
- {
- LL_WARNS("Inventory") << "removed item not found " << *it << LL_ENDL;
- }
- }
-
- // parse _broken_links_removed -> mObjectsDeletedIds
- uuid_list_t broken_link_ids;
- parseUUIDArray(update,"_broken_links_removed",broken_link_ids);
- for (uuid_list_t::const_iterator it = broken_link_ids.begin();
- it != broken_link_ids.end(); ++it)
- {
- LLViewerInventoryItem *item = gInventory.getItem(*it);
- if(item)
- {
- mCatDescendentDeltas[item->getParentUUID()]--;
- mObjectsDeletedIds.insert(*it);
- }
- else
- {
- LL_WARNS("Inventory") << "broken link not found " << *it << LL_ENDL;
- }
- }
-
- // parse _created_items
- parseUUIDArray(update,"_created_items",mItemIds);
-
- // parse _created_categories
- parseUUIDArray(update,"_created_categories",mCategoryIds);
-
- // Parse updated category versions.
- const std::string& ucv = "_updated_category_versions";
- if (update.has(ucv))
- {
- for(LLSD::map_const_iterator it = update[ucv].beginMap(),
- end = update[ucv].endMap();
- it != end; ++it)
- {
- const LLUUID id((*it).first);
- S32 version = (*it).second.asInteger();
- mCatVersionsUpdated[id] = version;
- }
- }
+ // parse _categories_removed -> mObjectsDeletedIds
+ uuid_list_t cat_ids;
+ parseUUIDArray(update,"_categories_removed",cat_ids);
+ for (uuid_list_t::const_iterator it = cat_ids.begin();
+ it != cat_ids.end(); ++it)
+ {
+ LLViewerInventoryCategory *cat = gInventory.getCategory(*it);
+ if(cat)
+ {
+ mCatDescendentDeltas[cat->getParentUUID()]--;
+ mObjectsDeletedIds.insert(*it);
+ }
+ else
+ {
+ LL_WARNS("Inventory") << "removed category not found " << *it << LL_ENDL;
+ }
+ }
+
+ // parse _categories_items_removed -> mObjectsDeletedIds
+ uuid_list_t item_ids;
+ parseUUIDArray(update,"_category_items_removed",item_ids);
+ parseUUIDArray(update,"_removed_items",item_ids);
+ for (uuid_list_t::const_iterator it = item_ids.begin();
+ it != item_ids.end(); ++it)
+ {
+ LLViewerInventoryItem *item = gInventory.getItem(*it);
+ if(item)
+ {
+ mCatDescendentDeltas[item->getParentUUID()]--;
+ mObjectsDeletedIds.insert(*it);
+ }
+ else
+ {
+ LL_WARNS("Inventory") << "removed item not found " << *it << LL_ENDL;
+ }
+ }
+
+ // parse _broken_links_removed -> mObjectsDeletedIds
+ uuid_list_t broken_link_ids;
+ parseUUIDArray(update,"_broken_links_removed",broken_link_ids);
+ for (uuid_list_t::const_iterator it = broken_link_ids.begin();
+ it != broken_link_ids.end(); ++it)
+ {
+ LLViewerInventoryItem *item = gInventory.getItem(*it);
+ if(item)
+ {
+ mCatDescendentDeltas[item->getParentUUID()]--;
+ mObjectsDeletedIds.insert(*it);
+ }
+ else
+ {
+ LL_WARNS("Inventory") << "broken link not found " << *it << LL_ENDL;
+ }
+ }
+
+ // parse _created_items
+ parseUUIDArray(update,"_created_items",mItemIds);
+
+ // parse _created_categories
+ parseUUIDArray(update,"_created_categories",mCategoryIds);
+
+ // Parse updated category versions.
+ const std::string& ucv = "_updated_category_versions";
+ if (update.has(ucv))
+ {
+ for(LLSD::map_const_iterator it = update[ucv].beginMap(),
+ end = update[ucv].endMap();
+ it != end; ++it)
+ {
+ const LLUUID id((*it).first);
+ S32 version = (*it).second.asInteger();
+ mCatVersionsUpdated[id] = version;
+ }
+ }
}
void AISUpdate::parseContent(const LLSD& update)
@@ -1157,14 +1157,14 @@ void AISUpdate::parseContent(const LLSD& update)
// full item or folder.
// Todo: Depending on error we might want to do something,
// like removing a 404 item or refetching parent folder
- if (update.has("linked_id") && update.has("parent_id"))
- {
- parseLink(update, mFetchDepth);
- }
- else if (update.has("item_id") && update.has("parent_id"))
- {
- parseItem(update);
- }
+ if (update.has("linked_id") && update.has("parent_id"))
+ {
+ parseLink(update, mFetchDepth);
+ }
+ else if (update.has("item_id") && update.has("parent_id"))
+ {
+ parseItem(update);
+ }
if (mType == AISAPI::FETCHCATEGORYSUBSET)
{
@@ -1179,28 +1179,28 @@ void AISUpdate::parseContent(const LLSD& update)
{
parseCategory(update, mFetchDepth);
}
- else
- {
- if (update.has("_embedded"))
- {
- parseEmbedded(update["_embedded"], mFetchDepth);
- }
- }
+ else
+ {
+ if (update.has("_embedded"))
+ {
+ parseEmbedded(update["_embedded"], mFetchDepth);
+ }
+ }
}
void AISUpdate::parseItem(const LLSD& item_map)
{
- LLUUID item_id = item_map["item_id"].asUUID();
- LLPointer<LLViewerInventoryItem> new_item(new LLViewerInventoryItem);
- LLViewerInventoryItem *curr_item = gInventory.getItem(item_id);
- if (curr_item)
- {
- // Default to current values where not provided.
- new_item->copyViewerItem(curr_item);
- }
- BOOL rv = new_item->unpackMessage(item_map);
- if (rv)
- {
+ LLUUID item_id = item_map["item_id"].asUUID();
+ LLPointer<LLViewerInventoryItem> new_item(new LLViewerInventoryItem);
+ LLViewerInventoryItem *curr_item = gInventory.getItem(item_id);
+ if (curr_item)
+ {
+ // Default to current values where not provided.
+ new_item->copyViewerItem(curr_item);
+ }
+ BOOL rv = new_item->unpackMessage(item_map);
+ if (rv)
+ {
if (mFetch)
{
mItemsCreated[item_id] = new_item;
@@ -1212,41 +1212,41 @@ void AISUpdate::parseItem(const LLSD& item_map)
}
}
else if (curr_item)
- {
- mItemsUpdated[item_id] = new_item;
- // This statement is here to cause a new entry with 0
- // delta to be created if it does not already exist;
- // otherwise has no effect.
- mCatDescendentDeltas[new_item->getParentUUID()];
- }
- else
- {
- mItemsCreated[item_id] = new_item;
- mCatDescendentDeltas[new_item->getParentUUID()]++;
+ {
+ mItemsUpdated[item_id] = new_item;
+ // This statement is here to cause a new entry with 0
+ // delta to be created if it does not already exist;
+ // otherwise has no effect.
+ mCatDescendentDeltas[new_item->getParentUUID()];
+ }
+ else
+ {
+ mItemsCreated[item_id] = new_item;
+ mCatDescendentDeltas[new_item->getParentUUID()]++;
new_item->setComplete(true);
- }
- }
- else
- {
- // *TODO: Wow, harsh. Should we just complain and get out?
- LL_ERRS() << "unpack failed" << LL_ENDL;
- }
+ }
+ }
+ else
+ {
+ // *TODO: Wow, harsh. Should we just complain and get out?
+ LL_ERRS() << "unpack failed" << LL_ENDL;
+ }
}
void AISUpdate::parseLink(const LLSD& link_map, S32 depth)
{
- LLUUID item_id = link_map["item_id"].asUUID();
- LLPointer<LLViewerInventoryItem> new_link(new LLViewerInventoryItem);
- LLViewerInventoryItem *curr_link = gInventory.getItem(item_id);
- if (curr_link)
- {
- // Default to current values where not provided.
- new_link->copyViewerItem(curr_link);
- }
- BOOL rv = new_link->unpackMessage(link_map);
- if (rv)
- {
- const LLUUID& parent_id = new_link->getParentUUID();
+ LLUUID item_id = link_map["item_id"].asUUID();
+ LLPointer<LLViewerInventoryItem> new_link(new LLViewerInventoryItem);
+ LLViewerInventoryItem *curr_link = gInventory.getItem(item_id);
+ if (curr_link)
+ {
+ // Default to current values where not provided.
+ new_link->copyViewerItem(curr_link);
+ }
+ BOOL rv = new_link->unpackMessage(link_map);
+ if (rv)
+ {
+ const LLUUID& parent_id = new_link->getParentUUID();
if (mFetch)
{
LLPermissions default_perms;
@@ -1264,38 +1264,38 @@ void AISUpdate::parseLink(const LLSD& link_map, S32 depth)
mItemsLost[item_id] = new_link;
}
}
- else if (curr_link)
- {
- mItemsUpdated[item_id] = new_link;
- // This statement is here to cause a new entry with 0
- // delta to be created if it does not already exist;
- // otherwise has no effect.
- mCatDescendentDeltas[parent_id];
- }
- else
- {
- LLPermissions default_perms;
- default_perms.init(gAgent.getID(),gAgent.getID(),LLUUID::null,LLUUID::null);
- default_perms.initMasks(PERM_NONE,PERM_NONE,PERM_NONE,PERM_NONE,PERM_NONE);
- new_link->setPermissions(default_perms);
- LLSaleInfo default_sale_info;
- new_link->setSaleInfo(default_sale_info);
- //LL_DEBUGS("Inventory") << "creating link from llsd: " << ll_pretty_print_sd(link_map) << LL_ENDL;
- mItemsCreated[item_id] = new_link;
- mCatDescendentDeltas[parent_id]++;
+ else if (curr_link)
+ {
+ mItemsUpdated[item_id] = new_link;
+ // This statement is here to cause a new entry with 0
+ // delta to be created if it does not already exist;
+ // otherwise has no effect.
+ mCatDescendentDeltas[parent_id];
+ }
+ else
+ {
+ LLPermissions default_perms;
+ default_perms.init(gAgent.getID(),gAgent.getID(),LLUUID::null,LLUUID::null);
+ default_perms.initMasks(PERM_NONE,PERM_NONE,PERM_NONE,PERM_NONE,PERM_NONE);
+ new_link->setPermissions(default_perms);
+ LLSaleInfo default_sale_info;
+ new_link->setSaleInfo(default_sale_info);
+ //LL_DEBUGS("Inventory") << "creating link from llsd: " << ll_pretty_print_sd(link_map) << LL_ENDL;
+ mItemsCreated[item_id] = new_link;
+ mCatDescendentDeltas[parent_id]++;
new_link->setComplete(true);
- }
+ }
if (link_map.has("_embedded"))
{
parseEmbedded(link_map["_embedded"], depth);
}
- }
- else
- {
- // *TODO: Wow, harsh. Should we just complain and get out?
- LL_ERRS() << "unpack failed" << LL_ENDL;
- }
+ }
+ else
+ {
+ // *TODO: Wow, harsh. Should we just complain and get out?
+ LL_ERRS() << "unpack failed" << LL_ENDL;
+ }
}
@@ -1322,10 +1322,10 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth)
return;
}
- LLPointer<LLViewerInventoryCategory> new_cat;
- if (curr_cat)
- {
- // Default to current values where not provided.
+ LLPointer<LLViewerInventoryCategory> new_cat;
+ if (curr_cat)
+ {
+ // Default to current values where not provided.
new_cat = new LLViewerInventoryCategory(curr_cat);
}
else
@@ -1340,10 +1340,10 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth)
new_cat = new LLViewerInventoryCategory(LLUUID::null);
}
}
- BOOL rv = new_cat->unpackMessage(category_map);
- // *NOTE: unpackMessage does not unpack version or descendent count.
- if (rv)
- {
+ BOOL rv = new_cat->unpackMessage(category_map);
+ // *NOTE: unpackMessage does not unpack version or descendent count.
+ if (rv)
+ {
// Check descendent count first, as it may be needed
// to populate newly created categories
if (category_map.has("_embedded"))
@@ -1393,19 +1393,19 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth)
}
mCategoriesCreated[category_id] = new_cat;
}
- else if (curr_cat)
- {
- mCategoriesUpdated[category_id] = new_cat;
- // This statement is here to cause a new entry with 0
- // delta to be created if it does not already exist;
- // otherwise has no effect.
- mCatDescendentDeltas[new_cat->getParentUUID()];
- // Capture update for the category itself as well.
- mCatDescendentDeltas[category_id];
- }
- else
- {
- // Set version/descendents for newly created categories.
+ else if (curr_cat)
+ {
+ mCategoriesUpdated[category_id] = new_cat;
+ // This statement is here to cause a new entry with 0
+ // delta to be created if it does not already exist;
+ // otherwise has no effect.
+ mCatDescendentDeltas[new_cat->getParentUUID()];
+ // Capture update for the category itself as well.
+ mCatDescendentDeltas[category_id];
+ }
+ else
+ {
+ // Set version/descendents for newly created categories.
uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id);
if (mCatDescendentsKnown.end() != lookup_it)
{
@@ -1422,22 +1422,22 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth)
<< " for new category " << category_id << LL_ENDL;
new_cat->setVersion(version);
}
- }
- mCategoriesCreated[category_id] = new_cat;
- mCatDescendentDeltas[new_cat->getParentUUID()]++;
- }
- }
- else
- {
- // *TODO: Wow, harsh. Should we just complain and get out?
- LL_ERRS() << "unpack failed" << LL_ENDL;
- }
-
- // Check for more embedded content.
- if (category_map.has("_embedded"))
- {
- parseEmbedded(category_map["_embedded"], depth - 1);
- }
+ }
+ mCategoriesCreated[category_id] = new_cat;
+ mCatDescendentDeltas[new_cat->getParentUUID()]++;
+ }
+ }
+ else
+ {
+ // *TODO: Wow, harsh. Should we just complain and get out?
+ LL_ERRS() << "unpack failed" << LL_ENDL;
+ }
+
+ // Check for more embedded content.
+ if (category_map.has("_embedded"))
+ {
+ parseEmbedded(category_map["_embedded"], depth - 1);
+ }
}
void AISUpdate::parseDescendentCount(const LLUUID& category_id, LLFolderType::EType type, const LLSD& embedded)
@@ -1462,178 +1462,178 @@ void AISUpdate::parseEmbedded(const LLSD& embedded, S32 depth)
{
checkTimeout();
- if (embedded.has("links")) // _embedded in a category
- {
- parseEmbeddedLinks(embedded["links"], depth);
- }
- if (embedded.has("items")) // _embedded in a category
- {
- parseEmbeddedItems(embedded["items"]);
- }
- if (embedded.has("item")) // _embedded in a link
- {
- parseEmbeddedItem(embedded["item"]);
- }
- if (embedded.has("categories")) // _embedded in a category
- {
- parseEmbeddedCategories(embedded["categories"], depth);
- }
- if (embedded.has("category")) // _embedded in a link
- {
- parseEmbeddedCategory(embedded["category"], depth);
- }
+ if (embedded.has("links")) // _embedded in a category
+ {
+ parseEmbeddedLinks(embedded["links"], depth);
+ }
+ if (embedded.has("items")) // _embedded in a category
+ {
+ parseEmbeddedItems(embedded["items"]);
+ }
+ if (embedded.has("item")) // _embedded in a link
+ {
+ parseEmbeddedItem(embedded["item"]);
+ }
+ if (embedded.has("categories")) // _embedded in a category
+ {
+ parseEmbeddedCategories(embedded["categories"], depth);
+ }
+ if (embedded.has("category")) // _embedded in a link
+ {
+ parseEmbeddedCategory(embedded["category"], depth);
+ }
}
void AISUpdate::parseUUIDArray(const LLSD& content, const std::string& name, uuid_list_t& ids)
{
- if (content.has(name))
- {
- for(LLSD::array_const_iterator it = content[name].beginArray(),
- end = content[name].endArray();
- it != end; ++it)
- {
- ids.insert((*it).asUUID());
- }
- }
+ if (content.has(name))
+ {
+ for(LLSD::array_const_iterator it = content[name].beginArray(),
+ end = content[name].endArray();
+ it != end; ++it)
+ {
+ ids.insert((*it).asUUID());
+ }
+ }
}
void AISUpdate::parseEmbeddedLinks(const LLSD& links, S32 depth)
{
- for(LLSD::map_const_iterator linkit = links.beginMap(),
- linkend = links.endMap();
- linkit != linkend; ++linkit)
- {
- const LLUUID link_id((*linkit).first);
- const LLSD& link_map = (*linkit).second;
- if (!mFetch && mItemIds.end() == mItemIds.find(link_id))
- {
- LL_DEBUGS("Inventory") << "Ignoring link not in items list " << link_id << LL_ENDL;
- }
- else
- {
- parseLink(link_map, depth);
- }
- }
+ for(LLSD::map_const_iterator linkit = links.beginMap(),
+ linkend = links.endMap();
+ linkit != linkend; ++linkit)
+ {
+ const LLUUID link_id((*linkit).first);
+ const LLSD& link_map = (*linkit).second;
+ if (!mFetch && mItemIds.end() == mItemIds.find(link_id))
+ {
+ LL_DEBUGS("Inventory") << "Ignoring link not in items list " << link_id << LL_ENDL;
+ }
+ else
+ {
+ parseLink(link_map, depth);
+ }
+ }
}
void AISUpdate::parseEmbeddedItem(const LLSD& item)
{
- // a single item (_embedded in a link)
- if (item.has("item_id"))
- {
- if (mFetch || mItemIds.end() != mItemIds.find(item["item_id"].asUUID()))
- {
- parseItem(item);
- }
- }
+ // a single item (_embedded in a link)
+ if (item.has("item_id"))
+ {
+ if (mFetch || mItemIds.end() != mItemIds.find(item["item_id"].asUUID()))
+ {
+ parseItem(item);
+ }
+ }
}
void AISUpdate::parseEmbeddedItems(const LLSD& items)
{
- // a map of items (_embedded in a category)
- for(LLSD::map_const_iterator itemit = items.beginMap(),
- itemend = items.endMap();
- itemit != itemend; ++itemit)
- {
- const LLUUID item_id((*itemit).first);
- const LLSD& item_map = (*itemit).second;
- if (!mFetch && mItemIds.end() == mItemIds.find(item_id))
- {
- LL_DEBUGS("Inventory") << "Ignoring item not in items list " << item_id << LL_ENDL;
- }
- else
- {
- parseItem(item_map);
- }
- }
+ // a map of items (_embedded in a category)
+ for(LLSD::map_const_iterator itemit = items.beginMap(),
+ itemend = items.endMap();
+ itemit != itemend; ++itemit)
+ {
+ const LLUUID item_id((*itemit).first);
+ const LLSD& item_map = (*itemit).second;
+ if (!mFetch && mItemIds.end() == mItemIds.find(item_id))
+ {
+ LL_DEBUGS("Inventory") << "Ignoring item not in items list " << item_id << LL_ENDL;
+ }
+ else
+ {
+ parseItem(item_map);
+ }
+ }
}
void AISUpdate::parseEmbeddedCategory(const LLSD& category, S32 depth)
{
- // a single category (_embedded in a link)
- if (category.has("category_id"))
- {
- if (mFetch || mCategoryIds.end() != mCategoryIds.find(category["category_id"].asUUID()))
- {
- parseCategory(category, depth);
- }
- }
+ // a single category (_embedded in a link)
+ if (category.has("category_id"))
+ {
+ if (mFetch || mCategoryIds.end() != mCategoryIds.find(category["category_id"].asUUID()))
+ {
+ parseCategory(category, depth);
+ }
+ }
}
void AISUpdate::parseEmbeddedCategories(const LLSD& categories, S32 depth)
{
- // a map of categories (_embedded in a category)
- for(LLSD::map_const_iterator categoryit = categories.beginMap(),
- categoryend = categories.endMap();
- categoryit != categoryend; ++categoryit)
- {
- const LLUUID category_id((*categoryit).first);
- const LLSD& category_map = (*categoryit).second;
- if (!mFetch && mCategoryIds.end() == mCategoryIds.find(category_id))
- {
- LL_DEBUGS("Inventory") << "Ignoring category not in categories list " << category_id << LL_ENDL;
- }
- else
- {
- parseCategory(category_map, depth);
- }
- }
+ // a map of categories (_embedded in a category)
+ for(LLSD::map_const_iterator categoryit = categories.beginMap(),
+ categoryend = categories.endMap();
+ categoryit != categoryend; ++categoryit)
+ {
+ const LLUUID category_id((*categoryit).first);
+ const LLSD& category_map = (*categoryit).second;
+ if (!mFetch && mCategoryIds.end() == mCategoryIds.find(category_id))
+ {
+ LL_DEBUGS("Inventory") << "Ignoring category not in categories list " << category_id << LL_ENDL;
+ }
+ else
+ {
+ parseCategory(category_map, depth);
+ }
+ }
}
void AISUpdate::doUpdate()
{
checkTimeout();
- // Do version/descendant accounting.
- for (std::map<LLUUID,S32>::const_iterator catit = mCatDescendentDeltas.begin();
- catit != mCatDescendentDeltas.end(); ++catit)
- {
- LL_DEBUGS("Inventory") << "descendant accounting for " << catit->first << LL_ENDL;
-
- const LLUUID cat_id(catit->first);
- // Don't account for update if we just created this category.
- if (mCategoriesCreated.find(cat_id) != mCategoriesCreated.end())
- {
- LL_DEBUGS("Inventory") << "Skipping version increment for new category " << cat_id << LL_ENDL;
- continue;
- }
-
- // Don't account for update unless AIS told us it updated that category.
- if (mCatVersionsUpdated.find(cat_id) == mCatVersionsUpdated.end())
- {
- LL_DEBUGS("Inventory") << "Skipping version increment for non-updated category " << cat_id << LL_ENDL;
- continue;
- }
-
- // If we have a known descendant count, set that now.
- LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
- if (cat)
- {
- S32 descendent_delta = catit->second;
- S32 old_count = cat->getDescendentCount();
- LL_DEBUGS("Inventory") << "Updating descendant count for "
- << cat->getName() << " " << cat_id
- << " with delta " << descendent_delta << " from "
- << old_count << " to " << (old_count+descendent_delta) << LL_ENDL;
- LLInventoryModel::LLCategoryUpdate up(cat_id, descendent_delta);
- gInventory.accountForUpdate(up);
- }
- else
- {
- LL_DEBUGS("Inventory") << "Skipping version accounting for unknown category " << cat_id << LL_ENDL;
- }
- }
-
- // CREATE CATEGORIES
+ // Do version/descendant accounting.
+ for (std::map<LLUUID,S32>::const_iterator catit = mCatDescendentDeltas.begin();
+ catit != mCatDescendentDeltas.end(); ++catit)
+ {
+ LL_DEBUGS("Inventory") << "descendant accounting for " << catit->first << LL_ENDL;
+
+ const LLUUID cat_id(catit->first);
+ // Don't account for update if we just created this category.
+ if (mCategoriesCreated.find(cat_id) != mCategoriesCreated.end())
+ {
+ LL_DEBUGS("Inventory") << "Skipping version increment for new category " << cat_id << LL_ENDL;
+ continue;
+ }
+
+ // Don't account for update unless AIS told us it updated that category.
+ if (mCatVersionsUpdated.find(cat_id) == mCatVersionsUpdated.end())
+ {
+ LL_DEBUGS("Inventory") << "Skipping version increment for non-updated category " << cat_id << LL_ENDL;
+ continue;
+ }
+
+ // If we have a known descendant count, set that now.
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if (cat)
+ {
+ S32 descendent_delta = catit->second;
+ S32 old_count = cat->getDescendentCount();
+ LL_DEBUGS("Inventory") << "Updating descendant count for "
+ << cat->getName() << " " << cat_id
+ << " with delta " << descendent_delta << " from "
+ << old_count << " to " << (old_count+descendent_delta) << LL_ENDL;
+ LLInventoryModel::LLCategoryUpdate up(cat_id, descendent_delta);
+ gInventory.accountForUpdate(up);
+ }
+ else
+ {
+ LL_DEBUGS("Inventory") << "Skipping version accounting for unknown category " << cat_id << LL_ENDL;
+ }
+ }
+
+ // CREATE CATEGORIES
const S32 MAX_UPDATE_BACKLOG = 50; // stall prevention
- for (deferred_category_map_t::const_iterator create_it = mCategoriesCreated.begin();
- create_it != mCategoriesCreated.end(); ++create_it)
- {
- LLUUID category_id(create_it->first);
- LLPointer<LLViewerInventoryCategory> new_category = create_it->second;
+ for (deferred_category_map_t::const_iterator create_it = mCategoriesCreated.begin();
+ create_it != mCategoriesCreated.end(); ++create_it)
+ {
+ LLUUID category_id(create_it->first);
+ LLPointer<LLViewerInventoryCategory> new_category = create_it->second;
- gInventory.updateCategory(new_category, LLInventoryObserver::CREATE);
- LL_DEBUGS("Inventory") << "created category " << category_id << LL_ENDL;
+ gInventory.updateCategory(new_category, LLInventoryObserver::CREATE);
+ LL_DEBUGS("Inventory") << "created category " << category_id << LL_ENDL;
// fetching can receive massive amount of items and folders
if (gInventory.getChangedIDs().size() > MAX_UPDATE_BACKLOG)
@@ -1641,29 +1641,29 @@ void AISUpdate::doUpdate()
gInventory.notifyObservers();
checkTimeout();
}
- }
-
- // UPDATE CATEGORIES
- for (deferred_category_map_t::const_iterator update_it = mCategoriesUpdated.begin();
- update_it != mCategoriesUpdated.end(); ++update_it)
- {
- LLUUID category_id(update_it->first);
- LLPointer<LLViewerInventoryCategory> new_category = update_it->second;
- // Since this is a copy of the category *before* the accounting update, above,
- // we need to transfer back the updated version/descendant count.
- LLViewerInventoryCategory* curr_cat = gInventory.getCategory(new_category->getUUID());
- if (!curr_cat)
- {
- LL_WARNS("Inventory") << "Failed to update unknown category " << new_category->getUUID() << LL_ENDL;
- }
- else
- {
- new_category->setVersion(curr_cat->getVersion());
- new_category->setDescendentCount(curr_cat->getDescendentCount());
- gInventory.updateCategory(new_category);
- LL_DEBUGS("Inventory") << "updated category " << new_category->getName() << " " << category_id << LL_ENDL;
- }
- }
+ }
+
+ // UPDATE CATEGORIES
+ for (deferred_category_map_t::const_iterator update_it = mCategoriesUpdated.begin();
+ update_it != mCategoriesUpdated.end(); ++update_it)
+ {
+ LLUUID category_id(update_it->first);
+ LLPointer<LLViewerInventoryCategory> new_category = update_it->second;
+ // Since this is a copy of the category *before* the accounting update, above,
+ // we need to transfer back the updated version/descendant count.
+ LLViewerInventoryCategory* curr_cat = gInventory.getCategory(new_category->getUUID());
+ if (!curr_cat)
+ {
+ LL_WARNS("Inventory") << "Failed to update unknown category " << new_category->getUUID() << LL_ENDL;
+ }
+ else
+ {
+ new_category->setVersion(curr_cat->getVersion());
+ new_category->setDescendentCount(curr_cat->getDescendentCount());
+ gInventory.updateCategory(new_category);
+ LL_DEBUGS("Inventory") << "updated category " << new_category->getName() << " " << category_id << LL_ENDL;
+ }
+ }
// LOST ITEMS
if (!mItemsLost.empty())
@@ -1683,18 +1683,18 @@ void AISUpdate::doUpdate()
}
}
- // CREATE ITEMS
- for (deferred_item_map_t::const_iterator create_it = mItemsCreated.begin();
- create_it != mItemsCreated.end(); ++create_it)
- {
- LLUUID item_id(create_it->first);
- LLPointer<LLViewerInventoryItem> new_item = create_it->second;
+ // CREATE ITEMS
+ for (deferred_item_map_t::const_iterator create_it = mItemsCreated.begin();
+ create_it != mItemsCreated.end(); ++create_it)
+ {
+ LLUUID item_id(create_it->first);
+ LLPointer<LLViewerInventoryItem> new_item = create_it->second;
- // FIXME risky function since it calls updateServer() in some
- // cases. Maybe break out the update/create cases, in which
- // case this is create.
- LL_DEBUGS("Inventory") << "created item " << item_id << LL_ENDL;
- gInventory.updateItem(new_item, LLInventoryObserver::CREATE);
+ // FIXME risky function since it calls updateServer() in some
+ // cases. Maybe break out the update/create cases, in which
+ // case this is create.
+ LL_DEBUGS("Inventory") << "created item " << item_id << LL_ENDL;
+ gInventory.updateItem(new_item, LLInventoryObserver::CREATE);
// fetching can receive massive amount of items and folders
if (gInventory.getChangedIDs().size() > MAX_UPDATE_BACKLOG)
@@ -1702,48 +1702,48 @@ void AISUpdate::doUpdate()
gInventory.notifyObservers();
checkTimeout();
}
- }
-
- // UPDATE ITEMS
- for (deferred_item_map_t::const_iterator update_it = mItemsUpdated.begin();
- update_it != mItemsUpdated.end(); ++update_it)
- {
- LLUUID item_id(update_it->first);
- LLPointer<LLViewerInventoryItem> new_item = update_it->second;
- // FIXME risky function since it calls updateServer() in some
- // cases. Maybe break out the update/create cases, in which
- // case this is update.
- LL_DEBUGS("Inventory") << "updated item " << item_id << LL_ENDL;
- //LL_DEBUGS("Inventory") << ll_pretty_print_sd(new_item->asLLSD()) << LL_ENDL;
- gInventory.updateItem(new_item);
- }
-
- // DELETE OBJECTS
- for (uuid_list_t::const_iterator del_it = mObjectsDeletedIds.begin();
- del_it != mObjectsDeletedIds.end(); ++del_it)
- {
- LL_DEBUGS("Inventory") << "deleted item " << *del_it << LL_ENDL;
- gInventory.onObjectDeletedFromServer(*del_it, false, false, false);
- }
-
- // TODO - how can we use this version info? Need to be sure all
- // changes are going through AIS first, or at least through
- // something with a reliable responder.
- for (uuid_int_map_t::iterator ucv_it = mCatVersionsUpdated.begin();
- ucv_it != mCatVersionsUpdated.end(); ++ucv_it)
- {
- const LLUUID id = ucv_it->first;
- S32 version = ucv_it->second;
- LLViewerInventoryCategory *cat = gInventory.getCategory(id);
- LL_DEBUGS("Inventory") << "cat version update " << cat->getName() << " to version " << cat->getVersion() << LL_ENDL;
- if (cat->getVersion() != version)
- {
- // the AIS version should be considered the true version. Adjust
- // our local category model to reflect this version number. Otherwise
- // it becomes possible to get stuck with the viewer being out of
- // sync with the inventory system. Under normal circumstances
- // inventory COF is maintained on the viewer through calls to
- // LLInventoryModel::accountForUpdate when a changing operation
+ }
+
+ // UPDATE ITEMS
+ for (deferred_item_map_t::const_iterator update_it = mItemsUpdated.begin();
+ update_it != mItemsUpdated.end(); ++update_it)
+ {
+ LLUUID item_id(update_it->first);
+ LLPointer<LLViewerInventoryItem> new_item = update_it->second;
+ // FIXME risky function since it calls updateServer() in some
+ // cases. Maybe break out the update/create cases, in which
+ // case this is update.
+ LL_DEBUGS("Inventory") << "updated item " << item_id << LL_ENDL;
+ //LL_DEBUGS("Inventory") << ll_pretty_print_sd(new_item->asLLSD()) << LL_ENDL;
+ gInventory.updateItem(new_item);
+ }
+
+ // DELETE OBJECTS
+ for (uuid_list_t::const_iterator del_it = mObjectsDeletedIds.begin();
+ del_it != mObjectsDeletedIds.end(); ++del_it)
+ {
+ LL_DEBUGS("Inventory") << "deleted item " << *del_it << LL_ENDL;
+ gInventory.onObjectDeletedFromServer(*del_it, false, false, false);
+ }
+
+ // TODO - how can we use this version info? Need to be sure all
+ // changes are going through AIS first, or at least through
+ // something with a reliable responder.
+ for (uuid_int_map_t::iterator ucv_it = mCatVersionsUpdated.begin();
+ ucv_it != mCatVersionsUpdated.end(); ++ucv_it)
+ {
+ const LLUUID id = ucv_it->first;
+ S32 version = ucv_it->second;
+ LLViewerInventoryCategory *cat = gInventory.getCategory(id);
+ LL_DEBUGS("Inventory") << "cat version update " << cat->getName() << " to version " << cat->getVersion() << LL_ENDL;
+ if (cat->getVersion() != version)
+ {
+ // the AIS version should be considered the true version. Adjust
+ // our local category model to reflect this version number. Otherwise
+ // it becomes possible to get stuck with the viewer being out of
+ // sync with the inventory system. Under normal circumstances
+ // inventory COF is maintained on the viewer through calls to
+ // LLInventoryModel::accountForUpdate when a changing operation
// is performed. This occasionally gets out of sync however.
if (version != LLViewerInventoryCategory::VERSION_UNKNOWN)
{
@@ -1765,11 +1765,11 @@ void AISUpdate::doUpdate()
const S32 LONG_EXPIRY = 360;
cat->fetch(LONG_EXPIRY);
}
- }
- }
+ }
+ }
checkTimeout();
- gInventory.notifyObservers();
+ gInventory.notifyObservers();
}