diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-03-29 15:28:41 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-03-29 15:28:41 -0700 |
commit | 11aed44bab1da46e0fadb458464e3cfd7ea2be43 (patch) | |
tree | def806e754313d42bd116bde1902c78640c5a89d /indra/newview/llpanelpeople.cpp | |
parent | ecbcef1224899d7f61860289fc079aae284a3360 (diff) |
Using curl to access pdp with the has-acces-token API and then upon receipt will open the webview when no token exists for the user.
Diffstat (limited to 'indra/newview/llpanelpeople.cpp')
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 10a783053b..e229fd3cf3 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1664,11 +1664,47 @@ void LLPanelPeople::openFacebookWeb(LLFloaterWebContent::Params& p) } } +class LLFacebookLogin : public LLHTTPClient::Responder +{ +public: + + LLPanelPeople * mPanelPeople; + + LLFacebookLogin(LLPanelPeople * panel_people) : mPanelPeople(panel_people) {} + + /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content) + { + // in case of invalid characters, the avatar picker returns a 400 + // just set it to process so it displays 'not found' + if (isGoodStatus(status) || status == 400) + { + llinfos << content << llendl; + + bool has_token = content["has_access_token"].asBoolean(); + + //use the token to pull down graph data + if(has_token) + { + + } + //request user to login + else + { + LLFloaterWebContent::Params p; + p.url("https://www.facebook.com/dialog/oauth?client_id=565771023434202&redirect_uri=https://pdp15.lindenlab.com/authenticate/" + gAgentID.asString()); + mPanelPeople->openFacebookWeb(p); + } + } + else + { + llinfos << "failed to get response. reason: " << reason << " status: " << status << llendl; + } + } +}; + void LLPanelPeople::onLoginFbcButtonClicked() { - LLFloaterWebContent::Params p; - p.url("https://www.facebook.com/dialog/oauth?client_id=565771023434202&redirect_uri=https://pdp15.lindenlab.com/authenticate/" + gAgentID.asString()); - openFacebookWeb(p); + LLHTTPClient::get("https://pdp15.lindenlab.com/has-access-token/" + gAgentID.asString(), new LLFacebookLogin(this)); } void LLPanelPeople::onFacebookAppRequestClicked() |