BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop)
{
	BOOL rv = isInviteAllowed();
	if(rv && category)
	{
		LLInventoryModel::cat_array_t cats;
		LLInventoryModel::item_array_t items;
		LLUniqueBuddyCollector buddies;
		gInventory.collectDescendentsIf(category->getUUID(),
										cats,
										items,
										LLInventoryModel::EXCLUDE_TRASH,
										buddies);
		S32 count = items.count();
		if(count == 0)
		{
			rv = FALSE;
		}
		else if(drop)
		{
			uuid_vec_t ids;
			ids.reserve(count);
			for(S32 i = 0; i < count; ++i)
			{
				ids.push_back(items.get(i)->getCreatorUUID());
			}
			inviteToSession(ids);
		}
	}
	return rv;
}
Ejemplo n.º 2
0
BOOL LLFloaterIMPanel::dropCategory(LLInventoryCategory* category, BOOL drop)
{
	if (category)
	{
		LLInventoryModel::cat_array_t cats;
		LLInventoryModel::item_array_t items;
		LLUniqueBuddyCollector buddies;
		gInventory.collectDescendentsIf(category->getUUID(),
										cats,
										items,
										LLInventoryModel::EXCLUDE_TRASH,
										buddies);
		S32 count = items.count();
		if(count == 0)
		{
			return false;
		}
		else if(drop)
		{
			LLDynamicArray<LLUUID> ids;
			for(S32 i = 0; i < count; ++i)
			{
				ids.put(items.get(i)->getCreatorUUID());
			}
			inviteToSession(ids);
		}
	}
	return true;
}
Ejemplo n.º 3
0
void LLFriendCardsManager::syncFriendsFolder()
{
	LLAvatarTracker::buddy_map_t all_buddies;
	LLAvatarTracker::instance().copyBuddyList(all_buddies);

	// 1. Remove Friend Cards for non-friends
	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;

	gInventory.collectDescendents(findFriendAllSubfolderUUIDImpl(), cats, items, LLInventoryModel::EXCLUDE_TRASH);

	LLInventoryModel::item_array_t::const_iterator it;
	for (it = items.begin(); it != items.end(); ++it)
	{
		lldebugs << "Check if buddy is in list: " << (*it)->getName() << " " << (*it)->getCreatorUUID() << llendl;
		if (NULL == get_ptr_in_map(all_buddies, (*it)->getCreatorUUID()))
		{
			lldebugs << "NONEXISTS, so remove it" << llendl;
			removeFriendCardFromInventory((*it)->getCreatorUUID());
		}
	}

	// 2. Add missing Friend Cards for friends
	LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin();
	llinfos << "try to build friends, count: " << all_buddies.size() << llendl;
	for(; buddy_it != all_buddies.end(); ++buddy_it)
	{
		const LLUUID& buddy_id = (*buddy_it).first;
		addFriendCardToInventory(buddy_id);
	}
}
void LLMakeOutfitDialog::getIncludedItems(LLInventoryModel::item_array_t& item_list)
{
	LLInventoryModel::cat_array_t *cats;
	LLInventoryModel::item_array_t *items;
	gInventory.getDirectDescendentsOf(LLAppearanceMgr::instance().getCOF(), cats, items);
	for (LLInventoryModel::item_array_t::const_iterator iter = items->begin(); iter != items->end(); ++iter)
	{
		LLViewerInventoryItem* item = (*iter);
		if (!item)
			continue;
		if (item->isWearableType())
		{
			LLWearableType::EType type = item->getWearableType();
			if (type < LLWearableType::WT_COUNT && childGetValue(mCheckBoxList[type].first).asBoolean())
			{
				item_list.push_back(item);
			}
		}
		else
		{
			LLViewerJointAttachment* attachment = gAgentAvatarp->getWornAttachmentPoint(item->getLinkedUUID());
			if (attachment && childGetValue(std::string("checkbox_")+attachment->getName()).asBoolean())
			{
				item_list.push_back(item);
			}
		}
	}
}
Ejemplo n.º 5
0
void LLCOFMgr::updateAttachments()
{
    /*const*/ LLVOAvatar* pAvatar = gAgentAvatarp;
    if (!pAvatar)
        return;

    const LLUUID idCOF = getCOF();

    // Grab all attachment links currently in COF
    LLInventoryModel::item_array_t items;
    getDescendentsOfAssetType(idCOF, items, LLAssetType::AT_OBJECT, true);

    // Include attachments which should be in COF but don't have their link created yet
    uuid_vec_t::iterator itPendingAttachLink = m_PendingAttachLinks.begin();
    while (itPendingAttachLink != m_PendingAttachLinks.end())
    {
        const LLUUID& idItem = *itPendingAttachLink;
        if ( (!pAvatar->isWearingAttachment(idItem)) || (isLinkInCOF(idItem)) )
        {
            itPendingAttachLink = m_PendingAttachLinks.erase(itPendingAttachLink);
            continue;
        }

        LLViewerInventoryItem* pItem = gInventory.getItem(idItem);
        if (pItem)
            items.push_back(pItem);

        ++itPendingAttachLink;
    }

    // Don't remove attachments until avatar is fully loaded (should reduce random attaching/detaching/reattaching at log-on)
    LLAgentWearables::userUpdateAttachments(items, !pAvatar->isFullyLoaded());
}
Ejemplo n.º 6
0
void LLFloaterOutbox::updateFolderCount()
{
	if (mOutboxInventoryPanel.get() && mOutboxId.notNull())
	{
		S32 item_count = 0;

		if (mOutboxId.notNull())
		{
			LLInventoryModel::cat_array_t * cats;
			LLInventoryModel::item_array_t * items;
			gInventory.getDirectDescendentsOf(mOutboxId, cats, items);

			item_count = cats->count() + items->count();
		}

		mOutboxItemCount = item_count;
	}
	else
	{
		// If there's no outbox, the number of items in it should be set to 0 for consistency
		mOutboxItemCount = 0;
	}

	if (!mImportBusy)
	{
		updateFolderCountStatus();
	}
}
Ejemplo n.º 7
0
bool LLCOFMgr::isLinkInCOF(const LLUUID& idItem)
{
    LLInventoryModel::cat_array_t folders;
    LLInventoryModel::item_array_t items;
    LLLinkedItemIDMatches f(gInventory.getLinkedItemID(idItem));
    gInventory.collectDescendentsIf(getCOF(), folders, items, LLInventoryModel::EXCLUDE_TRASH, f);
    return (!items.empty());
}
Ejemplo n.º 8
0
//static
bool LLLandmarkActions::hasParcelLandmark()
{
	LLFirstAgentParcelLandmark get_first_agent_landmark;
	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	fetch_landmarks(cats, items, get_first_agent_landmark);
	return !items.empty();
	
}
Ejemplo n.º 9
0
bool LLFriendCardsManager::isItemInAnyFriendsList(const LLViewerInventoryItem* item)
{
	if (item->getType() != LLAssetType::AT_CALLINGCARD)
		return false;

	LLInventoryModel::item_array_t items;
	findMatchedFriendCards(item->getCreatorUUID(), items);

	return items.count() > 0;
}
Ejemplo n.º 10
0
void LLInventoryItemsList::refreshList(const LLInventoryModel::item_array_t item_array)
{
	getIDs().clear();
	LLInventoryModel::item_array_t::const_iterator it = item_array.begin();
	for( ; item_array.end() != it; ++it)
	{
		getIDs().push_back((*it)->getUUID());
	}
	mNeedsRefresh = true;
}
Ejemplo n.º 11
0
void LLFriendCardsManager::removeFriendCardFromInventory(const LLUUID& avatarID)
{
	LLInventoryModel::item_array_t items;
	findMatchedFriendCards(avatarID, items);

	LLInventoryModel::item_array_t::const_iterator it;
	for (it = items.begin(); it != items.end(); ++ it)
	{
		gInventory.removeItem((*it)->getUUID());
	}
}
void LLFloaterCustomize::saveCurrentWearables()
{
	LLWearableType::EType cur = getCurrentWearableType();

	for(U32 i = 0;i < gAgentWearables.getWearableCount(cur);++i)
	{
		LLViewerWearable* wearable = gAgentWearables.getViewerWearable(cur,i);
		if(wearable && wearable->isDirty())
		{
			/*
			===============================================================================================
			Copy-pasted some code from LLPanelEditWearable::saveChanges instead of just calling saveChanges, as
			we only have one 'active' panel per wearable type, not per layer. The panels just update when
			layer of focus is changed. Easier just to do it right here manually.
			===============================================================================================
			*/ 
			// Find an existing link to this wearable's inventory item, if any, and its description field.
			if(gAgentAvatarp->isUsingServerBakes())
			{
				LLInventoryItem *link_item = NULL;
				std::string description;
				LLInventoryModel::item_array_t links =
					LLAppearanceMgr::instance().findCOFItemLinks(wearable->getItemID());
				if (links.size()>0)
				{
					link_item = links.get(0).get();
					if (link_item && link_item->getIsLinkType())
					{
						description = link_item->getActualDescription();
					}
				}
				// Make another copy of this link, with the same
				// description.  This is needed to bump the COF
				// version so texture baking service knows appearance has changed.
				if (link_item)
				{
					// Create new link
					link_inventory_item( gAgent.getID(),
										 link_item->getLinkedUUID(),
										 LLAppearanceMgr::instance().getCOF(),
										 link_item->getName(),
										 description,
										 LLAssetType::AT_LINK,
										 NULL);
					// Remove old link
					gInventory.purgeObject(link_item->getUUID());
				}
			}
			gAgentWearables.saveWearable( cur, i );
		}
	}
}
Ejemplo n.º 13
0
void LLFloaterWorldMap::buildLandmarkIDLists()
{
	LLCtrlListInterface *list = childGetListInterface("landmark combo");
	if (!list)
	{
		return;
	}

    // Delete all but the "None" entry
	S32 list_size = list->getItemCount();
	if (list_size > 1)
	{
		list->selectItemRange(1, -1);
		list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
	}

	mLandmarkItemIDList.reset();
	mLandmarkAssetIDList.reset();

	// Get all of the current landmarks
	mLandmarkAssetIDList.put( LLUUID::null );
	mLandmarkItemIDList.put( LLUUID::null );

	mLandmarkAssetIDList.put( sHomeID );
	mLandmarkItemIDList.put( sHomeID );

	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	LLIsType is_landmark(LLAssetType::AT_LANDMARK);
	gInventory.collectDescendentsIf(gAgent.getInventoryRootID(),
									cats,
									items,
									LLInventoryModel::EXCLUDE_TRASH,
									is_landmark);

	std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers());
	
	S32 count = items.count();
	for(S32 i = 0; i < count; ++i)
	{
		LLInventoryItem* item = items.get(i);

		list->addSimpleElement(item->getName(), ADD_BOTTOM, item->getUUID());

		mLandmarkAssetIDList.put( item->getAssetUUID() );
		mLandmarkItemIDList.put( item->getUUID() );
	}
	list->sortByColumn(std::string("landmark name"), TRUE);

	list->selectFirstItem();
}
S32 LLFloaterMarketplaceListings::getFolderCount()
{
	if (mPanelListings && mRootFolderId.notNull())
	{
		LLInventoryModel::cat_array_t * cats;
		LLInventoryModel::item_array_t * items;
		gInventory.getDirectDescendentsOf(mRootFolderId, cats, items);

		return (cats->size() + items->size());
	}
	else
	{
		return 0;
	}
}
Ejemplo n.º 15
0
// *TODO: This could be made more efficient by only fetching the FIRST
// landmark that meets the criteria
LLViewerInventoryItem* LLLandmarkActions::findLandmarkForGlobalPos(const LLVector3d &pos)
{
	// Determine whether there are landmarks pointing to the current parcel.
	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	LLFetchlLandmarkByPos is_current_pos_landmark(pos);
	fetch_landmarks(cats, items, is_current_pos_landmark);

	if(items.empty())
	{
		return NULL;
	}

	return items[0];
}
Ejemplo n.º 16
0
void LLCOFMgr::removeCOFItemLinks(const LLUUID& idItem)
{
    gInventory.addChangedMask(LLInventoryObserver::LABEL, idItem);

    LLInventoryModel::cat_array_t folders;
    LLInventoryModel::item_array_t items;
    gInventory.collectDescendents(getCOF(), folders, items, LLInventoryModel::EXCLUDE_TRASH);

    for (S32 idxItem = 0; idxItem < items.count(); idxItem++)
    {
        const LLInventoryItem* pItem = items.get(idxItem).get();
        if ( (pItem->getIsLinkType()) && (idItem == pItem->getLinkedUUID()) )
            gInventory.purgeObject(pItem->getUUID());
    }
}
Ejemplo n.º 17
0
// static
void LLLocalInventory::climb(LLInventoryCategory* cat,
                             LLInventoryModel::cat_array_t& cats,
                             LLInventoryModel::item_array_t& items)
{
    LLInventoryModel* model = &gInventory;

    // Add this category
    cats.push_back(LLPointer<LLViewerInventoryCategory>((LLViewerInventoryCategory*)cat));

    LLInventoryModel::cat_array_t *direct_cats;
    LLInventoryModel::item_array_t *direct_items;
    model->getDirectDescendentsOf(cat->getUUID(), direct_cats, direct_items);

    // Add items
    LLInventoryModel::item_array_t::iterator item_iter = direct_items->begin();
    LLInventoryModel::item_array_t::iterator item_end = direct_items->end();
    for( ; item_iter != item_end; ++item_iter)
    {
        items.push_back(*item_iter);
    }

    // Do subcategories
    LLInventoryModel::cat_array_t::iterator cat_iter = direct_cats->begin();
    LLInventoryModel::cat_array_t::iterator cat_end = direct_cats->end();
    for( ; cat_iter != cat_end; ++cat_iter)
    {
        climb(*cat_iter, cats, items);
    }
}
Ejemplo n.º 18
0
// Checked: 2013-10-12 (RLVa-1.4.9)
bool RlvCommandOptionGetPath::getItemIDs(LLWearableType::EType wtType, uuid_vec_t& idItems)
{
	uuid_vec_t::size_type cntItemsPrev = idItems.size();

	LLInventoryModel::cat_array_t folders; LLInventoryModel::item_array_t items;
	LLFindWearablesOfType f(wtType);
	gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), folders, items, false, f);
	for (LLInventoryModel::item_array_t::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem)
	{
		const LLViewerInventoryItem* pItem = *itItem;
		if (pItem)
			idItems.push_back(pItem->getLinkedUUID());
	}

	return (cntItemsPrev != idItems.size());
}
Ejemplo n.º 19
0
void LLCOFMgr::purgeBOFLink()
{
    LLInventoryModel::cat_array_t* pFolders;
    LLInventoryModel::item_array_t* pItems;
    gInventory.getDirectDescendentsOf(getCOF(), pFolders, pItems);
    for (S32 idxItem = 0, cntItem = pItems->count(); idxItem < cntItem; idxItem++)
    {
        const LLViewerInventoryItem* pItem = pItems->get(idxItem).get();
        if ( (!pItem) || (LLAssetType::AT_LINK_FOLDER  != pItem->getActualType()) )
            continue;

        const LLViewerInventoryCategory* pLinkFolder = pItem->getLinkedCategory();
        if ( (pLinkFolder) && (LLFolderType::FT_OUTFIT == pLinkFolder->getPreferredType()) )
            gInventory.purgeObject(pItem->getUUID());
    }
}
Ejemplo n.º 20
0
const LLUUID& LLFriendCardsManager::findFriendCardInventoryUUIDImpl(const LLUUID& avatarID)
{
	LLUUID friendAllSubfolderUUID = findFriendAllSubfolderUUIDImpl();
	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	LLInventoryModel::item_array_t::const_iterator it;

	// it is not necessary to check friendAllSubfolderUUID against NULL. It will be processed by collectDescendents
	gInventory.collectDescendents(friendAllSubfolderUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH);
	for (it = items.begin(); it != items.end(); ++it)
	{
		if ((*it)->getCreatorUUID() == avatarID)
			return (*it)->getUUID();
	}

	return LLUUID::null;
}
Ejemplo n.º 21
0
// Checked: 2009-05-26 (RLVa-0.2.0d) | Modified: RLVa-0.2.0d
S32 RlvInventory::getDirectDescendentsCount(const LLInventoryCategory* pFolder, LLAssetType::EType filterType)
{
	S32 cntType = 0;
	if (pFolder)
	{
		LLInventoryModel::cat_array_t* pFolders; LLInventoryModel::item_array_t* pItems;
		gInventory.getDirectDescendentsOf(pFolder->getUUID(), pFolders, pItems);

		if (pItems)
		{
			for (S32 idxItem = 0, cntItem = pItems->count(); idxItem < cntItem; idxItem++)
				if (pItems->get(idxItem)->getType() == filterType)
					cntType++;
		}
	}
	return cntType;
}
Ejemplo n.º 22
0
bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t cb)
{
	S32 version = LLViewerInventoryCategory::VERSION_UNKNOWN;
	S32 current_num_known_descendents = LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN;
	bool can_be_added = true;

	LLViewerInventoryCategory* category = gInventory.getCategory(cat_id);
	// If category could not be retrieved it might mean that
	// inventory is unusable at the moment so the category is
	// stored with VERSION_UNKNOWN and DESCENDENT_COUNT_UNKNOWN,
	// it may be updated later.
	if (category)
	{
		// Inventory category version is used to find out if some changes
		// to a category have been made.
		version = category->getVersion();

		LLInventoryModel::cat_array_t* cats;
		LLInventoryModel::item_array_t* items;
		gInventory.getDirectDescendentsOf(cat_id, cats, items);
		if (!cats || !items)
		{
			LL_WARNS() << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << LL_ENDL;
			// NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
			// that the cat just doesn't have any items or subfolders).
			// Unrecoverable, so just return "false" meaning that the category can't be observed.
			can_be_added = false;

			llassert(cats != NULL && items != NULL);
		}
		else
		{
			current_num_known_descendents = cats->size() + items->size();
		}
	}

	if (can_be_added)
	{
		mCategoryMap.insert(category_map_value_t(
								cat_id,LLCategoryData(cat_id, cb, version, current_num_known_descendents)));
	}

	return can_be_added;
}
void LLFloaterGesture::buildGestureList()
{
	S32 scroll_pos = mGestureList->getScrollPos();
	uuid_vec_t selected_items;
	getSelectedIds(selected_items);
	LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL;
//	mGestureList->deleteAllItems(); // <FS:ND/> Don't recreate the list over and over.

	LLGestureMgr::item_map_t::const_iterator it;
	const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
	for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
	{
		addGesture(it->first,it->second, mGestureList);
	}
	// <FS:PP> FIRE-5646: Option to show only active gestures
	// if (gInventory.isCategoryComplete(mGestureFolderID))
	if (gInventory.isCategoryComplete(mGestureFolderID) && !gSavedPerAccountSettings.getBOOL("FSShowOnlyActiveGestures"))
	// </FS:PP> FIRE-5646: Option to show only active gestures
	{
		LLIsType is_gesture(LLAssetType::AT_GESTURE);
		LLInventoryModel::cat_array_t categories;
		LLInventoryModel::item_array_t items;
		gInventory.collectDescendentsIf(mGestureFolderID, categories, items,
				LLInventoryModel::EXCLUDE_TRASH, is_gesture);

		for (LLInventoryModel::item_array_t::iterator it = items.begin(); it!= items.end(); ++it)
		{
			LLInventoryItem* item = it->get();
			if (active_gestures.find(item->getUUID()) == active_gestures.end())
			{
				// if gesture wasn't loaded yet, we can display only name
				addGesture(item->getUUID(), NULL, mGestureList);
			}
		}
	}

	// attempt to preserve scroll position through re-builds
	// since we do re-build whenever something gets dirty
	for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++)
	{
		mGestureList->selectByID(*it);
	}
	mGestureList->setScrollPos(scroll_pos);
}
Ejemplo n.º 24
0
//static
void LLLocalInventory::saveInvCache(std::string filename, LLFolderView* folder)
{
	LLInventoryModel* model = &gInventory;
	std::set<LLUUID> selected_items;
	folder->getSelectionList(selected_items);
	if(selected_items.size() < 1)
	{
		// No items selected?  Wtfboom
		return;
	}
	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	// Make complete lists of child categories and items
	std::set<LLUUID>::iterator sel_iter = selected_items.begin();
	std::set<LLUUID>::iterator sel_end = selected_items.end();
	for( ; sel_iter != sel_end; ++sel_iter)
	{
		LLInventoryCategory* cat = model->getCategory(*sel_iter);
		if(cat)
		{
			climb(cat, cats, items);
		}
	}
	// And what about items inside a folder that wasn't selected?
	// I guess I will just add selected items, so long as they aren't already added
	for(sel_iter = selected_items.begin(); sel_iter != sel_end; ++sel_iter)
	{
		LLInventoryItem* item = model->getItem(*sel_iter);
		if(item)
		{
			if(std::find(items.begin(), items.end(), item) == items.end())
			{
				items.push_back(LLPointer<LLViewerInventoryItem>((LLViewerInventoryItem*)item));
				LLInventoryCategory* parent = model->getCategory(item->getParentUUID());
				if(std::find(cats.begin(), cats.end(), parent) == cats.end())
				{
					cats.push_back(LLPointer<LLViewerInventoryCategory>((LLViewerInventoryCategory*)parent));
				}
			}
		}
	}
	LLInventoryModel::saveToFile(filename, cats, items);
}
BOOL get_is_parent_to_worn_item(const LLUUID& id)
{
	const LLViewerInventoryCategory* cat = gInventory.getCategory(id);
	if (!cat)
	{
		return FALSE;
	}

	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	LLInventoryCollectAllItems collect_all;
	gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), cats, items, LLInventoryModel::EXCLUDE_TRASH, collect_all);

	for (LLInventoryModel::item_array_t::const_iterator it = items.begin(); it != items.end(); ++it)
	{
		const LLViewerInventoryItem * const item = *it;

		llassert(item->getIsLinkType());

		LLUUID linked_id = item->getLinkedUUID();
		const LLViewerInventoryItem * const linked_item = gInventory.getItem(linked_id);

		if (linked_item)
		{
			LLUUID parent_id = linked_item->getParentUUID();

			while (!parent_id.isNull())
			{
				LLInventoryCategory * parent_cat = gInventory.getCategory(parent_id);

				if (cat == parent_cat)
				{
					return TRUE;
				}

				parent_id = parent_cat->getParentUUID();
			}
		}
	}

	return FALSE;
}
Ejemplo n.º 26
0
BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInventoryCategory* cat) const
{
	const S32 version = cat->getVersion();
	const S32 expected_num_descendents = cat->getDescendentCount();
	if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) ||
		(expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN))
	{
		return FALSE;
	}
	// it might be complete - check known descendents against
	// currently available.
	LLInventoryModel::cat_array_t* cats;
	LLInventoryModel::item_array_t* items;
	gInventory.getDirectDescendentsOf(cat->getUUID(), cats, items);
	if (!cats || !items)
	{
		LL_WARNS() << "Category '" << cat->getName() << "' descendents corrupted, fetch failed." << LL_ENDL;
		// NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
		// that the cat just doesn't have any items or subfolders).
		// Unrecoverable, so just return done so that this observer can be cleared
		// from memory.
		return TRUE;
	}
	const S32 current_num_known_descendents = cats->size() + items->size();
	
	// Got the number of descendents that we were expecting, so we're done.
	if (current_num_known_descendents == expected_num_descendents)
	{
		return TRUE;
	}

	// Error condition, but recoverable.  This happens if something was added to the
	// category before it was initialized, so accountForUpdate didn't update descendent
	// count and thus the category thinks it has fewer descendents than it actually has.
	if (current_num_known_descendents >= expected_num_descendents)
	{
		LL_WARNS() << "Category '" << cat->getName() << "' expected descendentcount:" << expected_num_descendents << " descendents but got descendentcount:" << current_num_known_descendents << LL_ENDL;
		const_cast<LLViewerInventoryCategory *>(cat)->setDescendentCount(current_num_known_descendents);
		return TRUE;
	}
	return FALSE;
}
Ejemplo n.º 27
0
void LLFloaterOutbox::updateFolderCount()
{
    S32 item_count = 0;

    if (mOutboxId.notNull())
    {
        LLInventoryModel::cat_array_t * cats;
        LLInventoryModel::item_array_t * items;
        gInventory.getDirectDescendentsOf(mOutboxId, cats, items);

        item_count = cats->count() + items->count();
    }

    mOutboxItemCount = item_count;

    if (!mImportBusy)
    {
        updateFolderCountStatus();
    }
}
Ejemplo n.º 28
0
void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel::item_array_t& cof_items)
{
	for (U32 i = 0; i < cof_items.size(); ++i)
	{
		LLViewerInventoryItem* item = cof_items.get(i);
		if (!item) continue;

		const LLAssetType::EType item_type = item->getType();
		if (item_type == LLAssetType::AT_CLOTHING) continue;
		LLPanelInventoryListItemBase* item_panel = NULL;
		if (item_type == LLAssetType::AT_OBJECT)
		{
			item_panel = buildAttachemntListItem(item);
			mAttachments->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
		}
		else if (item_type == LLAssetType::AT_BODYPART)
		{
			item_panel = buildBodypartListItem(item);
			if (!item_panel) continue;

			mBodyParts->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
		}
	}

	if (mAttachments->size())
	{
		mAttachments->sort();
		mAttachments->notify(REARRANGE); //notifying the parent about the list's size change (cause items were added with rearrange=false)
	}
	else
	{
		mAttachments->setNoItemsCommentText(LLTrans::getString("no_attachments"));
	}

	if (mBodyParts->size())
	{
		mBodyParts->sort();
		mBodyParts->notify(REARRANGE);
	}
}
Ejemplo n.º 29
0
void LLFriendCardsManager::collectFriendsLists(folderid_buddies_map_t& folderBuddiesMap) const
{
	folderBuddiesMap.clear();

	LLInventoryModel::cat_array_t* listFolders;
	LLInventoryModel::item_array_t* items;

	// get folders in the Friend folder. Items should be NULL due to Cards should be in lists.
	gInventory.getDirectDescendentsOf(findFriendFolderUUIDImpl(), listFolders, items);

	if (NULL == listFolders)
		return;

	LLInventoryModel::cat_array_t::const_iterator itCats;	// to iterate Friend Lists (categories)
	LLInventoryModel::item_array_t::const_iterator itBuddy;	// to iterate Buddies in each List
	LLInventoryModel::cat_array_t* fakeCatsArg;
	for (itCats = listFolders->begin(); itCats != listFolders->end(); ++itCats)
	{
		if (items)
			items->clear();

		// *HACK: Only Friends/All content will be shown for now
		// *TODO: Remove this hack, implement sorting if it will be needded by spec.
		if ((*itCats)->getUUID() != findFriendAllSubfolderUUIDImpl())
			continue;

		gInventory.getDirectDescendentsOf((*itCats)->getUUID(), fakeCatsArg, items);

		if (NULL == items)
			continue;

		uuid_vec_t buddyUUIDs;
		for (itBuddy = items->begin(); itBuddy != items->end(); ++itBuddy)
		{
			buddyUUIDs.push_back((*itBuddy)->getCreatorUUID());
		}

		folderBuddiesMap.insert(make_pair((*itCats)->getUUID(), buddyUUIDs));
	}
}
Ejemplo n.º 30
0
void LLCOFMgr::synchWearables()
{
    const LLUUID idCOF = getCOF();

    // Grab all wearable links currently in COF
    LLInventoryModel::item_array_t items;
    getDescendentsOfAssetType(idCOF, items, LLAssetType::AT_BODYPART, true);
    getDescendentsOfAssetType(idCOF, items, LLAssetType::AT_CLOTHING, true);

    // Transform collection of link LLViewerInventory pointers into collection of target LLUUIDs
    uuid_vec_t curItems;
    for (S32 idxItem = 0; idxItem < items.count(); idxItem++)
    {
        const LLViewerInventoryItem* pItem = items.get(idxItem);
        if (!pItem)
            continue;
        curItems.push_back(pItem->getLinkedUUID());
    }

    // Grab the item UUIDs of all currently worn wearables
    uuid_vec_t newItems;
    for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++)
    {
        const LLUUID& idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)idxType);
        if (idItem.isNull())
            continue;
        newItems.push_back(idItem);
    }

    uuid_vec_t addItems, remItems;
    LLCommonUtils::computeDifference(newItems, curItems, addItems, remItems);

    // Add links for worn wearables that aren't linked yet
    for (uuid_vec_t::const_iterator itItem = addItems.begin(); itItem != addItems.end(); ++itItem)
        addWearable(*itItem);

    // Remove links of wearables that aren't worn anymore
    for (uuid_vec_t::const_iterator itItem = remItems.begin(); itItem != remItems.end(); ++itItem)
        removeWearable(*itItem);
}