diff options
author | Diva Canto | 2014-11-22 20:14:09 -0800 |
---|---|---|
committer | Diva Canto | 2014-11-22 20:14:09 -0800 |
commit | 0997ce8629152293a8c45e313c00711c968b3290 (patch) | |
tree | 71f35554b63245e72d11ebe49d06b63e8f48182f /OpenSim/Region | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-0997ce8629152293a8c45e313c00711c968b3290.zip opensim-SC_OLD-0997ce8629152293a8c45e313c00711c968b3290.tar.gz opensim-SC_OLD-0997ce8629152293a8c45e313c00711c968b3290.tar.bz2 opensim-SC_OLD-0997ce8629152293a8c45e313c00711c968b3290.tar.xz |
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
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | 22 |
1 files changed, 21 insertions, 1 deletions
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 | |||
86 | // These are normaly set in their respective modules | 86 | // These are normaly set in their respective modules |
87 | m_SearchURL = config.GetString("SearchServerURI", m_SearchURL); | 87 | m_SearchURL = config.GetString("SearchServerURI", m_SearchURL); |
88 | m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL); | 88 | m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL); |
89 | if (m_DestinationGuideURL == string.Empty) // Make this consistent with the variable in the LoginService config | ||
90 | m_DestinationGuideURL = config.GetString("DestinationGuide", m_DestinationGuideURL); | ||
89 | m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); | 91 | m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); |
90 | m_GridURL = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI", | 92 | m_GridURL = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI", |
91 | new string[] { "Startup", "Hypergrid", "SimulatorFeatures" }, String.Empty); | 93 | new string[] { "Startup", "Hypergrid", "SimulatorFeatures" }, String.Empty); |
@@ -225,10 +227,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
225 | 227 | ||
226 | private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID) | 228 | private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID) |
227 | { | 229 | { |
228 | // m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); | 230 | m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); |
229 | 231 | ||
230 | OSDMap copy = DeepCopy(); | 232 | OSDMap copy = DeepCopy(); |
231 | 233 | ||
234 | // Let's add the agentID to the destination guide, if it is expecting that. | ||
235 | if (copy.ContainsKey("OpenSimExtras") && ((OSDMap)(copy["OpenSimExtras"])).ContainsKey("destination-guide-url")) | ||
236 | ((OSDMap)copy["OpenSimExtras"])["destination-guide-url"] = Replace(((OSDMap)copy["OpenSimExtras"])["destination-guide-url"], "[USERID]", agentID.ToString()); | ||
237 | |||
232 | SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest; | 238 | SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest; |
233 | 239 | ||
234 | if (handlerOnSimulatorFeaturesRequest != null) | 240 | if (handlerOnSimulatorFeaturesRequest != null) |
@@ -254,6 +260,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
254 | private void GetGridExtraFeatures(Scene scene) | 260 | private void GetGridExtraFeatures(Scene scene) |
255 | { | 261 | { |
256 | Dictionary<string, object> extraFeatures = scene.GridService.GetExtraFeatures(); | 262 | Dictionary<string, object> extraFeatures = scene.GridService.GetExtraFeatures(); |
263 | if (extraFeatures.ContainsKey("Result") && extraFeatures["Result"] != null && extraFeatures["Result"].ToString() == "Failure") | ||
264 | { | ||
265 | m_log.WarnFormat("[SIMULATOR FEATURES MODULE]: Unable to retrieve grid-wide features"); | ||
266 | return; | ||
267 | } | ||
257 | 268 | ||
258 | lock (m_features) | 269 | lock (m_features) |
259 | { | 270 | { |
@@ -269,7 +280,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
269 | } | 280 | } |
270 | } | 281 | } |
271 | m_features["OpenSimExtras"] = extrasMap; | 282 | m_features["OpenSimExtras"] = extrasMap; |
283 | |||
272 | } | 284 | } |
273 | } | 285 | } |
286 | |||
287 | private string Replace(string url, string substring, string replacement) | ||
288 | { | ||
289 | if (!String.IsNullOrEmpty(url) && url.Contains(substring)) | ||
290 | return url.Replace(substring, replacement); | ||
291 | |||
292 | return url; | ||
293 | } | ||
274 | } | 294 | } |
275 | } | 295 | } |