summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llfacebookconnect.cpp251
-rw-r--r--indra/newview/llfacebookconnect.h71
-rw-r--r--indra/newview/llpanelpeople.cpp304
-rw-r--r--indra/newview/llpanelpeople.h18
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml7
6 files changed, 391 insertions, 262 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 6b7fa7d842..44b1604b15 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -185,6 +185,7 @@ set(viewer_SOURCE_FILES
llexpandabletextbox.cpp
llexternaleditor.cpp
llface.cpp
+ llfacebookconnect.cpp
llfasttimerview.cpp
llfavoritesbar.cpp
llfeaturemanager.cpp
@@ -769,6 +770,7 @@ set(viewer_HEADER_FILES
llexpandabletextbox.h
llexternaleditor.h
llface.h
+ llfacebookconnect.h
llfasttimerview.h
llfavoritesbar.h
llfeaturemanager.h
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp
new file mode 100644
index 0000000000..7f8e3afe89
--- /dev/null
+++ b/indra/newview/llfacebookconnect.cpp
@@ -0,0 +1,251 @@
+/**
+ * @file llfacebookconnect.h
+ * @author Merov, Cho, Gil
+ * @brief Connection to Facebook Service
+ *
+ * $LicenseInfo:firstyear=2013&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2013, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfacebookconnect.h"
+
+#include "llagent.h"
+#include "llcallingcard.h" // for LLAvatarTracker
+//#include "llcommandhandler.h"
+#include "llhttpclient.h"
+
+///////////////////////////////////////////////////////////////////////////////
+//
+/*
+class LLFacebookConnectHandler : public LLCommandHandler
+{
+public:
+ LLFacebookConnectHandler() : LLCommandHandler("fbc", UNTRUSTED_THROTTLE) { }
+
+ bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
+ {
+ if (tokens.size() > 0)
+ {
+ if (tokens[0].asString() == "connect")
+ {
+ if (query_map.has("code"))
+ {
+ LLFacebookConnect::instance().connectToFacebook(query_map["code"]);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+};
+LLFacebookConnectHandler gFacebookConnectHandler;
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+//
+class LLFacebookConnectResponder : public LLHTTPClient::Responder
+{
+ LOG_CLASS(LLFacebookConnectResponder);
+public:
+
+ virtual void completed(U32 status, const std::string& reason, const LLSD& content)
+ {
+ if (isGoodStatus(status))
+ {
+ LL_DEBUGS("FacebookConnect") << "Connect successful. content: " << content << LL_ENDL;
+
+ // Grab some graph data now that we are connected
+ LLFacebookConnect::instance().setConnected(true);
+ LLFacebookConnect::instance().loadFacebookFriends();
+ }
+ else
+ {
+ LL_WARNS("FacebookConnect") << "Failed to get a response. reason: " << reason << " status: " << status << LL_ENDL;
+ }
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+class LLFacebookDisconnectResponder : public LLHTTPClient::Responder
+{
+ LOG_CLASS(LLFacebookDisconnectResponder);
+public:
+
+ virtual void completed(U32 status, const std::string& reason, const LLSD& content)
+ {
+ if (isGoodStatus(status))
+ {
+ LL_DEBUGS("FacebookConnect") << "Disconnect successful. content: " << content << LL_ENDL;
+
+ // Clear all facebook stuff
+ LLFacebookConnect::instance().setConnected(false);
+ LLFacebookConnect::instance().clearContent();
+ }
+ else
+ {
+ LL_WARNS("FacebookConnect") << "Failed to get a response. reason: " << reason << " status: " << status << LL_ENDL;
+ }
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+class LLFacebookConnectedResponder : public LLHTTPClient::Responder
+{
+ LOG_CLASS(LLFacebookConnectedResponder);
+public:
+
+ LLFacebookConnectedResponder(bool show_login_if_not_connected) : mShowLoginIfNotConnected(show_login_if_not_connected) {}
+
+ virtual void completed(U32 status, const std::string& reason, const LLSD& content)
+ {
+ if (isGoodStatus(status))
+ {
+ LL_DEBUGS("FacebookConnect") << "Connect successful. content: " << content << LL_ENDL;
+
+ // Grab some graph data if already connected
+ LLFacebookConnect::instance().setConnected(true);
+ LLFacebookConnect::instance().loadFacebookFriends();
+ }
+ else
+ {
+ LL_WARNS("FacebookConnect") << "Failed to get a response. reason: " << reason << " status: " << status << LL_ENDL;
+
+ // show the facebook login page if not connected yet
+ if ((status == 404) && mShowLoginIfNotConnected)
+ {
+ LLFacebookConnect::instance().connectToFacebook();
+ }
+ }
+ }
+
+private:
+ bool mShowLoginIfNotConnected;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+class LLFacebookFriendsResponder : public LLHTTPClient::Responder
+{
+ LOG_CLASS(LLFacebookFriendsResponder);
+public:
+
+ virtual void completed(U32 status, const std::string& reason, const LLSD& content)
+ {
+ if (isGoodStatus(status))
+ {
+ LL_DEBUGS("FacebookConnect") << "Getting Facebook friends successful. content: " << content << LL_ENDL;
+ LLFacebookConnect::instance().storeContent(content);
+ }
+ else
+ {
+ LL_WARNS("FacebookConnect") << "Failed to get a response. reason: " << reason << " status: " << status << LL_ENDL;
+ }
+ }
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+LLFacebookConnect::LLFacebookConnect()
+: mConnectedToFbc(false),
+ mContent(),
+ mGeneration(0)
+{
+}
+
+std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route)
+{
+ //static std::string sFacebookConnectUrl = gAgent.getRegion()->getCapability("FacebookConnect");
+ static std::string sFacebookConnectUrl = "https://pdp15.lindenlab.com/fbc/agent/" + gAgentID.asString(); // TEMPORARY HACK FOR FB DEMO - Cho
+ std::string url = sFacebookConnectUrl + route;
+ llinfos << url << llendl;
+ return url;
+}
+
+void LLFacebookConnect::connectToFacebook(const std::string& auth_code)
+{
+ LLSD body;
+ if (!auth_code.empty())
+ body["code"] = auth_code;
+
+ LLHTTPClient::put(getFacebookConnectURL("/connection"), body, new LLFacebookConnectResponder());
+}
+
+void LLFacebookConnect::disconnectFromFacebook()
+{
+ LLHTTPClient::del(getFacebookConnectURL("/connection"), new LLFacebookDisconnectResponder());
+}
+
+void LLFacebookConnect::tryToReconnectToFacebook()
+{
+ if (!mConnectedToFbc)
+ {
+ const bool follow_redirects=false;
+ const F32 timeout=HTTP_REQUEST_EXPIRY_SECS;
+ LLHTTPClient::get(getFacebookConnectURL("/connection"), new LLFacebookConnectedResponder(false),
+ LLSD(), timeout, follow_redirects);
+ }
+}
+
+void LLFacebookConnect::getConnectionToFacebook()
+{
+ const bool follow_redirects=false;
+ const F32 timeout=HTTP_REQUEST_EXPIRY_SECS;
+ LLHTTPClient::get(getFacebookConnectURL("/connection"), new LLFacebookConnectedResponder(true),
+ LLSD(), timeout, follow_redirects);
+}
+
+void LLFacebookConnect::loadFacebookFriends()
+{
+ const bool follow_redirects=false;
+ const F32 timeout=HTTP_REQUEST_EXPIRY_SECS;
+ LLHTTPClient::get(getFacebookConnectURL("/friend"), new LLFacebookFriendsResponder(),
+ LLSD(), timeout, follow_redirects);
+}
+
+void LLFacebookConnect::storeContent(const LLSD& content)
+{
+ mGeneration++;
+ mContent = content;
+}
+
+const LLSD& LLFacebookConnect::getContent() const
+{
+ return mContent;
+}
+
+void LLFacebookConnect::clearContent()
+{
+ mGeneration++;
+ mContent = LLSD();
+}
+
+
+
+
+
+
+
+
diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h
new file mode 100644
index 0000000000..691aaa9131
--- /dev/null
+++ b/indra/newview/llfacebookconnect.h
@@ -0,0 +1,71 @@
+/**
+ * @file llfacebookconnect.h
+ * @author Merov, Cho, Gil
+ * @brief Connection to Facebook Service
+ *
+ * $LicenseInfo:firstyear=2013&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2013, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFACEBOOKCONNECT_H
+#define LL_LLFACEBOOKCONNECT_H
+
+#include "llsingleton.h"
+
+/**
+ * @class LLFacebookConnect
+ *
+ * Manages authentication to, and interaction with, a web service allowing the
+ * the viewer to get Facebook OpenGraph data.
+ */
+class LLFacebookConnect : public LLSingleton<LLFacebookConnect>
+{
+ LOG_CLASS(LLFacebookConnect);
+public:
+ void connectToFacebook(const std::string& auth_code = "");
+ void disconnectFromFacebook();
+ void tryToReconnectToFacebook();
+ void getConnectionToFacebook();
+
+ void loadFacebookFriends();
+
+ void clearContent();
+ void storeContent(const LLSD& content);
+ const LLSD& getContent() const;
+
+ void setConnected(bool connected) { mConnectedToFbc = connected; }
+ bool getConnected() { return mConnectedToFbc; }
+ S32 generation() { return mGeneration; }
+
+private:
+
+ friend class LLSingleton<LLFacebookConnect>;
+
+ LLFacebookConnect();
+ ~LLFacebookConnect() {};
+ std::string getFacebookConnectURL(const std::string& route = "");
+
+ bool mConnectedToFbc;
+ LLSD mContent;
+ S32 mGeneration;
+};
+
+#endif // LL_LLFACEBOOKCONNECT_H
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 2bdfdf6687..542597f98b 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -54,8 +54,8 @@
#include "llcallingcard.h" // for LLAvatarTracker
#include "llcallbacklist.h"
#include "llerror.h"
+#include "llfacebookconnect.h"
#include "llfloateravatarpicker.h"
-//#include "llfloaterminiinspector.h"
#include "llfriendcard.h"
#include "llgroupactions.h"
#include "llgrouplist.h"
@@ -76,7 +76,6 @@
#include "llspeakers.h"
#include "llfloaterwebcontent.h"
#include "llurlaction.h"
-#include "llcommandhandler.h"
#define FRIEND_LIST_UPDATE_TIMEOUT 0.5
#define NEARBY_LIST_UPDATE_INTERVAL 1
@@ -91,35 +90,6 @@ static const std::string FBCTEST_TAB_NAME = "fbctest_panel";
static const std::string FBCTESTTWO_TAB_NAME = "fbctesttwo_panel";
static const std::string COLLAPSED_BY_USER = "collapsed_by_user";
-class LLFacebookConnectHandler : public LLCommandHandler
-{
-public:
- LLFacebookConnectHandler() : LLCommandHandler("fbc", UNTRUSTED_THROTTLE), mPanelPeople(NULL) { }
-
- LLPanelPeople* mPanelPeople;
-
- bool handle(const LLSD& tokens, const LLSD& query_map,
- LLMediaCtrl* web)
- {
- if (tokens.size() > 0)
- {
- if (tokens[0].asString() == "connect")
- {
- if (query_map.has("code"))
- {
- if (mPanelPeople)
- {
- mPanelPeople->connectToFacebook(query_map["code"]);
- mPanelPeople = NULL;
- }
- }
- return true;
- }
- }
- return false;
- }
-};
-LLFacebookConnectHandler gFacebookConnectHandler;
/** Comparator for comparing avatar items by last interaction date */
class LLAvatarItemRecentComparator : public LLAvatarItemComparator
@@ -577,7 +547,6 @@ private:
LLPanelPeople::LLPanelPeople()
: LLPanel(),
- mConnectedToFbc(false),
mPersonFolderView(NULL),
mTryToConnectToFbc(true),
mTabContainer(NULL),
@@ -586,12 +555,13 @@ LLPanelPeople::LLPanelPeople()
mNearbyList(NULL),
mRecentList(NULL),
mGroupList(NULL),
- mMiniMap(NULL)
+ mMiniMap(NULL),
+ mFacebookListGeneration(0)
{
mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::updateFriendList, this));
mNearbyListUpdater = new LLNearbyListUpdater(boost::bind(&LLPanelPeople::updateNearbyList, this));
mRecentListUpdater = new LLRecentListUpdater(boost::bind(&LLPanelPeople::updateRecentList, this));
- mFbcTestListUpdater = new LLFbcTestListUpdater(boost::bind(&LLPanelPeople::updateFbcTestList, 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));
@@ -626,7 +596,7 @@ LLPanelPeople::~LLPanelPeople()
delete mNearbyListUpdater;
delete mFriendListUpdater;
delete mRecentListUpdater;
- delete mFbcTestListUpdater;
+ delete mFacebookListUpdater;
if(LLVoiceClient::instanceExists())
{
@@ -714,13 +684,17 @@ BOOL LLPanelPeople::postBuild()
mAllFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
mOnlineFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
+ //===Temporary ========================================================================
+
LLPanel * social_tab = getChild<LLPanel>(FBCTEST_TAB_NAME);
mFacebookFriends = social_tab->getChild<LLSocialList>("facebook_friends");
- social_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFbcTestListUpdater, _2));
+ // 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));
//===Test START========================================================================
LLPanel * socialtwo_tab = getChild<LLPanel>(FBCTESTTWO_TAB_NAME);
+ socialtwo_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFacebookListUpdater, _2));
//Create folder view
LLPersonModelCommon* base_item = new LLPersonModelCommon(mPersonFolderViewModel);
@@ -943,19 +917,56 @@ void LLPanelPeople::updateRecentList()
mRecentList->setDirty();
}
-void LLPanelPeople::updateFbcTestList()
+void LLPanelPeople::updateFacebookList()
{
if (mTryToConnectToFbc)
{
// try to reconnect to facebook!
- tryToReconnectToFacebook();
+ LLFacebookConnect::instance().tryToReconnectToFacebook();
// don't try again
mTryToConnectToFbc = false;
// stop updating
- mFbcTestListUpdater->setActive(false);
+ 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);
+
+ //add to avatar list
+ mFacebookFriends->addNewItem(agent_id, name, false);
+
+ //FB+SL but not SL friend
+ if (agent_id.notNull() && !avatar_tracker.isBuddy(agent_id))
+ {
+ 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::updateButtons()
@@ -1634,45 +1645,12 @@ bool LLPanelPeople::isAccordionCollapsedByUser(const std::string& name)
return isAccordionCollapsedByUser(getChild<LLUICtrl>(name));
}
+/*
void LLPanelPeople::openFacebookWeb(std::string url)
{
- gFacebookConnectHandler.mPanelPeople = this;
LLUrlAction::openURLExternal(url);
}
-
-void LLPanelPeople::showFacebookFriends(const LLSD& friends)
-{
- 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);
-
- //add to avatar list
- mFacebookFriends->addNewItem(agent_id, name, false);
-
- //FB+SL but not SL friend
- if(agent_id.notNull() && !avatar_tracker.isBuddy(agent_id))
- {
- 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::addTestParticipant()
{
@@ -1730,187 +1708,15 @@ void LLPanelPeople::addParticipantToModel(LLPersonTabModel * person_folder_model
person_folder_model->addParticipant(person_model);
}
-void LLPanelPeople::hideFacebookFriends()
-{
- mFacebookFriends->clear();
-}
-
-class FacebookConnectResponder : public LLHTTPClient::Responder
-{
-public:
-
- LLPanelPeople * mPanelPeople;
-
- FacebookConnectResponder(LLPanelPeople * panel_people) : mPanelPeople(panel_people) {}
-
- /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content)
- {
- if (isGoodStatus(status))
- {
- llinfos << content << llendl;
-
- // grab some graph data now that we are connected
- mPanelPeople->mConnectedToFbc = true;
- mPanelPeople->loadFacebookFriends();
- }
- else
- {
- llinfos << "failed to get response. reason: " << reason << " status: " << status << llendl;
- }
- }
-
- /*virtual*/ void completedHeader(U32 status, const std::string& reason, const LLSD& content)
- {
- if (status == 302)
- {
- mPanelPeople->openFacebookWeb(content["location"]);
- }
- }
-};
-
-class FacebookDisconnectResponder : public LLHTTPClient::Responder
-{
-public:
-
- LLPanelPeople * mPanelPeople;
-
- FacebookDisconnectResponder(LLPanelPeople * panel_people) : mPanelPeople(panel_people) {}
-
- /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content)
- {
- if (isGoodStatus(status))
- {
- llinfos << content << llendl;
-
- // hide all the facebook stuff
- mPanelPeople->mConnectedToFbc = false;
- mPanelPeople->hideFacebookFriends();
- }
- else
- {
- llinfos << "failed to get response. reason: " << reason << " status: " << status << llendl;
- }
- }
-};
-
-class FacebookConnectedResponder : public LLHTTPClient::Responder
-{
-public:
-
- LLPanelPeople * mPanelPeople;
- bool mShowLoginIfNotConnected;
-
- FacebookConnectedResponder(LLPanelPeople * panel_people, bool show_login_if_not_connected) : mPanelPeople(panel_people), mShowLoginIfNotConnected(show_login_if_not_connected) {}
-
- /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content)
- {
- if (isGoodStatus(status))
- {
- llinfos << content << llendl;
-
- // grab some graph data if already connected
- mPanelPeople->mConnectedToFbc = true;
- mPanelPeople->loadFacebookFriends();
- }
- else
- {
- llinfos << "failed to get response. reason: " << reason << " status: " << status << llendl;
-
- // show the facebook login page if not connected yet
- if (status == 404 && mShowLoginIfNotConnected)
- {
- mPanelPeople->connectToFacebook();
- }
- }
- }
-};
-
-class FacebookFriendsResponder : public LLHTTPClient::Responder
-{
-public:
-
- LLPanelPeople * mPanelPeople;
-
- FacebookFriendsResponder(LLPanelPeople * panel_people) : mPanelPeople(panel_people) {}
-
- /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content)
- {
- if (isGoodStatus(status))
- {
- llinfos << content << llendl;
-
- // display the list of friends
- mPanelPeople->showFacebookFriends(content);
- }
- else
- {
- llinfos << "failed to get response. reason: " << reason << " status: " << status << llendl;
- }
- }
-
- /*virtual*/ void completedHeader(U32 status, const std::string& reason, const LLSD& content)
- {
- if (status == 302)
- {
- mPanelPeople->openFacebookWeb(content["location"]);
- }
- }
-};
-
-void LLPanelPeople::loadFacebookFriends()
-{
- const bool follow_redirects=false;
- const F32 timeout=HTTP_REQUEST_EXPIRY_SECS;
- LLHTTPClient::get(getFacebookConnectURL("/friend"), new FacebookFriendsResponder(this),
- LLSD(), timeout, follow_redirects);
-}
-
-void LLPanelPeople::tryToReconnectToFacebook()
-{
- if (!mConnectedToFbc)
- {
- const bool follow_redirects=false;
- const F32 timeout=HTTP_REQUEST_EXPIRY_SECS;
- LLHTTPClient::get(getFacebookConnectURL("/connection"), new FacebookConnectedResponder(this, false),
- LLSD(), timeout, follow_redirects);
- }
-}
-
-void LLPanelPeople::connectToFacebook(const std::string& auth_code)
-{
- LLSD body;
- if (!auth_code.empty())
- body["code"] = auth_code;
-
- LLHTTPClient::put(getFacebookConnectURL("/connection"), body, new FacebookConnectResponder(this));
-}
-
-void LLPanelPeople::disconnectFromFacebook()
-{
- LLHTTPClient::del(getFacebookConnectURL("/connection"), new FacebookDisconnectResponder(this));
-}
-
-std::string LLPanelPeople::getFacebookConnectURL(const std::string& route)
-{
- //static std::string sFacebookConnectUrl = gAgent.getRegion()->getCapability("FacebookConnect");
- static std::string sFacebookConnectUrl = "https://pdp15.lindenlab.com/fbc/agent/" + gAgentID.asString(); // TEMPORARY HACK FOR FB DEMO - Cho
- std::string url = sFacebookConnectUrl + route;
- llinfos << url << llendl;
- return url;
-}
-
void LLPanelPeople::onLoginFbcButtonClicked()
{
- if (mConnectedToFbc)
+ if (LLFacebookConnect::instance().getConnected())
{
- disconnectFromFacebook();
+ LLFacebookConnect::instance().disconnectFromFacebook();
}
else
{
- const bool follow_redirects=false;
- const F32 timeout=HTTP_REQUEST_EXPIRY_SECS;
- LLHTTPClient::get(getFacebookConnectURL("/connection"), new FacebookConnectedResponder(this, true),
- LLSD(), timeout, follow_redirects);
+ LLFacebookConnect::instance().getConnectionToFacebook();
}
}
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index 943d84ac1d..6b5514deaf 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -62,20 +62,11 @@ public:
static void idle(void * user_data);
- void openFacebookWeb(std::string url);
- void showFacebookFriends(const LLSD& friends);
+// void openFacebookWeb(std::string url);
void addTestParticipant();
void addParticipantToModel(LLPersonTabModel * session_model, const LLUUID& agent_id, const std::string& name);
- void hideFacebookFriends();
- void loadFacebookFriends();
- void tryToReconnectToFacebook();
- void connectToFacebook(const std::string& auth_code = "");
- void disconnectFromFacebook();
- std::string getFacebookConnectURL(const std::string& route = "");
-
- bool mConnectedToFbc;
- bool mTryToConnectToFbc;
+ bool mTryToConnectToFbc;
// internals
class Updater;
@@ -97,7 +88,7 @@ private:
void updateFriendList();
void updateNearbyList();
void updateRecentList();
- void updateFbcTestList();
+ void updateFacebookList();
bool isItemsFreeOfFriends(const uuid_vec_t& uuids);
@@ -161,6 +152,7 @@ private:
LLAvatarList* mRecentList;
LLGroupList* mGroupList;
LLSocialList* mFacebookFriends;
+ S32 mFacebookListGeneration;
LLNetMap* mMiniMap;
std::vector<std::string> mSavedOriginalFilters;
@@ -171,7 +163,7 @@ private:
Updater* mFriendListUpdater;
Updater* mNearbyListUpdater;
Updater* mRecentListUpdater;
- Updater* mFbcTestListUpdater;
+ Updater* mFacebookListUpdater;
Updater* mButtonsUpdater;
LLMenuButton* mFBCGearButton;
LLHandle< LLFloater > mPicker;
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 39e777b246..9ce360415c 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -16,6 +16,13 @@
parameter="agent" />
</menu_item_call>
<menu_item_call
+ label="Connect to Facebook..."
+ name="ConnectToFacebook">
+ <menu_item_call.on_click
+ function="People.loginFBC" />
+ </menu_item_call>
+ <menu_item_separator/>
+ <menu_item_call
label="Appearance..."
name="ChangeOutfit">
<menu_item_call.on_click