From 4ed5e21ae3fe069126bd43ae0785aa74ba3d0cf7 Mon Sep 17 00:00:00 2001
From: Cho <cho@lindenlab.com>
Date: Wed, 3 Jul 2013 22:07:50 +0100
Subject: made some slight reorganizations for ACME-662

---
 indra/newview/llfloatersocial.cpp | 137 +++++++++++++++++++++-----------------
 indra/newview/llfloatersocial.h   |  12 +++-
 2 files changed, 86 insertions(+), 63 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index a0dbb7ea95..57b6cccd32 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -96,37 +96,39 @@ void LLSocialStatusPanel::draw()
 
 void LLSocialStatusPanel::onSend()
 {
-	if (mMessageTextEditor)
+	// Connect to Facebook if necessary and then post
+	if (LLFacebookConnect::instance().isConnected())
 	{
-		std::string message = mMessageTextEditor->getValue().asString();
-		if (!message.empty())
-		{
-			// Connect to Facebook if necessary and then post
-			if (LLFacebookConnect::instance().isConnected())
-			{
-				LLFacebookConnect::instance().updateStatus(message);
-			}
-			else
-			{
-				LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onConnectedToFacebook, this, _1, message));
-				LLFacebookConnect::instance().checkConnectionToFacebook(true);
-			}
-		}
+		sendStatus();
+	}
+	else
+	{
+		LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onFacebookConnectStateChange, this, _1));
+		LLFacebookConnect::instance().checkConnectionToFacebook(true);
 	}
 }
 
-bool LLSocialStatusPanel::onConnectedToFacebook(const LLSD& data, const std::string& message)
+bool LLSocialStatusPanel::onFacebookConnectStateChange(const LLSD& data)
 {
 	if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED)
 	{
 		LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel");
 		
-		LLFacebookConnect::instance().updateStatus(message);
+		sendStatus();
 	}
 
 	return false;
 }
 
+void LLSocialStatusPanel::sendStatus()
+{
+	std::string message = mMessageTextEditor->getValue().asString();
+	if (!message.empty())
+	{
+		LLFacebookConnect::instance().updateStatus(message);
+	}
+}
+
 ///////////////////////////
 //LLSocialPhotoPanel///////
 ///////////////////////////
@@ -301,47 +303,56 @@ void LLSocialPhotoPanel::onClickNewSnapshot()
 
 void LLSocialPhotoPanel::onSend()
 {
-	std::string caption = mCaptionTextBox->getValue().asString();
-	bool add_location = mLocationCheckbox->getValue().asBoolean();
-
-	if (add_location)
-	{
-		LLSLURL slurl;
-		LLAgentUI::buildSLURL(slurl);
-		if (caption.empty())
-			caption = slurl.getSLURLString();
-		else
-			caption = caption + " " + slurl.getSLURLString();
-	}
-
-	LLSnapshotLivePreview* previewp = getPreviewView();
-	
 	// Connect to Facebook if necessary and then post
 	if (LLFacebookConnect::instance().isConnected())
 	{
-		LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption);
+		sendPhoto();
 	}
 	else
 	{
-		LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onConnectedToFacebook, this, _1, previewp->getFormattedImage(), caption));
+		LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onFacebookConnectStateChange, this, _1));
 		LLFacebookConnect::instance().checkConnectionToFacebook(true);
 	}
-
-	updateControls();
 }
 
-bool LLSocialPhotoPanel::onConnectedToFacebook(const LLSD& data, LLPointer<LLImageFormatted> image, const std::string& caption)
+bool LLSocialPhotoPanel::onFacebookConnectStateChange(const LLSD& data)
 {
 	if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED)
 	{
 		LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel");
 		
-		LLFacebookConnect::instance().sharePhoto(image, caption);
+		sendPhoto();
 	}
 
 	return false;
 }
 
+void LLSocialPhotoPanel::sendPhoto()
+{
+	// Get the caption
+	std::string caption = mCaptionTextBox->getValue().asString();
+
+	// Add the location if required
+	bool add_location = mLocationCheckbox->getValue().asBoolean();
+	if (add_location)
+	{
+		LLSLURL slurl;
+		LLAgentUI::buildSLURL(slurl);
+		if (caption.empty())
+			caption = slurl.getSLURLString();
+		else
+			caption = caption + " " + slurl.getSLURLString();
+	}
+
+	// Get the image
+	LLSnapshotLivePreview* previewp = getPreviewView();
+	
+	// Post to Facebook
+	LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption);
+
+	updateControls();
+}
+
 void LLSocialPhotoPanel::updateControls()
 {
 	LLSnapshotLivePreview* previewp = getPreviewView();
@@ -516,6 +527,32 @@ void LLSocialCheckinPanel::draw()
 }
 
 void LLSocialCheckinPanel::onSend()
+{
+	// Connect to Facebook if necessary and then post
+	if (LLFacebookConnect::instance().isConnected())
+	{
+		sendCheckin();
+	}
+	else
+	{
+		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)
+	{
+		LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel");
+		
+		sendCheckin();
+	}
+
+	return false;
+}
+
+void LLSocialCheckinPanel::sendCheckin()
 {
 	// Get the location SLURL
 	LLSLURL slurl;
@@ -536,28 +573,8 @@ void LLSocialCheckinPanel::onSend()
 	// Get the caption
 	std::string caption = getChild<LLUICtrl>("place_caption")->getValue().asString();
 
-	// Connect to Facebook if necessary and then post
-	if (LLFacebookConnect::instance().isConnected())
-	{
-		LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption);
-	}
-	else
-	{
-		LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onConnectedToFacebook, this, _1, slurl_string, region_name, description, map_url, caption));
-		LLFacebookConnect::instance().checkConnectionToFacebook(true);
-	}
-}
-
-bool LLSocialCheckinPanel::onConnectedToFacebook(const LLSD& data, const std::string& location, const std::string& name, const std::string& description, const std::string& picture, const std::string& message)
-{
-	if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED)
-	{
-		LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel");
-		
-		LLFacebookConnect::instance().postCheckin(location, name, description, picture, message);
-	}
-
-	return false;
+	// Post to Facebook
+	LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption);
 }
 
 ////////////////////////
diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h
index 07236c2838..e37facbbce 100644
--- a/indra/newview/llfloatersocial.h
+++ b/indra/newview/llfloatersocial.h
@@ -42,7 +42,9 @@ public:
 	BOOL postBuild();
 	void draw();
     void onSend();
-	bool onConnectedToFacebook(const LLSD& data, const std::string& message);
+	bool onFacebookConnectStateChange(const LLSD& data);
+
+	void sendStatus();
 
 private:
 	LLUICtrl* mMessageTextEditor;
@@ -62,7 +64,9 @@ public:
 	void onVisibilityChange(const LLSD& new_visibility);
 	void onClickNewSnapshot();
 	void onSend();
-	bool onConnectedToFacebook(const LLSD& data, LLPointer<LLImageFormatted> image, const std::string& caption);
+	bool onFacebookConnectStateChange(const LLSD& data);
+
+	void sendPhoto();
 
 	void updateControls();
 	void updateResolution(BOOL do_update);
@@ -94,7 +98,9 @@ public:
 	BOOL postBuild();
 	void draw();
     void onSend();
-	bool onConnectedToFacebook(const LLSD& data, const std::string& location, const std::string& name, const std::string& description, const std::string& picture, const std::string& message);
+	bool onFacebookConnectStateChange(const LLSD& data);
+
+	void sendCheckin();
 
 private:
     std::string mMapUrl;
-- 
cgit v1.2.3


From 1dbabed6b5bac8a0fcc1d9a70522eb726e01bae7 Mon Sep 17 00:00:00 2001
From: Cho <cho@lindenlab.com>
Date: Wed, 3 Jul 2013 23:42:02 +0100
Subject: made listeners more robust in llfloatersocial.cpp for ACME-665

---
 indra/newview/llfloatersocial.cpp | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index 57b6cccd32..67a9f0c742 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -103,6 +103,7 @@ 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);
 	}
@@ -310,6 +311,7 @@ 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);
 	}
@@ -535,6 +537,7 @@ 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);
 	}
-- 
cgit v1.2.3


From ad8aeecb8331ca68eef9a12536c80a4658885ccb Mon Sep 17 00:00:00 2001
From: Cho <cho@lindenlab.com>
Date: Thu, 4 Jul 2013 01:29:54 +0100
Subject: Added auto-connect upon 404 from a POST in LLFacebookConnect, and
 added FB_POSTED state, for ACME-667

---
 indra/newview/llfacebookconnect.cpp |  6 ++++-
 indra/newview/llfacebookconnect.h   |  5 ++--
 indra/newview/llfloatersocial.cpp   | 51 ++++++++++++++++++++++++-------------
 3 files changed, 41 insertions(+), 21 deletions(-)

(limited to 'indra')

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;
-- 
cgit v1.2.3


From fd4262541946770515ce8a486dd3a69245365def Mon Sep 17 00:00:00 2001
From: Cho <cho@lindenlab.com>
Date: Thu, 4 Jul 2013 02:01:51 +0100
Subject: Close floater and clear text upon FB_POSTED for ACME-668

---
 indra/newview/llfloatersocial.cpp | 38 ++++++++++++++++++++++++++++++++++++++
 indra/newview/llfloatersocial.h   |  3 +++
 2 files changed, 41 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index eb3ceaf96e..2ecadcfaf6 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -120,6 +120,7 @@ bool LLSocialStatusPanel::onFacebookConnectStateChange(const LLSD& data)
 
 		case LLFacebookConnect::FB_POSTED:
 			LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel");
+			clearAndClose();
 			break;
 	}
 
@@ -135,6 +136,17 @@ void LLSocialStatusPanel::sendStatus()
 	}
 }
 
+void LLSocialStatusPanel::clearAndClose()
+{
+	mMessageTextEditor->setValue("");
+
+	LLFloater* floater = getParentByType<LLFloater>();
+	if (floater)
+	{
+		floater->closeFloater();
+	}
+}
+
 ///////////////////////////
 //LLSocialPhotoPanel///////
 ///////////////////////////
@@ -333,6 +345,7 @@ bool LLSocialPhotoPanel::onFacebookConnectStateChange(const LLSD& data)
 
 		case LLFacebookConnect::FB_POSTED:
 			LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel");
+			clearAndClose();
 			break;
 	}
 
@@ -365,6 +378,17 @@ void LLSocialPhotoPanel::sendPhoto()
 	updateControls();
 }
 
+void LLSocialPhotoPanel::clearAndClose()
+{
+	mCaptionTextBox->setValue("");
+
+	LLFloater* floater = getParentByType<LLFloater>();
+	if (floater)
+	{
+		floater->closeFloater();
+	}
+}
+
 void LLSocialPhotoPanel::updateControls()
 {
 	LLSnapshotLivePreview* previewp = getPreviewView();
@@ -564,6 +588,7 @@ bool LLSocialCheckinPanel::onFacebookConnectStateChange(const LLSD& data)
 
 		case LLFacebookConnect::FB_POSTED:
 			LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel");
+			clearAndClose();
 			break;
 	}
 
@@ -595,6 +620,17 @@ void LLSocialCheckinPanel::sendCheckin()
 	LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption);
 }
 
+void LLSocialCheckinPanel::clearAndClose()
+{
+	getChild<LLUICtrl>("place_caption")->setValue("");
+
+	LLFloater* floater = getParentByType<LLFloater>();
+	if (floater)
+	{
+		floater->closeFloater();
+	}
+}
+
 ////////////////////////
 //LLFloaterSocial///////
 ////////////////////////
@@ -680,6 +716,8 @@ void LLFloaterSocial::draw()
             mStatusLoadingIndicator->setVisible(true);
             break;
         case LLFacebookConnect::FB_CONNECTED:
+			break;
+        case LLFacebookConnect::FB_POSTED:
             break;
         case LLFacebookConnect::FB_CONNECTION_FAILED:
         case LLFacebookConnect::FB_POST_FAILED:
diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h
index e37facbbce..5e1ee6be0e 100644
--- a/indra/newview/llfloatersocial.h
+++ b/indra/newview/llfloatersocial.h
@@ -45,6 +45,7 @@ public:
 	bool onFacebookConnectStateChange(const LLSD& data);
 
 	void sendStatus();
+	void clearAndClose();
 
 private:
 	LLUICtrl* mMessageTextEditor;
@@ -67,6 +68,7 @@ public:
 	bool onFacebookConnectStateChange(const LLSD& data);
 
 	void sendPhoto();
+	void clearAndClose();
 
 	void updateControls();
 	void updateResolution(BOOL do_update);
@@ -101,6 +103,7 @@ public:
 	bool onFacebookConnectStateChange(const LLSD& data);
 
 	void sendCheckin();
+	void clearAndClose();
 
 private:
     std::string mMapUrl;
-- 
cgit v1.2.3


From 85824ebc0931d4ac89e375b35dbccd1295746e31 Mon Sep 17 00:00:00 2001
From: Cho <cho@lindenlab.com>
Date: Thu, 4 Jul 2013 02:13:47 +0100
Subject: Removed share callbacks from LLFacebookConnect

---
 indra/newview/llfacebookconnect.cpp | 19 +++----------------
 indra/newview/llfacebookconnect.h   |  7 -------
 2 files changed, 3 insertions(+), 23 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp
index 07204531de..816947827c 100644
--- a/indra/newview/llfacebookconnect.cpp
+++ b/indra/newview/llfacebookconnect.cpp
@@ -133,11 +133,6 @@ public:
 		LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_POSTING);
 	}
 	
-	LLFacebookShareResponder(LLFacebookConnect::share_callback_t cb) : mShareCallback(cb)
-	{
-		LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_POSTING);
-	}
-    
 	virtual void completed(U32 status, const std::string& reason, const LLSD& content)
 	{
 		if (isGoodStatus(status))
@@ -156,11 +151,6 @@ public:
             LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_POST_FAILED);
             log_facebook_connect_error("Share", status, reason, content.get("error_code"), content.get("error_description"));
 		}
-		
-		if (mShareCallback)
-		{
-			mShareCallback(isGoodStatus(status));
-		}
 	}
     
     void completedHeader(U32 status, const std::string& reason, const LLSD& content)
@@ -170,9 +160,6 @@ public:
             LLFacebookConnect::instance().openFacebookWeb(content["location"]);
         }
     }
-    
-private:
-	LLFacebookConnect::share_callback_t mShareCallback;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -346,7 +333,7 @@ void LLFacebookConnect::postCheckin(const std::string& location, const std::stri
 		body["message"] = message;
 
 	// Note: we can use that route for different publish action. We should be able to use the same responder.
-	LLHTTPClient::post(getFacebookConnectURL("/share/checkin"), body, new LLFacebookShareResponder(mPostCheckinCallback));
+	LLHTTPClient::post(getFacebookConnectURL("/share/checkin"), body, new LLFacebookShareResponder());
 }
 
 void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::string& caption)
@@ -409,7 +396,7 @@ void LLFacebookConnect::sharePhoto(LLPointer<LLImageFormatted> image, const std:
 	memcpy(data, body.str().data(), size);
 	
     // Note: we can use that route for different publish action. We should be able to use the same responder.
-	LLHTTPClient::postRaw(getFacebookConnectURL("/share/photo"), data, size, new LLFacebookShareResponder(mSharePhotoCallback), headers);
+	LLHTTPClient::postRaw(getFacebookConnectURL("/share/photo"), data, size, new LLFacebookShareResponder(), headers);
 }
 
 void LLFacebookConnect::updateStatus(const std::string& message)
@@ -418,7 +405,7 @@ void LLFacebookConnect::updateStatus(const std::string& message)
 	body["message"] = message;
 	
     // Note: we can use that route for different publish action. We should be able to use the same responder.
-	LLHTTPClient::post(getFacebookConnectURL("/share/wall"), body, new LLFacebookShareResponder(mUpdateStatusCallback));
+	LLHTTPClient::post(getFacebookConnectURL("/share/wall"), body, new LLFacebookShareResponder());
 }
 
 void LLFacebookConnect::storeContent(const LLSD& content)
diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h
index b37c713ae5..a06e53b90e 100644
--- a/indra/newview/llfacebookconnect.h
+++ b/indra/newview/llfacebookconnect.h
@@ -54,7 +54,6 @@ public:
 		FB_POST_FAILED = 6
 	};
 	
-	typedef boost::function<void(bool ok)> share_callback_t;
 	typedef boost::function<void()> content_updated_callback_t;
 
 	void connectToFacebook(const std::string& auth_code = "");	// Initiate the complete FB connection. Please use checkConnectionToFacebook() in normal use.
@@ -67,9 +66,6 @@ public:
 	void sharePhoto(LLPointer<LLImageFormatted> image, const std::string& caption);
 	void updateStatus(const std::string& message);
 	
-	void setPostCheckinCallback(share_callback_t cb) { mPostCheckinCallback = cb; }
-	void setSharePhotoCallback(share_callback_t cb) { mSharePhotoCallback = cb; }
-	void setUpdateStatusCallback(share_callback_t cb) { mUpdateStatusCallback = cb; }
 	void setContentUpdatedCallback(content_updated_callback_t cb) { mContentUpdatedCallback = cb;}
 
     void clearContent();
@@ -94,9 +90,6 @@ private:
     LLSD mContent;
     S32  mGeneration;
 	
-	share_callback_t mPostCheckinCallback;
-	share_callback_t mSharePhotoCallback;
-	share_callback_t mUpdateStatusCallback;
 	content_updated_callback_t mContentUpdatedCallback;
 
 	static boost::scoped_ptr<LLEventPump> sStateWatcher;
-- 
cgit v1.2.3


From f7a1f7b784fff0579e4d1fecd8265d0f960bd7f4 Mon Sep 17 00:00:00 2001
From: Cho <cho@lindenlab.com>
Date: Thu, 4 Jul 2013 02:43:09 +0100
Subject: Replaced content change callback with an event in LLFacebookConnect
 for ACME-648 (more or less)

---
 indra/newview/llfacebookconnect.cpp | 15 ++-------------
 indra/newview/llfacebookconnect.h   |  7 +------
 indra/newview/llpanelpeople.cpp     | 10 +++++++---
 indra/newview/llpanelpeople.h       |  2 +-
 4 files changed, 11 insertions(+), 23 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp
index 816947827c..30ebedca25 100644
--- a/indra/newview/llfacebookconnect.cpp
+++ b/indra/newview/llfacebookconnect.cpp
@@ -41,6 +41,7 @@
 #include "llevents.h"
 
 boost::scoped_ptr<LLEventPump> LLFacebookConnect::sStateWatcher(new LLEventStream("FacebookConnectState"));
+boost::scoped_ptr<LLEventPump> LLFacebookConnect::sContentWatcher(new LLEventStream("FacebookConnectContent"));
 
 // Local functions
 void log_facebook_connect_error(const std::string& request, U32 status, const std::string& reason, const std::string& code, const std::string& description)
@@ -413,10 +414,7 @@ void LLFacebookConnect::storeContent(const LLSD& content)
     mGeneration++;
     mContent = content;
 
-	if(mContentUpdatedCallback)
-	{
-		mContentUpdatedCallback();
-	}
+	sContentWatcher->post(content);
 }
 
 const LLSD& LLFacebookConnect::getContent() const
@@ -441,12 +439,3 @@ void LLFacebookConnect::setConnectionState(LLFacebookConnect::EConnectionState c
 	
 	mConnectionState = connection_state;
 }
-    
-
-
-
-
-
-
-
-
diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h
index a06e53b90e..7b6eb3644f 100644
--- a/indra/newview/llfacebookconnect.h
+++ b/indra/newview/llfacebookconnect.h
@@ -54,8 +54,6 @@ public:
 		FB_POST_FAILED = 6
 	};
 	
-	typedef boost::function<void()> content_updated_callback_t;
-
 	void connectToFacebook(const std::string& auth_code = "");	// 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().
@@ -66,8 +64,6 @@ public:
 	void sharePhoto(LLPointer<LLImageFormatted> image, const std::string& caption);
 	void updateStatus(const std::string& message);
 	
-	void setContentUpdatedCallback(content_updated_callback_t cb) { mContentUpdatedCallback = cb;}
-
     void clearContent();
 	void storeContent(const LLSD& content);
     const LLSD& getContent() const;
@@ -90,9 +86,8 @@ private:
     LLSD mContent;
     S32  mGeneration;
 	
-	content_updated_callback_t mContentUpdatedCallback;
-
 	static boost::scoped_ptr<LLEventPump> sStateWatcher;
+	static boost::scoped_ptr<LLEventPump> sContentWatcher;
 };
 
 #endif // LL_LLFACEBOOKCONNECT_H
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 8c8cad0743..766335c982 100755
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -781,7 +781,7 @@ void LLPanelPeople::updateFriendList()
 	showFriendsAccordionsIfNeeded();
 }
 
-void LLPanelPeople::updateSuggestedFriendList()
+bool LLPanelPeople::updateSuggestedFriendList()
 {
 	if (LLFacebookConnect::instance().generation() != mFacebookListGeneration)
 	{
@@ -814,6 +814,8 @@ void LLPanelPeople::updateSuggestedFriendList()
 		mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches());
 		showFriendsAccordionsIfNeeded();
 	}
+
+	return false;
 }
 
 void LLPanelPeople::updateNearbyList()
@@ -855,7 +857,8 @@ void LLPanelPeople::updateFacebookList(bool visible)
 {
 	if (visible)
 	{
-		LLFacebookConnect::instance().setContentUpdatedCallback(boost::bind(&LLPanelPeople::updateSuggestedFriendList, this));
+		LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLPanelPeople"); // just in case it is already listening
+		LLEventPumps::instance().obtain("FacebookConnectContent").listen("LLPanelPeople", boost::bind(&LLPanelPeople::updateSuggestedFriendList, this));
 
 		if (mTryToConnectToFbc)
 		{
@@ -866,6 +869,7 @@ void LLPanelPeople::updateFacebookList(bool visible)
 			}
 			else
 			{
+				LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLPanelPeople"); // just in case it is already listening
 				LLEventPumps::instance().obtain("FacebookConnectState").listen("LLPanelPeople", boost::bind(&LLPanelPeople::onConnectedToFacebook, this, _1));
 				LLFacebookConnect::instance().checkConnectionToFacebook();
 			}
@@ -878,7 +882,7 @@ void LLPanelPeople::updateFacebookList(bool visible)
 	}
 	else
 	{
-		LLFacebookConnect::instance().setContentUpdatedCallback(NULL);
+		LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLPanelPeople");
 	}
 }
 
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index c6ee7b8165..b746835dfb 100755
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -76,7 +76,7 @@ private:
 	// methods indirectly called by the updaters
 	void					updateFriendListHelpText();
 	void					updateFriendList();
-	void					updateSuggestedFriendList();
+	bool					updateSuggestedFriendList();
 	void					updateNearbyList();
 	void					updateRecentList();
 	void					updateFacebookList(bool visible);
-- 
cgit v1.2.3