From 566b10e2250e484b2d3211565d387c3c73864e82 Mon Sep 17 00:00:00 2001
From: Ima Mechanique <ima.mechanique@secondlife.com>
Date: Wed, 5 Feb 2014 15:27:22 +0000
Subject: Cleaning up a little. Using assigned values for simFeature/Capability
 name instead of literal values.

---
 indra/newview/llsyntaxid.cpp | 34 ++++++++++++++++------------------
 indra/newview/llsyntaxid.h   |  4 ++--
 2 files changed, 18 insertions(+), 20 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp
index 886dcfaac0..4d7cc550af 100644
--- a/indra/newview/llsyntaxid.cpp
+++ b/indra/newview/llsyntaxid.cpp
@@ -113,7 +113,7 @@ void fetchKeywordsFileResponder::cacheFile(const LLSD& content_ref)
 //-----------------------------------------------------------------------------
 const std::string LLSyntaxIdLSL::CAPABILITY_NAME = "LSLSyntax";
 const std::string LLSyntaxIdLSL::FILENAME_DEFAULT = "keywords_lsl_default.xml";
-const std::string LLSyntaxIdLSL::SIMULATOR_FEATURE ="LSLSyntaxId";
+const std::string LLSyntaxIdLSL::SIMULATOR_FEATURE = "LSLSyntaxId";
 
 LLSD LLSyntaxIdLSL::sKeywordsXml;
 bool LLSyntaxIdLSL::sLoaded;
@@ -123,21 +123,24 @@ bool LLSyntaxIdLSL::sVersionChanged;
 /**
  * @brief LLSyntaxIdLSL constructor
  */
-LLSyntaxIdLSL::LLSyntaxIdLSL(std::string filenameDefault, std::string simulatorFeature, std::string capabilityName) :
-	// Move these to signature?
-	mCapabilityURL(""),
+LLSyntaxIdLSL::LLSyntaxIdLSL(std::string filenameDefault, std::string simFeatureName, std::string capabilityName) :
 	mFilePath(LL_PATH_APP_SETTINGS)
 {
 	mCapabilityName = capabilityName;
 	mFileNameCurrent = filenameDefault;
 	mFileNameDefault = filenameDefault;
-	mSimulatorFeature = simulatorFeature;
+	mSimulatorFeature = simFeatureName;
 	mSyntaxIdCurrent = LLUUID();
 }
 
-LLSyntaxIdLSL::LLSyntaxIdLSL()
+LLSyntaxIdLSL::LLSyntaxIdLSL() :
+	mFilePath(LL_PATH_APP_SETTINGS)
 {
-	LLSyntaxIdLSL(LLSyntaxIdLSL::FILENAME_DEFAULT, LLSyntaxIdLSL::SIMULATOR_FEATURE, LLSyntaxIdLSL::CAPABILITY_NAME);
+	mCapabilityName = CAPABILITY_NAME;
+	mFileNameCurrent = FILENAME_DEFAULT;
+	mFileNameDefault = FILENAME_DEFAULT;
+	mSimulatorFeature = SIMULATOR_FEATURE;
+	mSyntaxIdCurrent = LLUUID();
 }
 
 std::string LLSyntaxIdLSL::buildFileNameNew()
@@ -166,7 +169,7 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged()
 	{
 		if (!region->capabilitiesReceived())
 		{   // Shouldn't be possible, but experience shows that it may be needed.
-			LL_WARNS("SyntaxLSL")
+			LL_ERRS("SyntaxLSL")
 				<< "Region '" << region->getName()
 				<< "' has not received capabilities yet! Cannot process SyntaxId."
 				<< LL_ENDL;
@@ -174,15 +177,14 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged()
 		else
 		{
 			LLSD simFeatures;
-			std::string message;
 			region->getSimulatorFeatures(simFeatures);
 
-			LL_INFOS("SyntaxLSL") << "Region is '" << region->getName() << "' ..." << LL_ENDL;
-
-			// get and check the hash
-			if (simFeatures.has("LSLSyntaxId"))
+			// Does the sim have the required feature
+			if (simFeatures.has(mSimulatorFeature))
 			{
-				mSyntaxIdNew = simFeatures["LSLSyntaxId"].asUUID();
+				// get and check the hash
+				mSyntaxIdNew = simFeatures[mSimulatorFeature].asUUID();
+				mCapabilityURL = region->getCapability(mCapabilityName);
 				if (mSyntaxIdCurrent != mSyntaxIdNew)
 				{
 					LL_INFOS("SyntaxLSL")
@@ -216,8 +218,6 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged()
 					changed = true;
 				}
 			}
-			LL_INFOS("SyntaxLSL")
-				<< "Region is '" << region->getName() << message << LL_ENDL;
 		}
 	}
 	sVersionChanged = changed;
@@ -260,8 +260,6 @@ void LLSyntaxIdLSL::initialise()
 	{
 		sKeywordsXml = LLSD();
 		sLoaded = sLoadFailed = false;
-		LLViewerRegion* region = gAgent.getRegion();
-		mCapabilityURL = region->getCapability(mCapabilityName);
 		if (!mCapabilityURL.empty())
 		{
 			LL_INFOS("SyntaxLSL")
diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h
index 3c27a91ce4..a24edf7204 100644
--- a/indra/newview/llsyntaxid.h
+++ b/indra/newview/llsyntaxid.h
@@ -75,7 +75,7 @@ private:
 
 public:
 	LLSyntaxIdLSL();
-	LLSyntaxIdLSL(std::string filenameDefault, std::string simulatorFeature, std::string capabilityName);
+	LLSyntaxIdLSL(std::string filenameDefault, std::string simFeatureName, std::string capabilityName);
 
 	bool			checkSyntaxIdChanged();
 	bool			fetching();
@@ -103,7 +103,7 @@ protected:
 	void			setFileNameCurrent(std::string& name) { mFileNameCurrent = name; }
 	void			setFileNameDefault(std::string& name) { mFileNameDefault = name; }
 	void			setFileNameNew(std::string name) { mFileNameNew = name; }
-	void			setSimulatorFeatureName(const std::string& name) { mSimulatorFeature = name; }
+//	void			setSimulatorFeatureName(const std::string& name) { mSimulatorFeature = name; }
 };
 
 
-- 
cgit v1.2.3