diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-07-22 18:49:22 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-07-22 18:49:22 -0700 |
commit | 882b2508db4519b328016802ab72093df7911e68 (patch) | |
tree | 2f88accc75f6af4287eb7b5ab3f95e2399bd701c /indra/newview | |
parent | ccedada68154205eaab78e4bb188f7bebaa1e686 (diff) |
ACME-729 Implement the 'Use another account...' button
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfacebookconnect.cpp | 34 | ||||
-rw-r--r-- | indra/newview/llfacebookconnect.h | 1 | ||||
-rw-r--r-- | indra/newview/llfloatersocial.cpp | 2 |
3 files changed, 36 insertions, 1 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 7c1e7b3b16..0d6806d252 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -247,6 +247,35 @@ private: /////////////////////////////////////////////////////////////////////////////// // +class LLFacebookDisconnectThenConnectResponder : public LLHTTPClient::Responder +{ + LOG_CLASS(LLFacebookDisconnectThenConnectResponder); +public: + + virtual void completed(U32 status, const std::string& reason, const LLSD& content) + { + if (isGoodStatus(status)) + { + LL_DEBUGS("FacebookConnect") << "Disconnect successful. content: " << content << LL_ENDL; + + // Clear all facebook stuff + LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_NOT_CONNECTED); + LLFacebookConnect::instance().clearContent(); + + LLViewerMedia::clearAllCookies(); + + //Now attempt to reconnect + LLFacebookConnect::instance().checkConnectionToFacebook(true); + } + else + { + log_facebook_connect_error("Disconnect", status, reason, content.get("error_code"), content.get("error_description")); + } + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// class LLFacebookInfoResponder : public LLHTTPClient::Responder { LOG_CLASS(LLFacebookInfoResponder); @@ -363,6 +392,11 @@ void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) } } +void LLFacebookConnect::disconnectThenConnectToFacebook() +{ + LLHTTPClient::del(getFacebookConnectURL("/connection"), new LLFacebookDisconnectThenConnectResponder()); +} + void LLFacebookConnect::loadFacebookInfo() { const bool follow_redirects = false; diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h index 1dbc35c27f..b59c7090f6 100644 --- a/indra/newview/llfacebookconnect.h +++ b/indra/newview/llfacebookconnect.h @@ -57,6 +57,7 @@ public: void connectToFacebook(const std::string& auth_code = "", const std::string& auth_state = ""); // Initiate the complete FB connection. Please use checkConnectionToFacebook() in normal use. void disconnectFromFacebook(); // Disconnect from the FBC service. void checkConnectionToFacebook(bool auto_connect = false); // Check if an access token is available on the FBC service. If not, call connectToFacebook(). + void disconnectThenConnectToFacebook(); // Disconnects and then connects (for switching FB accounts) void loadFacebookInfo(); void loadFacebookFriends(); diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index e93a560f8f..f0bd1bb71a 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -750,7 +750,7 @@ void LLSocialAccountPanel::onConnect() void LLSocialAccountPanel::onUseAnotherAccount() { - + LLFacebookConnect::instance().disconnectThenConnectToFacebook(); } void LLSocialAccountPanel::onDisconnect() |