From e3f093a87157c012ab4e9d378cc26876b7b91900 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Mon, 10 Jun 2013 16:01:41 -0700
Subject: ACME-464, ACME-509 : Skip 302 error when prompting the user for
 errors

---
 indra/newview/llfacebookconnect.cpp | 49 +++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 27 deletions(-)

diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp
index 1986814815..348e2c2e90 100644
--- a/indra/newview/llfacebookconnect.cpp
+++ b/indra/newview/llfacebookconnect.cpp
@@ -36,6 +36,21 @@
 #include "llnotificationsutil.h"
 #include "llurlaction.h"
 
+
+// Local function
+void prompt_user_for_error(U32 status, const std::string& reason)
+{
+    // Note: 302 (redirect) is *not* an error that warrants prompting the user
+    if (status != 302)
+    {
+        LLSD args(LLSD::emptyMap());
+        std::stringstream msg;
+        msg << reason << " (Code " << status << ")";
+        args["FAIL_REASON"] = msg.str();
+        LLNotificationsUtil::add("FacebookCannotConnect",args);
+    }
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 //
 
@@ -81,12 +96,8 @@ public:
 		}
 		else
 		{
-            LLSD args(LLSD::emptyMap());
-            std::stringstream msg;
-            msg << reason << " (Code " << status << ")";
-            args["FAIL_REASON"] = msg.str();
-			LLNotificationsUtil::add("FacebookCannotConnect",args);
-			LL_WARNS("FacebookConnect") << "Failed to get a response. reason: " << reason << " status: " << status << LL_ENDL;
+            prompt_user_for_error(status,reason);
+            LL_WARNS("FacebookConnect") << "Failed to get a response. reason: " << reason << " status: " << status << LL_ENDL;
 		}
 	}
     
@@ -115,12 +126,8 @@ public:
 		}
 		else
 		{
-            LLSD args(LLSD::emptyMap());
-            std::stringstream msg;
-            msg << reason << " (Code " << status << ")";
-            args["FAIL_REASON"] = msg.str();
-			LLNotificationsUtil::add("FacebookCannotConnect",args);
-			LL_WARNS("FacebookConnect") << "Failed to get a post response. reason: " << reason << " status: " << status << LL_ENDL;
+            prompt_user_for_error(status,reason);
+            LL_WARNS("FacebookConnect") << "Failed to get a post response. reason: " << reason << " status: " << status << LL_ENDL;
 		}
 	}
     
@@ -153,11 +160,7 @@ public:
 		}
 		else
 		{
-            LLSD args(LLSD::emptyMap());
-            std::stringstream msg;
-            msg << reason << " (Code " << status << ")";
-            args["FAIL_REASON"] = msg.str();
-			LLNotificationsUtil::add("FacebookCannotConnect",args);
+            prompt_user_for_error(status,reason);
 			LL_WARNS("FacebookConnect") << "Failed to get a response. reason: " << reason << " status: " << status << LL_ENDL;
 		}
 	}
@@ -193,11 +196,7 @@ public:
 			}
             else
             {
-                LLSD args(LLSD::emptyMap());
-                std::stringstream msg;
-                msg << reason << " (Code " << status << ")";
-                args["FAIL_REASON"] = msg.str();
-                LLNotificationsUtil::add("FacebookCannotConnect",args);
+                prompt_user_for_error(status,reason);
             }
 		}
 	}
@@ -222,11 +221,7 @@ public:
 		}
 		else
 		{
-            LLSD args(LLSD::emptyMap());
-            std::stringstream msg;
-            msg << reason << " (Code " << status << ")";
-            args["FAIL_REASON"] = msg.str();
-			LLNotificationsUtil::add("FacebookCannotConnect",args);
+            prompt_user_for_error(status,reason);
 			LL_WARNS("FacebookConnect") << "Failed to get a response. reason: " << reason << " status: " << status << LL_ENDL;
 		}
 	}
-- 
cgit v1.2.3