summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCho <cho@lindenlab.com>2013-07-04 01:29:54 +0100
committerCho <cho@lindenlab.com>2013-07-04 01:29:54 +0100
commitad8aeecb8331ca68eef9a12536c80a4658885ccb (patch)
tree6148fe3c447015dfc2a46aaad685c91140913311
parent1dbabed6b5bac8a0fcc1d9a70522eb726e01bae7 (diff)
Added auto-connect upon 404 from a POST in LLFacebookConnect, and added FB_POSTED state, for ACME-667
-rw-r--r--indra/newview/llfacebookconnect.cpp6
-rw-r--r--indra/newview/llfacebookconnect.h5
-rw-r--r--indra/newview/llfloatersocial.cpp51
3 files changed, 41 insertions, 21 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp
index 30fb63084b..07204531de 100644
--- a/indra/newview/llfacebookconnect.cpp
+++ b/indra/newview/llfacebookconnect.cpp
@@ -145,7 +145,11 @@ public:
toast_user_for_success();
LL_DEBUGS("FacebookConnect") << "Post successful. content: " << content << LL_ENDL;
- LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTED);
+ LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_POSTED);
+ }
+ else if (status == 404)
+ {
+ LLFacebookConnect::instance().connectToFacebook();
}
else
{
diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h
index ddff87385e..b37c713ae5 100644
--- a/indra/newview/llfacebookconnect.h
+++ b/indra/newview/llfacebookconnect.h
@@ -50,7 +50,8 @@ public:
FB_CONNECTED = 2,
FB_CONNECTION_FAILED = 3,
FB_POSTING = 4,
- FB_POST_FAILED = 5
+ FB_POSTED = 5,
+ FB_POST_FAILED = 6
};
typedef boost::function<void(bool ok)> share_callback_t;
@@ -76,7 +77,7 @@ public:
const LLSD& getContent() const;
void setConnectionState(EConnectionState connection_state);
- bool isConnected() { return ((mConnectionState == FB_CONNECTED) || (mConnectionState == FB_POSTING)); }
+ bool isConnected() { return ((mConnectionState == FB_CONNECTED) || (mConnectionState == FB_POSTING) || (mConnectionState == FB_POSTED)); }
EConnectionState getConnectionState() { return mConnectionState; }
S32 generation() { return mGeneration; }
diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index 67a9f0c742..eb3ceaf96e 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -96,6 +96,9 @@ void LLSocialStatusPanel::draw()
void LLSocialStatusPanel::onSend()
{
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); // just in case it is already listening
+ LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onFacebookConnectStateChange, this, _1));
+
// Connect to Facebook if necessary and then post
if (LLFacebookConnect::instance().isConnected())
{
@@ -103,19 +106,21 @@ void LLSocialStatusPanel::onSend()
}
else
{
- LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); // just in case it is already listening
- LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onFacebookConnectStateChange, this, _1));
LLFacebookConnect::instance().checkConnectionToFacebook(true);
}
}
bool LLSocialStatusPanel::onFacebookConnectStateChange(const LLSD& data)
{
- if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED)
+ switch (data.get("enum").asInteger())
{
- LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel");
-
- sendStatus();
+ case LLFacebookConnect::FB_CONNECTED:
+ sendStatus();
+ break;
+
+ case LLFacebookConnect::FB_POSTED:
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel");
+ break;
}
return false;
@@ -304,6 +309,9 @@ void LLSocialPhotoPanel::onClickNewSnapshot()
void LLSocialPhotoPanel::onSend()
{
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); // just in case it is already listening
+ LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onFacebookConnectStateChange, this, _1));
+
// Connect to Facebook if necessary and then post
if (LLFacebookConnect::instance().isConnected())
{
@@ -311,19 +319,21 @@ void LLSocialPhotoPanel::onSend()
}
else
{
- LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); // just in case it is already listening
- LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onFacebookConnectStateChange, this, _1));
LLFacebookConnect::instance().checkConnectionToFacebook(true);
}
}
bool LLSocialPhotoPanel::onFacebookConnectStateChange(const LLSD& data)
{
- if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED)
+ switch (data.get("enum").asInteger())
{
- LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel");
-
- sendPhoto();
+ case LLFacebookConnect::FB_CONNECTED:
+ sendPhoto();
+ break;
+
+ case LLFacebookConnect::FB_POSTED:
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel");
+ break;
}
return false;
@@ -530,6 +540,9 @@ void LLSocialCheckinPanel::draw()
void LLSocialCheckinPanel::onSend()
{
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); // just in case it is already listening
+ LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onFacebookConnectStateChange, this, _1));
+
// Connect to Facebook if necessary and then post
if (LLFacebookConnect::instance().isConnected())
{
@@ -537,19 +550,21 @@ void LLSocialCheckinPanel::onSend()
}
else
{
- LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); // just in case it is already listening
- LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onFacebookConnectStateChange, this, _1));
LLFacebookConnect::instance().checkConnectionToFacebook(true);
}
}
bool LLSocialCheckinPanel::onFacebookConnectStateChange(const LLSD& data)
{
- if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED)
+ switch (data.get("enum").asInteger())
{
- LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel");
-
- sendCheckin();
+ case LLFacebookConnect::FB_CONNECTED:
+ sendCheckin();
+ break;
+
+ case LLFacebookConnect::FB_POSTED:
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel");
+ break;
}
return false;