summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2013-04-16 19:35:00 -0700
committerGilbert Gonzales <gilbert@lindenlab.com>2013-04-16 19:35:00 -0700
commit9d615bbb444b8d7f61bf1c81e165ec9fa2eb4d8c (patch)
tree0a35baa2cf9f5830ad7830cd639eb08c0cb410fd /indra/newview
parent7f0798fd6dad069aca44b954aa0fb7e49d42198c (diff)
parent828334ac553182e6e9db6806c3a1b8203e64bc43 (diff)
merge
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelpeople.cpp68
1 files changed, 21 insertions, 47 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 6864381404..94b60ca2d6 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -1712,10 +1712,10 @@ void LLPanelPeople::showFacebookFriends(const LLSD& friends)
{
mFacebookFriends->clear();
- for (LLSD::array_const_iterator i = friends.beginArray(); i != friends.endArray(); ++i)
+ for (LLSD::map_const_iterator i = friends.beginMap(); i != friends.endMap(); ++i)
{
- std::string name = (*i)["name"].asString();
- LLUUID agent_id = (*i).has("agent_id") ? (*i)["agent_id"].asUUID() : LLUUID(NULL);
+ std::string name = i->second["name"].asString();
+ LLUUID agent_id = i->second.has("agent_id") ? i->second["agent_id"].asUUID() : LLUUID(NULL);
mFacebookFriends->addNewItem(agent_id, name, false);
}
@@ -1763,15 +1763,8 @@ public:
llinfos << content << llendl;
// grab some graph data now that we are connected
- if (content["success"])
- {
- mPanelPeople->mConnectedToFbc = true;
- mPanelPeople->loadFacebookFriends();
- }
- else if (content.has("error"))
- {
- llinfos << "failed to connect. reason: " << content["error"]["message"] << llendl;
- }
+ mPanelPeople->mConnectedToFbc = true;
+ mPanelPeople->loadFacebookFriends();
}
else
{
@@ -1795,15 +1788,8 @@ public:
llinfos << content << llendl;
// hide all the facebook stuff
- if (content["success"])
- {
- mPanelPeople->mConnectedToFbc = false;
- mPanelPeople->hideFacebookFriends();
- }
- else if (content.has("error"))
- {
- llinfos << "failed to disconnect. reason: " << content["error"]["message"] << llendl;
- }
+ mPanelPeople->mConnectedToFbc = false;
+ mPanelPeople->hideFacebookFriends();
}
else
{
@@ -1828,23 +1814,21 @@ public:
llinfos << content << llendl;
// grab some graph data if already connected
- if (content["connected"])
- {
- mPanelPeople->mConnectedToFbc = true;
- mPanelPeople->loadFacebookFriends();
- }
+ 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
- else if (mShowLoginIfNotConnected)
+ if (status == 404 && mShowLoginIfNotConnected)
{
LLFloaterWebContent::Params p;
p.url("https://www.facebook.com/dialog/oauth?client_id=565771023434202&redirect_uri=" + mPanelPeople->getFacebookRedirectURL());
mPanelPeople->openFacebookWeb(p);
}
}
- else
- {
- llinfos << "failed to get response. reason: " << reason << " status: " << status << llendl;
- }
}
};
@@ -1863,14 +1847,7 @@ public:
llinfos << content << llendl;
// display the list of friends
- if (content.has("friends") && !content.has("error"))
- {
- mPanelPeople->showFacebookFriends(content["friends"]);
- }
- else if (content.has("error"))
- {
- llinfos << "failed to get facebook friends. reason: " << content["error"]["message"] << llendl;
- }
+ mPanelPeople->showFacebookFriends(content);
}
else
{
@@ -1881,31 +1858,28 @@ public:
void LLPanelPeople::loadFacebookFriends()
{
- LLHTTPClient::get(getFacebookConnectURL("/friends"), new FacebookFriendsResponder(this));
+ LLHTTPClient::get(getFacebookConnectURL("/friend"), new FacebookFriendsResponder(this));
}
void LLPanelPeople::tryToReconnectToFacebook()
{
if (!mConnectedToFbc)
{
- LLHTTPClient::get(getFacebookConnectURL(), new FacebookConnectedResponder(this, false));
+ LLHTTPClient::get(getFacebookConnectURL("/connection"), new FacebookConnectedResponder(this, false));
}
}
void LLPanelPeople::connectToFacebook(const std::string& auth_code)
{
LLSD body;
- body["agent_id"] = gAgentID.asString();
body["code"] = auth_code;
body["redirect_uri"] = getFacebookRedirectURL();
- LLHTTPClient::post(getFacebookConnectURL("/connect"), body, new FacebookConnectResponder(this));
+ LLHTTPClient::put(getFacebookConnectURL("/connection"), body, new FacebookConnectResponder(this));
}
void LLPanelPeople::disconnectFromFacebook()
{
- LLSD body;
- body["agent_id"] = gAgentID.asString();
- LLHTTPClient::post(getFacebookConnectURL("/disconnect"), body, new FacebookDisconnectResponder(this));
+ LLHTTPClient::del(getFacebookConnectURL("/connection"), new FacebookDisconnectResponder(this));
}
std::string LLPanelPeople::getFacebookConnectURL(const std::string& route)
@@ -1931,7 +1905,7 @@ void LLPanelPeople::onLoginFbcButtonClicked()
}
else
{
- LLHTTPClient::get(getFacebookConnectURL(), new FacebookConnectedResponder(this, true));
+ LLHTTPClient::get(getFacebookConnectURL("/connection"), new FacebookConnectedResponder(this, true));
}
}