From 0997ce8629152293a8c45e313c00711c968b3290 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 22 Nov 2014 20:14:09 -0800 Subject: Small improvements to SimulatorFeaturesModule: (1) don't overwrite extras if the grid response is invalid; (2) make the name of the config variable for destination guide consistent with the grid-wide name in LoginService; (3) account for the existence of a [USERID] in the destination guide URL --- .../Linden/Caps/SimulatorFeaturesModule.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 11cac05..ec45c81 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -86,6 +86,8 @@ namespace OpenSim.Region.ClientStack.Linden // These are normaly set in their respective modules m_SearchURL = config.GetString("SearchServerURI", m_SearchURL); m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL); + if (m_DestinationGuideURL == string.Empty) // Make this consistent with the variable in the LoginService config + m_DestinationGuideURL = config.GetString("DestinationGuide", m_DestinationGuideURL); m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); m_GridURL = Util.GetConfigVarFromSections(source, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "SimulatorFeatures" }, String.Empty); @@ -225,10 +227,14 @@ namespace OpenSim.Region.ClientStack.Linden private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID) { -// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); + m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); OSDMap copy = DeepCopy(); + // Let's add the agentID to the destination guide, if it is expecting that. + if (copy.ContainsKey("OpenSimExtras") && ((OSDMap)(copy["OpenSimExtras"])).ContainsKey("destination-guide-url")) + ((OSDMap)copy["OpenSimExtras"])["destination-guide-url"] = Replace(((OSDMap)copy["OpenSimExtras"])["destination-guide-url"], "[USERID]", agentID.ToString()); + SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest; if (handlerOnSimulatorFeaturesRequest != null) @@ -254,6 +260,11 @@ namespace OpenSim.Region.ClientStack.Linden private void GetGridExtraFeatures(Scene scene) { Dictionary extraFeatures = scene.GridService.GetExtraFeatures(); + if (extraFeatures.ContainsKey("Result") && extraFeatures["Result"] != null && extraFeatures["Result"].ToString() == "Failure") + { + m_log.WarnFormat("[SIMULATOR FEATURES MODULE]: Unable to retrieve grid-wide features"); + return; + } lock (m_features) { @@ -269,7 +280,16 @@ namespace OpenSim.Region.ClientStack.Linden } } m_features["OpenSimExtras"] = extrasMap; + } } + + private string Replace(string url, string substring, string replacement) + { + if (!String.IsNullOrEmpty(url) && url.Contains(substring)) + return url.Replace(substring, replacement); + + return url; + } } } -- cgit v1.1