void LLInventoryFetchDescendentsObserver::fetchDescendents( const folder_ref_t& ids) { for(folder_ref_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. } else { mCompleteFolders.push_back(*it); } } }
void LLInventoryFetchComboObserver::fetch( const folder_ref_t& folder_ids, const item_ref_t& item_ids) { lldebugs << "LLInventoryFetchComboObserver::fetch()" << llendl; for(folder_ref_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(); lldebugs << "fetching folder " << *fit <<llendl; mIncompleteFolders.push_back(*fit); } else { mCompleteFolders.push_back(*fit); lldebugs << "completing folder " << *fit <<llendl; } } // Now for the items - we fetch everything which is not a direct // descendent of an incomplete folder because the item will show // up in an inventory descendents message soon enough so we do not // 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) { LLViewerInventoryItem* item = gInventory.getItem(*iit); if(!item) { lldebugs << "uanble to find item " << *iit << llendl; continue; } if(item->isComplete()) { // It's complete, so put it on the complete container. mCompleteItems.push_back(*iit); lldebugs << "completing item " << *iit << llendl; continue; } else { mIncompleteItems.push_back(*iit); owner_id = item->getPermissions().getOwner(); } if(std::find(mIncompleteFolders.begin(), mIncompleteFolders.end(), item->getParentUUID()) == mIncompleteFolders.end()) { LLSD item_entry; item_entry["owner_id"] = owner_id; item_entry["item_id"] = (*iit); items_llsd.append(item_entry); } else { lldebugs << "not worrying about " << *iit << llendl; } } fetch_items_from_llsd(items_llsd); }