summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-07-23 17:18:14 -0700
committerMerov Linden <merov@lindenlab.com>2013-07-23 17:18:14 -0700
commit4035f23681ae1834804196ec7b17010263e29b3b (patch)
tree8eff172ec53eb82ae1916c0ebcb0dffb4adcdfb3 /indra/newview
parent05c2e087153a9816de2c6218c2509cbdb935ccf0 (diff)
parent66d41f02ba0e55a2cb34752c8f77b71b9a0c0503 (diff)
Pull merge from lindenlab/viewer-fbc
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfacebookconnect.cpp46
-rw-r--r--indra/newview/llfacebookconnect.h6
-rw-r--r--indra/newview/llfloatersocial.cpp25
-rw-r--r--indra/newview/llfloatersocial.h1
-rw-r--r--indra/newview/skins/default/xui/en/floater_social.xml2
-rwxr-xr-xindra/newview/skins/default/xui/en/strings.xml1
6 files changed, 76 insertions, 5 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp
index 7c1e7b3b16..cccfb6f2b8 100644
--- a/indra/newview/llfacebookconnect.cpp
+++ b/indra/newview/llfacebookconnect.cpp
@@ -181,7 +181,12 @@ class LLFacebookDisconnectResponder : public LLHTTPClient::Responder
{
LOG_CLASS(LLFacebookDisconnectResponder);
public:
-
+
+ LLFacebookDisconnectResponder()
+ {
+ LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_DISCONNECTING);
+ }
+
virtual void completed(U32 status, const std::string& reason, const LLSD& content)
{
if (isGoodStatus(status))
@@ -247,6 +252,40 @@ private:
///////////////////////////////////////////////////////////////////////////////
//
+class LLFacebookDisconnectThenConnectResponder : public LLHTTPClient::Responder
+{
+ LOG_CLASS(LLFacebookDisconnectThenConnectResponder);
+public:
+
+ LLFacebookDisconnectThenConnectResponder()
+ {
+ LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_DISCONNECTING);
+ }
+
+ 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 +402,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..f74b9f7d41 100644
--- a/indra/newview/llfacebookconnect.h
+++ b/indra/newview/llfacebookconnect.h
@@ -51,12 +51,14 @@ public:
FB_CONNECTION_FAILED = 3,
FB_POSTING = 4,
FB_POSTED = 5,
- FB_POST_FAILED = 6
+ FB_POST_FAILED = 6,
+ FB_DISCONNECTING = 7
};
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();
@@ -72,7 +74,7 @@ public:
const LLSD& getContent() const;
void setConnectionState(EConnectionState connection_state);
- bool isConnected() { return ((mConnectionState == FB_CONNECTED) || (mConnectionState == FB_POSTING) || (mConnectionState == FB_POSTED)); }
+ bool isConnected() { return ((mConnectionState == FB_CONNECTED) || (mConnectionState == FB_DISCONNECTING) || (mConnectionState == FB_POSTING) || (mConnectionState == FB_POSTED)); }
bool isTransactionOngoing() { return ((mConnectionState == FB_CONNECTION_IN_PROGRESS) || (mConnectionState == FB_POSTING)); }
EConnectionState getConnectionState() { return mConnectionState; }
S32 generation() { return mGeneration; }
diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index 6fd3650c7b..3c8d4d6fb9 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -641,6 +641,22 @@ BOOL LLSocialAccountPanel::postBuild()
return LLPanel::postBuild();
}
+void LLSocialAccountPanel::draw()
+{
+ LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState();
+
+ //Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress
+ bool disconnecting = connection_state == LLFacebookConnect::FB_DISCONNECTING;
+ mDisconnectButton->setEnabled(!disconnecting);
+ mUseAnotherAccountButton->setEnabled(!disconnecting);
+
+ //Disable the 'connect' button when a connection is in progress
+ bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS;
+ mConnectButton->setEnabled(!connecting);
+
+ LLPanel::draw();
+}
+
void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility)
{
bool visible = new_visibility.asBoolean();
@@ -748,7 +764,7 @@ void LLSocialAccountPanel::onConnect()
void LLSocialAccountPanel::onUseAnotherAccount()
{
-
+ LLFacebookConnect::instance().disconnectThenConnectToFacebook();
}
void LLSocialAccountPanel::onDisconnect()
@@ -862,6 +878,13 @@ void LLFloaterSocial::draw()
status_text = LLTrans::getString("SocialFacebookErrorPosting");
mStatusErrorText->setValue(status_text);
break;
+ case LLFacebookConnect::FB_DISCONNECTING:
+ // Disconnecting loading indicator
+ mStatusLoadingText->setVisible(true);
+ status_text = LLTrans::getString("SocialFacebookDisconnecting");
+ mStatusLoadingText->setValue(status_text);
+ mStatusLoadingIndicator->setVisible(true);
+ break;
}
}
LLFloater::draw();
diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h
index f947207fbe..13c29e7028 100644
--- a/indra/newview/llfloatersocial.h
+++ b/indra/newview/llfloatersocial.h
@@ -120,6 +120,7 @@ class LLSocialAccountPanel : public LLPanel
public:
LLSocialAccountPanel();
BOOL postBuild();
+ void draw();
private:
void onVisibilityChange(const LLSD& new_visibility);
diff --git a/indra/newview/skins/default/xui/en/floater_social.xml b/indra/newview/skins/default/xui/en/floater_social.xml
index eb209eb314..3eff2c2ae1 100644
--- a/indra/newview/skins/default/xui/en/floater_social.xml
+++ b/indra/newview/skins/default/xui/en/floater_social.xml
@@ -10,7 +10,7 @@
save_rect="true"
single_instance="true"
reuse_instance="true"
- title="FACEBOOK"
+ title="POST TO FACEBOOK"
height="482"
width="304">
<panel
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 5067922b88..02b64ef7e3 100755
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -153,6 +153,7 @@ Please try logging in again in a minute.</string>
<string name="SocialFacebookPosting">Posting...</string>
<string name="SocialFacebookErrorConnecting">Problem connecting to Facebook</string>
<string name="SocialFacebookErrorPosting">Problem posting to Facebook</string>
+ <string name="SocialFacebookDisconnecting">Disconnecting from Facebook...</string>
<!-- Tooltip -->
<string name="TooltipPerson">Person</string><!-- Object under mouse pointer is an avatar -->