summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-03-02 18:01:32 -0800
committerMerov Linden <merov@lindenlab.com>2014-03-02 18:01:32 -0800
commit66287bf951485edbba81039f88183a8bce769ad2 (patch)
tree67fee8c13986aadf95848dbe2ce27d52c67168f2
parent0fb59172f7c8c2ad2d3f4f77e14108fc16accdc7 (diff)
ACME-1335, ACME-1336 : Add callbacks to FB events so to update the FB friend lists in a timely manner
-rw-r--r--indra/newview/llfloaterfacebook.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp
index 9a08f5d581..a0b5b3e22d 100644
--- a/indra/newview/llfloaterfacebook.cpp
+++ b/indra/newview/llfloaterfacebook.cpp
@@ -840,7 +840,7 @@ void LLFacebookFriendsPanel::showFriendsAccordionsIfNeeded()
}
else
{
- // We have something in the lists, hide that
+ // We have something in the lists, hide the explanatory text
mFriendsStatusCaption->setVisible(false);
// Show the lists
@@ -860,6 +860,7 @@ void LLFacebookFriendsPanel::changed(U32 mask)
{
if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE))
{
+ LLFacebookConnect::instance().loadFacebookFriends();
updateFacebookList(true);
}
}
@@ -869,6 +870,14 @@ void LLFacebookFriendsPanel::updateFacebookList(bool visible)
{
if (visible)
{
+ // We want this to be called to fetch the friends list once a connection is established
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookFriendsPanel");
+ LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookFriendsPanel", boost::bind(&LLFacebookFriendsPanel::onConnectedToFacebook, this, _1));
+
+ // We then want this to be called to update the displayed lists once the list of friends is received
+ LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLFacebookFriendsPanel"); // just in case it is already listening
+ LLEventPumps::instance().obtain("FacebookConnectContent").listen("LLFacebookFriendsPanel", boost::bind(&LLFacebookFriendsPanel::updateSuggestedFriendList, this));
+
// Try to connect to Facebook
if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) ||
(LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED))