bool LLFacebookFriendsPanel::updateSuggestedFriendList()
{
	const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
	uuid_vec_t& second_life_friends = mSecondLifeFriends->getIDs();
	second_life_friends.clear();
	uuid_vec_t& suggested_friends = mSuggestedFriends->getIDs();
	suggested_friends.clear();

	//Add suggested friends
	LLSD friends = LLFacebookConnect::instance().getContent();
	for (LLSD::array_const_iterator i = friends.beginArray(); i != friends.endArray(); ++i)
	{
		LLUUID agent_id = (*i).asUUID();
		if (agent_id.notNull())
		{
			bool second_life_buddy = av_tracker.isBuddy(agent_id);
			if (second_life_buddy)
			{
				second_life_friends.push_back(agent_id);
			}
			else
			{
				//FB+SL but not SL friend
				suggested_friends.push_back(agent_id);
			}
		}
	}

	//Force a refresh when there aren't any filter matches (prevent displaying content that shouldn't display)
	mSecondLifeFriends->setDirty(true, !mSecondLifeFriends->filterHasMatches());
	mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches());
	showFriendsAccordionsIfNeeded();

	return false;
}
예제 #2
0
void LLPanelPeople::updateFriendList()
{
	if (!mOnlineFriendList || !mAllFriendList)
		return;

	// get all buddies we know about
	const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
	LLAvatarTracker::buddy_map_t all_buddies;
	av_tracker.copyBuddyList(all_buddies);

	// save them to the online and all friends vectors
	uuid_vec_t& online_friendsp = mOnlineFriendList->getIDs();
	uuid_vec_t& all_friendsp = mAllFriendList->getIDs();

	all_friendsp.clear();
	online_friendsp.clear();

	LLFriendCardsManager::folderid_buddies_map_t listMap;

	// *NOTE: For now collectFriendsLists returns data only for Friends/All folder. EXT-694.
	LLFriendCardsManager::instance().collectFriendsLists(listMap);
	if (listMap.size() > 0)
	{
		lldebugs << "Friends Cards were found, count: " << listMap.begin()->second.size() << llendl;
		all_friendsp = listMap.begin()->second;
	}
	else
	{
		lldebugs << "Friends Cards were not found" << llendl;
	}

	LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin();
	for (; buddy_it != all_buddies.end(); ++buddy_it)
	{
		LLUUID buddy_id = buddy_it->first;
		if (av_tracker.isBuddyOnline(buddy_id))
			online_friendsp.push_back(buddy_id);
	}

	/*
	 * Avatarlists  will be hidden by showFriendsAccordionsIfNeeded(), if they do not have items.
	 * But avatarlist can be updated only if it is visible @see LLAvatarList::draw();   
	 * So we need to do force update of lists to avoid inconsistency of data and view of avatarlist. 
	 */
	mOnlineFriendList->setDirty(true, !mOnlineFriendList->filterHasMatches());// do force update if list do NOT have items
	mAllFriendList->setDirty(true, !mAllFriendList->filterHasMatches());
	//update trash and other buttons according to a selected item
	updateButtons();
	showFriendsAccordionsIfNeeded();
}
예제 #3
0
void LLPanelPeople::onTabSelected(const LLSD& param)
{
	std::string tab_name = getChild<LLPanel>(param.asString())->getName();
	mNearbyListUpdater->setActive(tab_name == NEARBY_TAB_NAME); // S21
	mNearbyList->setExtraDataUpdatePeriod((tab_name == NEARBY_TAB_NAME) ? NEARBY_LIST_UPDATE_INTERVAL : 0); // S21
	updateButtons();

	showFriendsAccordionsIfNeeded();

	if (GROUP_TAB_NAME == tab_name)
		mFilterEditor->setLabel(getString("groups_filter_label"));
	else
		mFilterEditor->setLabel(getString("people_filter_label"));
}
예제 #4
0
void LLPanelPeople::onFilterEdit(const std::string& search_string)
{
	mFilterSubStringOrig = search_string;
	LLStringUtil::trimHead(mFilterSubStringOrig);
	// Searches are case-insensitive
	std::string search_upper = mFilterSubStringOrig;
	LLStringUtil::toUpper(search_upper);

	if (mFilterSubString == search_upper)
		return;

	mFilterSubString = search_upper;

	//store accordion tabs state before any manipulation with accordion tabs
	if(!mFilterSubString.empty())
	{
		notifyChildren(LLSD().with("action","store_state"));
	}


	// Apply new filter.
	mNearbyList->setNameFilter(mFilterSubStringOrig);
	mOnlineFriendList->setNameFilter(mFilterSubStringOrig);
	mAllFriendList->setNameFilter(mFilterSubStringOrig);
	mRecentList->setNameFilter(mFilterSubStringOrig);
	mGroupList->setNameFilter(mFilterSubStringOrig);

	setAccordionCollapsedByUser("tab_online", false);
	setAccordionCollapsedByUser("tab_all", false);

	showFriendsAccordionsIfNeeded();

	//restore accordion tabs state _after_ all manipulations...
	if(mFilterSubString.empty())
	{
		notifyChildren(LLSD().with("action","restore_state"));
	}
}