From 2b66eeb4a61235fae4c29ecd98890b8b47badafe Mon Sep 17 00:00:00 2001
From: NiranV <NiranV.Dean@googlemail.com>
Date: Wed, 20 Aug 2014 01:38:50 +0200
Subject: [PATCH] STORM-2073: Fixed: Do not post our status if we press the
 "Connect" button otherwise we end up double posting.

---
 indra/newview/llfloaterfacebook.cpp | 7 +++++--
 indra/newview/llfloaterfacebook.h   | 2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp
index 516cf5c15cf..d8cc070fd0e 100644
--- a/indra/newview/llfloaterfacebook.cpp
+++ b/indra/newview/llfloaterfacebook.cpp
@@ -156,7 +156,8 @@ void LLFacebookStatusPanel::onSend()
 {
 	LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookStatusPanel"); // just in case it is already listening
 	LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookStatusPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectStateChange, this, _1));
-		
+	
+	pressedConnect = FALSE;
 	// Connect to Facebook if necessary and then post
 	if (LLFacebookConnect::instance().isConnected())
 	{
@@ -186,7 +187,8 @@ bool LLFacebookStatusPanel::onFacebookConnectStateChange(const LLSD& data)
 	switch (data.get("enum").asInteger())
 	{
 		case LLFacebookConnect::FB_CONNECTED:
-			sendStatus();
+			if(!pressedConnect)
+				sendStatus();
 			break;
 
 		case LLFacebookConnect::FB_POSTED:
@@ -293,6 +295,7 @@ void LLFacebookStatusPanel::onConnect()
 {
 	LLFacebookConnect::instance().checkConnectionToFacebook(true);
 
+	pressedConnect = TRUE;
 	//Clear only the facebook browser cookies so that the facebook login screen appears
 	LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com"); 
 }
diff --git a/indra/newview/llfloaterfacebook.h b/indra/newview/llfloaterfacebook.h
index 86e3a148b94..e1526db18d0 100644
--- a/indra/newview/llfloaterfacebook.h
+++ b/indra/newview/llfloaterfacebook.h
@@ -62,6 +62,8 @@ class LLFacebookStatusPanel : public LLPanel
 	void showDisconnectedLayout();
 	void showConnectedLayout();
 
+	bool pressedConnect;
+
 	LLTextBox * mAccountCaptionLabel;
 	LLTextBox * mAccountNameLabel;
 	LLUICtrl * mPanelButtons;
-- 
GitLab