From 66287bf951485edbba81039f88183a8bce769ad2 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 2 Mar 2014 18:01:32 -0800 Subject: ACME-1335, ACME-1336 : Add callbacks to FB events so to update the FB friend lists in a timely manner --- indra/newview/llfloaterfacebook.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indra') 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)) -- cgit v1.2.3