diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 42 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.h | 2 |
2 files changed, 40 insertions, 4 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() diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 39cdbc9bd7..dadd273603 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -55,6 +55,7 @@ public: // Implements LLVoiceClientStatusObserver::onChange() to enable call buttons // when voice is available /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal); + void openFacebookWeb(LLFloaterWebContent::Params& p); // internals class Updater; @@ -118,7 +119,6 @@ private: void onLoginFbcButtonClicked(); void onFacebookAppRequestClicked(); void onFacebookAppSendClicked(); - void openFacebookWeb(LLFloaterWebContent::Params& p); //returns false only if group is "none" bool isRealGroup(); |