summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2011-03-07 14:13:51 -0800
committerMerov Linden <merov@lindenlab.com>2011-03-07 14:13:51 -0800
commit7a33c9ef4288c88ee7c43449df3b42e5903a3f44 (patch)
tree66b3a133b4a508d78f5259b4b84aa1de138e3129 /indra/newview
parent7f5c3795b7434e437d94287cf6f317b78f0dc501 (diff)
parent7f53c0934af677d26b2e584155b77930a2c7a666 (diff)
STORM-28 : pull into viewer-development
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfriendcard.cpp85
-rw-r--r--indra/newview/llfriendcard.h13
-rw-r--r--indra/newview/llinventoryfunctions.cpp3
-rw-r--r--indra/newview/llpanelpeople.cpp29
4 files changed, 49 insertions, 81 deletions
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index e9f1e3bc22..70e789f490 100644
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -28,6 +28,7 @@
#include "llfriendcard.h"
+#include "llagent.h"
#include "llavatarnamecache.h"
#include "llinventory.h"
#include "llinventoryfunctions.h"
@@ -290,58 +291,6 @@ void LLFriendCardsManager::syncFriendCardsFolders()
boost::bind(&LLFriendCardsManager::ensureFriendsFolderExists, this));
}
-void LLFriendCardsManager::collectFriendsLists(folderid_buddies_map_t& folderBuddiesMap) const
-{
- folderBuddiesMap.clear();
-
- static bool syncronize_friends_folders = true;
- if (syncronize_friends_folders)
- {
- // Checks whether "Friends" and "Friends/All" folders exist in "Calling Cards" folder,
- // fetches their contents if needed and synchronizes it with buddies list.
- // If the folders are not found they are created.
- LLFriendCardsManager::instance().syncFriendCardsFolders();
- syncronize_friends_folders = false;
- }
-
-
- 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));
- }
-}
-
/************************************************************************/
/* Private Methods */
@@ -499,23 +448,43 @@ void LLFriendCardsManager::syncFriendsFolder()
LLAvatarTracker::buddy_map_t all_buddies;
LLAvatarTracker::instance().copyBuddyList(all_buddies);
- // 1. Remove Friend Cards for non-friends
+ // 1. Check if own calling card exists
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(findFriendAllSubfolderUUIDImpl(), cats, items, LLInventoryModel::EXCLUDE_TRASH);
+ LLUUID friends_all_folder_id = findFriendAllSubfolderUUIDImpl();
+ gInventory.collectDescendents(friends_all_folder_id, cats, items, LLInventoryModel::EXCLUDE_TRASH);
+ bool own_callingcard_found = false;
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()))
+ if ((*it)->getCreatorUUID() == gAgentID)
{
- lldebugs << "NONEXISTS, so remove it" << llendl;
- removeFriendCardFromInventory((*it)->getCreatorUUID());
+ own_callingcard_found = true;
+ break;
}
}
+ // Create own calling card if it was not found in Friends/All folder
+ if (!own_callingcard_found)
+ {
+ LLAvatarName av_name;
+ LLAvatarNameCache::get( gAgentID, &av_name );
+
+ create_inventory_item(gAgentID,
+ gAgent.getSessionID(),
+ friends_all_folder_id,
+ LLTransactionID::tnull,
+ av_name.getCompleteName(),
+ gAgentID.asString(),
+ LLAssetType::AT_CALLINGCARD,
+ LLInventoryType::IT_CALLINGCARD,
+ NOT_WEARABLE,
+ PERM_MOVE | PERM_TRANSFER,
+ NULL);
+ }
+
// 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;
diff --git a/indra/newview/llfriendcard.h b/indra/newview/llfriendcard.h
index b7f0bada14..48a9f70079 100644
--- a/indra/newview/llfriendcard.h
+++ b/indra/newview/llfriendcard.h
@@ -79,19 +79,6 @@ public:
*/
void syncFriendCardsFolders();
- /*!
- * \brief
- * Collects folders' IDs with the buddies' IDs in the Inventory Calling Card/Friends folder.
- *
- * \param folderBuddiesMap
- * map into collected data will be put. It will be cleared before adding new data.
- *
- * Each item in the out map is a pair where first is an LLViewerInventoryCategory UUID,
- * second is a vector with UUID of Avatars from this folder.
- *
- */
- void collectFriendsLists(folderid_buddies_map_t& folderBuddiesMap) const;
-
private:
typedef boost::function<void()> callback_t;
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 61d0a150b7..ba9bea02b9 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -483,9 +483,6 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(const LLInventoryIte
switch(item->getType())
{
- case LLAssetType::AT_CALLINGCARD:
- return false;
- break;
case LLAssetType::AT_OBJECT:
case LLAssetType::AT_BODYPART:
case LLAssetType::AT_CLOTHING:
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index b07a46a222..b52f33ec3b 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -384,6 +384,16 @@ private:
{
lldebugs << "Inventory changed: " << mask << llendl;
+ static bool synchronize_friends_folders = true;
+ if (synchronize_friends_folders)
+ {
+ // Checks whether "Friends" and "Friends/All" folders exist in "Calling Cards" folder,
+ // fetches their contents if needed and synchronizes it with buddies list.
+ // If the folders are not found they are created.
+ LLFriendCardsManager::instance().syncFriendCardsFolders();
+ synchronize_friends_folders = false;
+ }
+
// *NOTE: deleting of InventoryItem is performed via moving to Trash.
// That means LLInventoryObserver::STRUCTURE is present in MASK instead of LLInventoryObserver::REMOVE
if ((CALLINGCARD_ADDED & mask) == CALLINGCARD_ADDED)
@@ -750,18 +760,23 @@ void LLPanelPeople::updateFriendList()
all_friendsp.clear();
online_friendsp.clear();
- LLFriendCardsManager::folderid_buddies_map_t listMap;
+ uuid_vec_t buddies_uuids;
+ LLAvatarTracker::buddy_map_t::const_iterator buddies_iter;
+
+ // Fill the avatar list with friends UUIDs
+ for (buddies_iter = all_buddies.begin(); buddies_iter != all_buddies.end(); ++buddies_iter)
+ {
+ buddies_uuids.push_back(buddies_iter->first);
+ }
- // *NOTE: For now collectFriendsLists returns data only for Friends/All folder. EXT-694.
- LLFriendCardsManager::instance().collectFriendsLists(listMap);
- if (listMap.size() > 0)
+ if (buddies_uuids.size() > 0)
{
- lldebugs << "Friends Cards were found, count: " << listMap.begin()->second.size() << llendl;
- all_friendsp = listMap.begin()->second;
+ lldebugs << "Friends added to the list: " << buddies_uuids.size() << llendl;
+ all_friendsp = buddies_uuids;
}
else
{
- lldebugs << "Friends Cards were not found" << llendl;
+ lldebugs << "No friends found" << llendl;
}
LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin();