summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryobserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventoryobserver.cpp')
-rw-r--r--indra/newview/llinventoryobserver.cpp121
1 files changed, 93 insertions, 28 deletions
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 62c2d80609..922fcc16c0 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -77,7 +77,7 @@ void LLInventoryCompletionObserver::changed(U32 mask)
// appropriate.
if(!mIncomplete.empty())
{
- for(item_ref_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
+ for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
{
LLViewerInventoryItem* item = gInventory.getItem(*it);
if(!item)
@@ -108,6 +108,10 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id)
}
}
+LLInventoryFetchObserver::LLInventoryFetchObserver(bool retry_if_missing) :
+ mRetryIfMissing(retry_if_missing)
+{
+}
void LLInventoryFetchObserver::changed(U32 mask)
{
@@ -115,7 +119,7 @@ void LLInventoryFetchObserver::changed(U32 mask)
// appropriate.
if(!mIncomplete.empty())
{
- for(item_ref_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
+ for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
{
LLViewerInventoryItem* item = gInventory.getItem(*it);
if(!item)
@@ -219,12 +223,11 @@ void fetch_items_from_llsd(const LLSD& items_llsd)
}
}
-void LLInventoryFetchObserver::fetchItems(
- const LLInventoryFetchObserver::item_ref_t& ids)
+void LLInventoryFetchObserver::fetch(const uuid_vec_t& ids)
{
LLUUID owner_id;
LLSD items_llsd;
- for(item_ref_t::const_iterator it = ids.begin(); it < ids.end(); ++it)
+ for(uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); ++it)
{
LLViewerInventoryItem* item = gInventory.getItem(*it);
if(item)
@@ -262,50 +265,49 @@ void LLInventoryFetchObserver::fetchItems(
// virtual
void LLInventoryFetchDescendentsObserver::changed(U32 mask)
{
- for(folder_ref_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();)
+ for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end();)
{
LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
if(!cat)
{
- it = mIncompleteFolders.erase(it);
+ it = mIncomplete.erase(it);
continue;
}
if(isComplete(cat))
{
- mCompleteFolders.push_back(*it);
- it = mIncompleteFolders.erase(it);
+ mComplete.push_back(*it);
+ it = mIncomplete.erase(it);
continue;
}
++it;
}
- if(mIncompleteFolders.empty())
+ if(mIncomplete.empty())
{
done();
}
}
-void LLInventoryFetchDescendentsObserver::fetchDescendents(
- const folder_ref_t& ids)
+void LLInventoryFetchDescendentsObserver::fetch(const uuid_vec_t& ids)
{
- for(folder_ref_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
{
LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
if(!cat) continue;
if(!isComplete(cat))
{
- cat->fetchDescendents(); //blindly fetch it without seeing if anything else is fetching it.
- mIncompleteFolders.push_back(*it); //Add to list of things being downloaded for this observer.
+ cat->fetch(); //blindly fetch it without seeing if anything else is fetching it.
+ mIncomplete.push_back(*it); //Add to list of things being downloaded for this observer.
}
else
{
- mCompleteFolders.push_back(*it);
+ mComplete.push_back(*it);
}
}
}
bool LLInventoryFetchDescendentsObserver::isEverythingComplete() const
{
- return mIncompleteFolders.empty();
+ return mIncomplete.empty();
}
bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory* cat)
@@ -355,7 +357,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask)
{
if(!mIncompleteItems.empty())
{
- for(item_ref_t::iterator it = mIncompleteItems.begin(); it < mIncompleteItems.end(); )
+ for(uuid_vec_t::iterator it = mIncompleteItems.begin(); it < mIncompleteItems.end(); )
{
LLViewerInventoryItem* item = gInventory.getItem(*it);
if(!item)
@@ -364,7 +366,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask)
continue;
}
if(item->isComplete())
- {
+ {
mCompleteItems.push_back(*it);
it = mIncompleteItems.erase(it);
continue;
@@ -374,7 +376,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask)
}
if(!mIncompleteFolders.empty())
{
- for(folder_ref_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();)
+ for(uuid_vec_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();)
{
LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
if(!cat)
@@ -399,17 +401,17 @@ void LLInventoryFetchComboObserver::changed(U32 mask)
}
void LLInventoryFetchComboObserver::fetch(
- const folder_ref_t& folder_ids,
- const item_ref_t& item_ids)
+ const uuid_vec_t& folder_ids,
+ const uuid_vec_t& item_ids)
{
lldebugs << "LLInventoryFetchComboObserver::fetch()" << llendl;
- for(folder_ref_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit)
+ for(uuid_vec_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit)
{
LLViewerInventoryCategory* cat = gInventory.getCategory(*fit);
if(!cat) continue;
if(!gInventory.isCategoryComplete(*fit))
{
- cat->fetchDescendents();
+ cat->fetch();
lldebugs << "fetching folder " << *fit <<llendl;
mIncompleteFolders.push_back(*fit);
}
@@ -426,7 +428,7 @@ void LLInventoryFetchComboObserver::fetch(
// have to fetch it individually.
LLSD items_llsd;
LLUUID owner_id;
- for(item_ref_t::const_iterator iit = item_ids.begin(); iit != item_ids.end(); ++iit)
+ for(uuid_vec_t::const_iterator iit = item_ids.begin(); iit != item_ids.end(); ++iit)
{
LLViewerInventoryItem* item = gInventory.getItem(*iit);
if(!item)
@@ -475,7 +477,7 @@ void LLInventoryExistenceObserver::changed(U32 mask)
// appropriate.
if(!mMIA.empty())
{
- for(item_ref_t::iterator it = mMIA.begin(); it < mMIA.end(); )
+ for(uuid_vec_t::iterator it = mMIA.begin(); it < mMIA.end(); )
{
LLViewerInventoryItem* item = gInventory.getItem(*it);
if(!item)
@@ -493,6 +495,69 @@ void LLInventoryExistenceObserver::changed(U32 mask)
}
}
+void LLInventoryMoveFromWorldObserver::changed(U32 mask)
+{
+ if(!(mask & LLInventoryObserver::ADD))
+ {
+ return;
+ }
+
+ // nothing is watched
+ if (mWatchedAssets.size() == 0)
+ {
+ return;
+ }
+
+ LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem;
+ LLMessageSystem* msg = gMessageSystem;
+ S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
+ for(S32 i = 0; i < num_blocks; ++i)
+ {
+ item->unpackMessage(msg, _PREHASH_InventoryData, i);
+ const LLUUID& asset_uuid = item->getAssetUUID();
+ if (item->getUUID().notNull() && asset_uuid.notNull())
+ {
+ if (isAssetWatched(asset_uuid))
+ {
+ LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL;
+ mAddedItems.push_back(item->getUUID());
+ }
+ }
+ }
+
+ if (mAddedItems.size() == mWatchedAssets.size())
+ {
+ done();
+ LL_DEBUGS("Inventory_Move") << "All watched items are added & processed." << LL_ENDL;
+ mAddedItems.clear();
+
+ // Unable to clean watched items here due to somebody can require to check them in current frame.
+ // set dirty state to clean them while next watch cycle.
+ mIsDirty = true;
+ }
+}
+
+void LLInventoryMoveFromWorldObserver::watchAsset(const LLUUID& asset_id)
+{
+ if(asset_id.notNull())
+ {
+ if (mIsDirty)
+ {
+ LL_DEBUGS("Inventory_Move") << "Watched items are dirty. Clean them." << LL_ENDL;
+ mWatchedAssets.clear();
+ mIsDirty = false;
+ }
+
+ mWatchedAssets.push_back(asset_id);
+ onAssetAdded(asset_id);
+ }
+}
+
+bool LLInventoryMoveFromWorldObserver::isAssetWatched( const LLUUID& asset_id )
+{
+ return std::find(mWatchedAssets.begin(), mWatchedAssets.end(), asset_id) != mWatchedAssets.end();
+}
+
void LLInventoryAddedObserver::changed(U32 mask)
{
if(!(mask & LLInventoryObserver::ADD))
@@ -564,8 +629,8 @@ void LLInventoryTransactionObserver::changed(U32 mask)
if(id == mTransactionID)
{
// woo hoo, we found it
- folder_ref_t folders;
- item_ref_t items;
+ uuid_vec_t folders;
+ uuid_vec_t items;
S32 count;
count = msg->getNumberOfBlocksFast(_PREHASH_FolderData);
S32 i;