summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-06-14 20:11:14 -0700
committerMerov Linden <merov@lindenlab.com>2013-06-14 20:11:14 -0700
commit3910ce512fb8092ceb77e8b44729bff46b93212c (patch)
tree38e3d8888382cf84ec9706feac06b1f3f0879d5a /indra
parent2eb466908e8056f9b890d06d449ad8d10d3ff4cf (diff)
parent37dcc335321fb7a16b99fe4f159aa68ad8ec5d76 (diff)
Merge with viewer-fbc
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfacebookconnect.cpp5
-rw-r--r--indra/newview/llfacebookconnect.h3
-rwxr-xr-xindra/newview/llpanelpeople.cpp198
-rwxr-xr-xindra/newview/llpanelpeople.h2
4 files changed, 91 insertions, 117 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp
index ef0ae0a69e..67de13918e 100644
--- a/indra/newview/llfacebookconnect.cpp
+++ b/indra/newview/llfacebookconnect.cpp
@@ -398,6 +398,11 @@ void LLFacebookConnect::storeContent(const LLSD& content)
{
mGeneration++;
mContent = content;
+
+ if(mContentUpdatedCallback)
+ {
+ mContentUpdatedCallback();
+ }
}
const LLSD& LLFacebookConnect::getContent() const
diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h
index e719314920..a19b6fbb98 100644
--- a/indra/newview/llfacebookconnect.h
+++ b/indra/newview/llfacebookconnect.h
@@ -50,6 +50,7 @@ public:
};
typedef boost::function<void(bool ok)> share_callback_t;
+ typedef boost::function<void()> content_updated_callback_t;
void connectToFacebook(const std::string& auth_code = ""); // Initiate the complete FB connection. Please use getConnectionToFacebook() in normal use.
void disconnectFromFacebook(); // Disconnect from the FBC service.
@@ -64,6 +65,7 @@ public:
void setPostCheckinCallback(share_callback_t cb) { mPostCheckinCallback = cb; }
void setSharePhotoCallback(share_callback_t cb) { mSharePhotoCallback = cb; }
void setUpdateStatusCallback(share_callback_t cb) { mUpdateStatusCallback = cb; }
+ void setContentUpdatedCallback(content_updated_callback_t cb) { mContentUpdatedCallback = cb;}
void clearContent();
void storeContent(const LLSD& content);
@@ -89,6 +91,7 @@ private:
share_callback_t mPostCheckinCallback;
share_callback_t mSharePhotoCallback;
share_callback_t mUpdateStatusCallback;
+ content_updated_callback_t mContentUpdatedCallback;
};
#endif // LL_LLFACEBOOKCONNECT_H
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 24e8d40d7e..10c1be241a 100755
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -81,7 +81,6 @@
#define FRIEND_LIST_UPDATE_TIMEOUT 0.5
#define NEARBY_LIST_UPDATE_INTERVAL 1
-#define FBCTEST_LIST_UPDATE_INTERVAL 0.25
static const std::string NEARBY_TAB_NAME = "nearby_panel";
static const std::string FRIENDS_TAB_NAME = "friends_panel";
@@ -506,45 +505,6 @@ public:
}
};
-/**
- * Periodically updates the FBC test list after a login is initiated.
- *
- * The period is defined by FBCTEST_LIST_UPDATE_INTERVAL constant.
- */
-class LLFbcTestListUpdater : public LLAvatarListUpdater
-{
- LOG_CLASS(LLFbcTestListUpdater);
-
-public:
- LLFbcTestListUpdater(callback_t cb)
- : LLAvatarListUpdater(cb, FBCTEST_LIST_UPDATE_INTERVAL)
- {
- setActive(false);
- }
-
- /*virtual*/ void setActive(bool val)
- {
- if (val)
- {
- // update immediately and start regular updates
- update();
- mEventTimer.start();
- }
- else
- {
- // stop regular updates
- mEventTimer.stop();
- }
- }
-
- /*virtual*/ BOOL tick()
- {
- update();
- return FALSE;
- }
-private:
-};
-
//=============================================================================
LLPanelPeople::LLPanelPeople()
@@ -563,7 +523,6 @@ LLPanelPeople::LLPanelPeople()
mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::updateFriendList, this));
mNearbyListUpdater = new LLNearbyListUpdater(boost::bind(&LLPanelPeople::updateNearbyList, this));
mRecentListUpdater = new LLRecentListUpdater(boost::bind(&LLPanelPeople::updateRecentList, this));
- mFacebookListUpdater = new LLFbcTestListUpdater(boost::bind(&LLPanelPeople::updateFacebookList, this));
mButtonsUpdater = new LLButtonsUpdater(boost::bind(&LLPanelPeople::updateButtons, this));
mCommitCallbackRegistrar.add("People.loginFBC", boost::bind(&LLPanelPeople::onLoginFbcButtonClicked, this));
@@ -598,7 +557,6 @@ LLPanelPeople::~LLPanelPeople()
delete mNearbyListUpdater;
delete mFriendListUpdater;
delete mRecentListUpdater;
- delete mFacebookListUpdater;
if(LLVoiceClient::instanceExists())
{
@@ -651,7 +609,7 @@ BOOL LLPanelPeople::postBuild()
// updater is active only if panel is visible to user.
friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFriendListUpdater, _2));
friends_tab->setVisibleCallback(boost::bind(&LLPanelPeople::removePicker, this));
- friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFacebookListUpdater, _2));
+ friends_tab->setVisibleCallback(boost::bind(&LLPanelPeople::updateFacebookList, this, _2));
mOnlineFriendList = friends_tab->getChild<LLAvatarList>("avatars_online");
mAllFriendList = friends_tab->getChild<LLAvatarList>("avatars_all");
@@ -695,12 +653,12 @@ BOOL LLPanelPeople::postBuild()
LLPanel * social_tab = getChild<LLPanel>(FBCTEST_TAB_NAME);
mFacebookFriends = social_tab->getChild<LLSocialList>("facebook_friends");
// Note: we use the same updater for both test lists (brute force but OK since it's temporary)
- social_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFacebookListUpdater, _2));
+ social_tab->setVisibleCallback(boost::bind(&LLPanelPeople::updateFacebookList, this, _2));
//===Test START========================================================================
LLPanel * socialtwo_tab = getChild<LLPanel>(FBCTESTTWO_TAB_NAME);
- socialtwo_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFacebookListUpdater, _2));
+ socialtwo_tab->setVisibleCallback(boost::bind(&LLPanelPeople::updateFacebookList, this, _2));
//Create folder view
LLPersonModelCommon* base_item = new LLPersonModelCommon(mPersonFolderViewModel);
@@ -903,31 +861,75 @@ void LLPanelPeople::updateFriendList()
void LLPanelPeople::updateSuggestedFriendList()
{
- const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
- uuid_vec_t& suggested_friends = mSuggestedFriends->getIDs();
- suggested_friends.clear();
-
- //Add suggested friends
- LLSD friends = LLFacebookConnect::instance().getContent();
- for (LLSD::map_const_iterator i = friends.beginMap(); i != friends.endMap(); ++i)
+ if (LLFacebookConnect::instance().generation() != mFacebookListGeneration)
{
- std::string name = i->second["name"].asString();
- LLUUID agent_id = i->second.has("agent_id") ? i->second["agent_id"].asUUID() : LLUUID(NULL);
- bool second_life_buddy = agent_id.notNull() ? av_tracker.isBuddy(agent_id) : false;
+ mFacebookListGeneration = LLFacebookConnect::instance().generation();
- if(!second_life_buddy)
+ const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
+ uuid_vec_t& suggested_friends = mSuggestedFriends->getIDs();
+ suggested_friends.clear();
+
+ //Add suggested friends
+ LLSD friends = LLFacebookConnect::instance().getContent();
+ for (LLSD::map_const_iterator i = friends.beginMap(); i != friends.endMap(); ++i)
{
- //FB+SL but not SL friend
- if (agent_id.notNull())
+ std::string name = i->second["name"].asString();
+ LLUUID agent_id = i->second.has("agent_id") ? i->second["agent_id"].asUUID() : LLUUID(NULL);
+ bool second_life_buddy = agent_id.notNull() ? av_tracker.isBuddy(agent_id) : false;
+
+ if(!second_life_buddy)
{
- suggested_friends.push_back(agent_id);
+ //FB+SL but not SL friend
+ if (agent_id.notNull())
+ {
+ suggested_friends.push_back(agent_id);
+ }
}
}
- }
- //Force a refresh when there aren't any filter matches (prevent displaying content that shouldn't display)
- mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches());
- showFriendsAccordionsIfNeeded();
+ //Force a refresh when there aren't any filter matches (prevent displaying content that shouldn't display)
+ mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches());
+ showFriendsAccordionsIfNeeded();
+
+
+
+ //TODO Gilbert: Below code will eventually be deprecated
+ mFacebookFriends->clear();
+ LLPersonTabModel::tab_type tab_type;
+ LLAvatarTracker& avatar_tracker = LLAvatarTracker::instance();
+
+ for (LLSD::map_const_iterator i = friends.beginMap(); i != friends.endMap(); ++i)
+ {
+ std::string name = i->second["name"].asString();
+ LLUUID agent_id = i->second.has("agent_id") ? i->second["agent_id"].asUUID() : LLUUID(NULL);
+ bool second_life_buddy = agent_id.notNull() ? avatar_tracker.isBuddy(agent_id) : false;
+
+ //add to avatar list
+ mFacebookFriends->addNewItem(agent_id, name, false);
+
+ if(!second_life_buddy)
+ {
+ //FB+SL but not SL friend
+ if (agent_id.notNull())
+ {
+ tab_type = LLPersonTabModel::FB_SL_NON_SL_FRIEND;
+ }
+ //FB only friend
+ else
+ {
+ tab_type = LLPersonTabModel::FB_ONLY_FRIEND;
+ }
+
+ //Add to person tab model
+ LLPersonTabModel * person_tab_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->getPersonTabModelByIndex(tab_type));
+ if (person_tab_model)
+ {
+ addParticipantToModel(person_tab_model, agent_id, name);
+ }
+ }
+ }
+
+ }
}
void LLPanelPeople::updateNearbyList()
@@ -953,63 +955,27 @@ void LLPanelPeople::updateRecentList()
mRecentList->setDirty();
}
-void LLPanelPeople::updateFacebookList()
+void LLPanelPeople::updateFacebookList(bool visible)
{
- if (mTryToConnectToFbc)
- {
- // try to reconnect to facebook!
- LLFacebookConnect::instance().getConnectionToFacebook();
-
- // don't try again
- mTryToConnectToFbc = false;
-
- // stop updating
- mFacebookListUpdater->setActive(false);
- }
-
- if (LLFacebookConnect::instance().generation() != mFacebookListGeneration)
- {
- mFacebookListGeneration = LLFacebookConnect::instance().generation();
- LLSD friends = LLFacebookConnect::instance().getContent();
-
- mFacebookFriends->clear();
- LLPersonTabModel::tab_type tab_type;
- LLAvatarTracker& avatar_tracker = LLAvatarTracker::instance();
-
- for (LLSD::map_const_iterator i = friends.beginMap(); i != friends.endMap(); ++i)
- {
- std::string name = i->second["name"].asString();
- LLUUID agent_id = i->second.has("agent_id") ? i->second["agent_id"].asUUID() : LLUUID(NULL);
- bool second_life_buddy = agent_id.notNull() ? avatar_tracker.isBuddy(agent_id) : false;
-
- //add to avatar list
- mFacebookFriends->addNewItem(agent_id, name, false);
-
- if(!second_life_buddy)
- {
- //FB+SL but not SL friend
- if (agent_id.notNull())
- {
- tab_type = LLPersonTabModel::FB_SL_NON_SL_FRIEND;
- }
- //FB only friend
- else
- {
- tab_type = LLPersonTabModel::FB_ONLY_FRIEND;
- }
+ if(visible)
+ {
+ LLFacebookConnect::instance().setContentUpdatedCallback(boost::bind(&LLPanelPeople::updateSuggestedFriendList, this));
- //Add to person tab model
- LLPersonTabModel * person_tab_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->getPersonTabModelByIndex(tab_type));
- if (person_tab_model)
- {
- addParticipantToModel(person_tab_model, agent_id, name);
- }
- }
- }
+ if (mTryToConnectToFbc)
+ {
+ // try to reconnect to facebook!
+ LLFacebookConnect::instance().getConnectionToFacebook();
+ // don't try again
+ mTryToConnectToFbc = false;
+ }
+
updateSuggestedFriendList();
- showFriendsAccordionsIfNeeded();
- }
+ }
+ else
+ {
+ LLFacebookConnect::instance().setContentUpdatedCallback(NULL);
+ }
}
void LLPanelPeople::updateButtons()
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index 633f475be7..1cd2a05e91 100755
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -88,7 +88,7 @@ private:
void updateSuggestedFriendList();
void updateNearbyList();
void updateRecentList();
- void updateFacebookList();
+ void updateFacebookList(bool visible);
bool isItemsFreeOfFriends(const uuid_vec_t& uuids);