diff options
author | Merov Linden <merov@lindenlab.com> | 2013-07-19 17:55:44 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2013-07-19 17:55:44 -0700 |
commit | ae4c17dee1cfc6a11ea165c5bd140d75203cfe69 (patch) | |
tree | 6bc814651ec67ea42b8bcf3e0d2bd5f776b1bd96 /indra/newview/llfacebookconnect.cpp | |
parent | 652ec2feeeb39c5c7ec9553563e3fdc29c66780d (diff) | |
parent | c3c61018cd2d6547c4976c04edc4d3212cf3fb31 (diff) |
Pull merge from lindenlab/viewer-fbc
Diffstat (limited to 'indra/newview/llfacebookconnect.cpp')
-rw-r--r-- | indra/newview/llfacebookconnect.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index eb9b93161c..f0b735c5ca 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -44,6 +44,7 @@ #include "llfloaterreg.h" boost::scoped_ptr<LLEventPump> LLFacebookConnect::sStateWatcher(new LLEventStream("FacebookConnectState")); +boost::scoped_ptr<LLEventPump> LLFacebookConnect::sInfoWatcher(new LLEventStream("FacebookConnectInfo")); boost::scoped_ptr<LLEventPump> LLFacebookConnect::sContentWatcher(new LLEventStream("FacebookConnectContent")); // Local functions @@ -246,6 +247,36 @@ private: /////////////////////////////////////////////////////////////////////////////// // +class LLFacebookInfoResponder : public LLHTTPClient::Responder +{ + LOG_CLASS(LLFacebookInfoResponder); +public: + + virtual void completed(U32 status, const std::string& reason, const LLSD& info) + { + if (isGoodStatus(status)) + { + llinfos << "Facebook: Info received" << llendl; + LL_DEBUGS("FacebookConnect") << "Getting Facebook info successful. info: " << info << LL_ENDL; + LLFacebookConnect::instance().storeInfo(info); + } + else + { + log_facebook_connect_error("Info", status, reason, info.get("error_code"), info.get("error_description")); + } + } + + void completedHeader(U32 status, const std::string& reason, const LLSD& content) + { + if (status == 302) + { + LLFacebookConnect::instance().openFacebookWeb(content["location"]); + } + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// class LLFacebookFriendsResponder : public LLHTTPClient::Responder { LOG_CLASS(LLFacebookFriendsResponder); @@ -333,6 +364,14 @@ void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) } } +void LLFacebookConnect::loadFacebookInfo() +{ + const bool follow_redirects = false; + const F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + LLHTTPClient::get(getFacebookConnectURL("/info"), new LLFacebookInfoResponder(), + LLSD(), timeout, follow_redirects); +} + void LLFacebookConnect::loadFacebookFriends() { const bool follow_redirects = false; @@ -431,6 +470,17 @@ void LLFacebookConnect::updateStatus(const std::string& message) LLHTTPClient::post(getFacebookConnectURL("/share/wall"), body, new LLFacebookShareResponder()); } +void LLFacebookConnect::storeInfo(const LLSD& info) +{ + mInfo = info; + sInfoWatcher->post(info); +} + +const LLSD& LLFacebookConnect::getInfo() const +{ + return mInfo; +} + void LLFacebookConnect::storeContent(const LLSD& content) { mGeneration++; |