diff options
| author | Merov Linden <merov@lindenlab.com> | 2013-05-20 19:32:55 -0700 |
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2013-05-20 19:32:55 -0700 |
| commit | 53ed2e4ac67088dce27f4c391d3e980e2d63154b (patch) | |
| tree | bcf655df4baa6b8befb58c28bf90fe4a9e697b46 /indra/newview/llfacebookconnect.cpp | |
| parent | 7ba7f6d3c2db80e412e5658a5c6ce8755b75997b (diff) | |
ACME-381 : Implement experimental checkin feature (used to test publish_actions permissions workflow)
Diffstat (limited to 'indra/newview/llfacebookconnect.cpp')
| -rw-r--r-- | indra/newview/llfacebookconnect.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 39aa82dc7a..eb70cf4d10 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -96,6 +96,35 @@ public: /////////////////////////////////////////////////////////////////////////////// // +class LLFacebookPostResponder : public LLHTTPClient::Responder +{ + LOG_CLASS(LLFacebookPostResponder); +public: + + virtual void completed(U32 status, const std::string& reason, const LLSD& content) + { + if (isGoodStatus(status)) + { + LL_DEBUGS("FacebookConnect") << "Post successful. content: " << content << LL_ENDL; + } + else + { + LL_WARNS("FacebookConnect") << "Failed to get a post response. reason: " << reason << " status: " << status << LL_ENDL; + } + } + + void completedHeader(U32 status, const std::string& reason, const LLSD& content) + { + if (status == 302) + { + LLFacebookConnect::instance().openFacebookWeb(content["location"]); + } + } + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class LLFacebookDisconnectResponder : public LLHTTPClient::Responder { LOG_CLASS(LLFacebookDisconnectResponder); @@ -247,6 +276,20 @@ void LLFacebookConnect::loadFacebookFriends() LLSD(), timeout, follow_redirects); } +void LLFacebookConnect::postCheckinMessage(const std::string& message, const std::string& url) +{ + // Note: We need to improve the API support to provide all the relevant data if possible + // Full set described : http://facebook-python-library.docs-library.appspot.com/facebook-python/library-manual.html + LLSD body; + if (!message.empty()) + body["message"] = message; + if (!url.empty()) + body["link"] = url; + + // Note: we can use that route for different publish action. We should be able to use the same responder. + LLHTTPClient::post(getFacebookConnectURL("/share"), body, new LLFacebookPostResponder()); +} + void LLFacebookConnect::storeContent(const LLSD& content) { mGeneration++; |
