From 3fa059409aad9d7b5aedb4ed112cb52da6990ac4 Mon Sep 17 00:00:00 2001
From: Bill Curtis <bill.curtis@gmail.com>
Date: Mon, 8 Nov 2010 10:54:58 -0800
Subject: changes to read max-agent-groups from login.cgi response

---
 indra/newview/llagent.cpp         | 3 ++-
 indra/newview/llfloatergroups.cpp | 5 +++--
 indra/newview/lllogininstance.cpp | 1 +
 indra/newview/llstartup.cpp       | 6 +++++-
 indra/newview/llstartup.h         | 1 +
 indra/newview/llviewermessage.cpp | 2 +-
 6 files changed, 13 insertions(+), 5 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index b202cb5098..9350e50305 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -58,6 +58,7 @@
 #include "llsidetray.h"
 #include "llsky.h"
 #include "llsmoothstep.h"
+#include "llstartup.h"
 #include "llstatusbar.h"
 #include "llteleportflags.h"
 #include "lltool.h"
@@ -2427,7 +2428,7 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
 
 BOOL LLAgent::canJoinGroups() const
 {
-	return mGroups.count() < MAX_AGENT_GROUPS;
+	return mGroups.count() < gMaxAgentGroups;
 }
 
 LLQuaternion LLAgent::getHeadRotation()
diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp
index 3cd2154531..679c932995 100644
--- a/indra/newview/llfloatergroups.cpp
+++ b/indra/newview/llfloatergroups.cpp
@@ -41,6 +41,7 @@
 #include "llbutton.h"
 #include "llgroupactions.h"
 #include "llscrolllistctrl.h"
+#include "llstartup.h"
 #include "lltextbox.h"
 #include "lluictrlfactory.h"
 #include "lltrans.h"
@@ -171,7 +172,7 @@ void LLPanelGroups::reset()
 		group_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
 	}
 	getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count()));
-	getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",MAX_AGENT_GROUPS));
+	getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups));
 
 	init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID());
 	enableButtons();
@@ -182,7 +183,7 @@ BOOL LLPanelGroups::postBuild()
 	childSetCommitCallback("group list", onGroupList, this);
 
 	getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count()));
-	getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",MAX_AGENT_GROUPS));
+	getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups));
 
 	LLScrollListCtrl *list = getChild<LLScrollListCtrl>("group list");
 	if (list)
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index 7b2f5984a7..9461bfbc32 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -146,6 +146,7 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia
 	requested_options.append("newuser-config");
 	requested_options.append("ui-config");
 #endif
+	requested_options.append("max-agent-groups");	
 	requested_options.append("map-server-url");	
 	requested_options.append("voice-config");
 	requested_options.append("tutorial_setting");
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 975d1f9f32..5781398faa 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -198,6 +198,7 @@
 // exported globals
 //
 bool gAgentMovementCompleted = false;
+S32  gMaxAgentGroups;
 
 std::string SCREEN_HOME_FILENAME = "screen_home.bmp";
 std::string SCREEN_LAST_FILENAME = "screen_last.bmp";
@@ -2944,7 +2945,7 @@ bool process_login_success_response()
 	text = response["circuit_code"].asString();
 	if(!text.empty())
 	{
-		gMessageSystem->mOurCircuitCode = strtoul(text.c_str(), NULL, 10);
+		gMessageSystem->mOurCircuitCode = strtoult(ext.c_str(), NULL, 10);
 	}
 	std::string sim_ip_str = response["sim_ip"];
 	std::string sim_port_str = response["sim_port"];
@@ -3148,6 +3149,9 @@ bool process_login_success_response()
 		LLViewerMedia::openIDSetup(openid_url, openid_token);
 	}
 
+	std::string max_agent_groups(response["max-agent-groups"]);
+	gMaxAgentGroups = atoi(max_agent_groups.c_str());
+	
 	bool success = false;
 	// JC: gesture loading done below, when we have an asset system
 	// in place.  Don't delete/clear gUserCredentials until then.
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h
index e79aa0dbee..41f6f1b7ee 100644
--- a/indra/newview/llstartup.h
+++ b/indra/newview/llstartup.h
@@ -70,6 +70,7 @@ typedef enum {
 
 // exported symbols
 extern bool gAgentMovementCompleted;
+extern S32  gMaxAgentGroups;
 extern LLPointer<LLViewerTexture> gStartTexture;
 
 class LLStartUp
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index c35173a7d4..14e0d49088 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -633,7 +633,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
 	if(option == 0 && !group_id.isNull())
 	{
 		// check for promotion or demotion.
-		S32 max_groups = MAX_AGENT_GROUPS;
+		S32 max_groups = gMaxAgentGroups;
 		if(gAgent.isInGroup(group_id)) ++max_groups;
 
 		if(gAgent.mGroups.count() < max_groups)
-- 
cgit v1.2.3


From 31e0c9122ecaa8aed1c5449acc3cb773441d6858 Mon Sep 17 00:00:00 2001
From: Bill Curtis <bill.curtis@gmail.com>
Date: Tue, 9 Nov 2010 10:25:11 -0800
Subject: fixing transposed characters

---
 indra/newview/llstartup.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 5781398faa..ac320ba761 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2945,7 +2945,7 @@ bool process_login_success_response()
 	text = response["circuit_code"].asString();
 	if(!text.empty())
 	{
-		gMessageSystem->mOurCircuitCode = strtoult(ext.c_str(), NULL, 10);
+		gMessageSystem->mOurCircuitCode = strtoul(text.c_str(), NULL, 10);
 	}
 	std::string sim_ip_str = response["sim_ip"];
 	std::string sim_port_str = response["sim_port"];
-- 
cgit v1.2.3


From c5e5af4219b650db50ec72ee6a7174aad9439671 Mon Sep 17 00:00:00 2001
From: Bill Curtis <bill.curtis@gmail.com>
Date: Thu, 18 Nov 2010 10:37:45 -0800
Subject: added logging and default value for max-agent-groups

---
 indra/newview/llstartup.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index ac320ba761..711240293e 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -3149,9 +3149,18 @@ bool process_login_success_response()
 		LLViewerMedia::openIDSetup(openid_url, openid_token);
 	}
 
-	std::string max_agent_groups(response["max-agent-groups"]);
-	gMaxAgentGroups = atoi(max_agent_groups.c_str());
-	
+	if(response.has("max-agent-grid")) {		
+		std::string max_agent_groups(response["max-agent-groups"]);
+		gMaxAgentGroups = atoi(max_agent_groups.c_str());
+		LL_INFOS("LLStartup") << "gMaxAgentGroups read from login.cgi: "
+							  << gMaxAgentGroups << LL_ENDL;
+	}
+	else {
+		gMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS;
+		LL_INFOS("LLStartup") << "using gMaxAgentGroups default: "
+							  << gMaxAgentGroups << LL_ENDL;
+	}
+		
 	bool success = false;
 	// JC: gesture loading done below, when we have an asset system
 	// in place.  Don't delete/clear gUserCredentials until then.
-- 
cgit v1.2.3


From cb8b30864f08947a23379eabcac63c2ceee62f7c Mon Sep 17 00:00:00 2001
From: Bill Curtis <bill.curtis@gmail.com>
Date: Fri, 19 Nov 2010 14:01:30 -0800
Subject: fixed typo

---
 indra/newview/llstartup.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 711240293e..50465de0e8 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -3149,7 +3149,7 @@ bool process_login_success_response()
 		LLViewerMedia::openIDSetup(openid_url, openid_token);
 	}
 
-	if(response.has("max-agent-grid")) {		
+	if(response.has("max-agent-groups")) {		
 		std::string max_agent_groups(response["max-agent-groups"]);
 		gMaxAgentGroups = atoi(max_agent_groups.c_str());
 		LL_INFOS("LLStartup") << "gMaxAgentGroups read from login.cgi: "
-- 
cgit v1.2.3