aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs74
1 files changed, 24 insertions, 50 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index 9f1eb88..1345bff 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -27,17 +27,18 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
32using Nini.Config; 33using Nini.Config;
33using Mono.Addins; 34using Mono.Addins;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenMetaverse.StructuredData; 36using OpenMetaverse.StructuredData;
36using OpenSim.Framework; 37//using OpenSim.Framework;
37using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 41// using OpenSim.Services.Interfaces;
41using Caps = OpenSim.Framework.Capabilities.Caps; 42using Caps = OpenSim.Framework.Capabilities.Caps;
42 43
43namespace OpenSim.Region.ClientStack.Linden 44namespace OpenSim.Region.ClientStack.Linden
@@ -63,8 +64,6 @@ namespace OpenSim.Region.ClientStack.Linden
63 64
64 private Scene m_scene; 65 private Scene m_scene;
65 66
66 bool m_AllowOverride = true;
67
68 /// <summary> 67 /// <summary>
69 /// Simulator features 68 /// Simulator features
70 /// </summary> 69 /// </summary>
@@ -81,25 +80,11 @@ namespace OpenSim.Region.ClientStack.Linden
81 IConfig config = source.Configs["SimulatorFeatures"]; 80 IConfig config = source.Configs["SimulatorFeatures"];
82 81
83 if (config != null) 82 if (config != null)
84 { 83 {
85 string featuresURI = config.GetString("ExtraFeaturesServiceURI", string.Empty); 84 // These are normaly set in their respective modules
86 85 m_SearchURL = config.GetString("SearchServerURI", m_SearchURL);
87 if (string.IsNullOrEmpty(featuresURI)) 86 m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL);
88 { 87 m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
89 m_log.Info("ExtraFeaturesServiceURI is undefined. The grid's ExtraFeatures will not be available to regions in this instance.");
90 }
91 else
92 {
93 GetGridExtraFeatures(featuresURI);
94 }
95
96 if (m_AllowOverride)
97 {
98 m_SearchURL = config.GetString("SearchServerURI", m_SearchURL);
99 m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL);
100
101 m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
102 }
103 } 88 }
104 89
105 AddDefaultFeatures(); 90 AddDefaultFeatures();
@@ -120,6 +105,7 @@ namespace OpenSim.Region.ClientStack.Linden
120 105
121 public void RegionLoaded(Scene s) 106 public void RegionLoaded(Scene s)
122 { 107 {
108 GetGridExtraFeatures(s);
123 } 109 }
124 110
125 public void PostInitialise() 111 public void PostInitialise()
@@ -169,11 +155,11 @@ namespace OpenSim.Region.ClientStack.Linden
169 else 155 else
170 extrasMap = new OSDMap(); 156 extrasMap = new OSDMap();
171 157
172 if (m_SearchURL != string.Empty && m_AllowOverride == true) 158 if (m_SearchURL != string.Empty)
173 extrasMap["search-server-url"] = m_SearchURL; 159 extrasMap["search-server-url"] = m_SearchURL;
174 if (!string.IsNullOrEmpty(m_DestinationGuideURL) && m_AllowOverride == true) 160 if (!string.IsNullOrEmpty(m_DestinationGuideURL))
175 extrasMap["destination-guide-url"] = m_DestinationGuideURL; 161 extrasMap["destination-guide-url"] = m_DestinationGuideURL;
176 if (m_ExportSupported && m_AllowOverride == true) 162 if (m_ExportSupported)
177 extrasMap["ExportSupported"] = true; 163 extrasMap["ExportSupported"] = true;
178 164
179 if (extrasMap.Count > 0) 165 if (extrasMap.Count > 0)
@@ -233,9 +219,7 @@ namespace OpenSim.Region.ClientStack.Linden
233 219
234 SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest; 220 SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest;
235 221
236 // We will not trigger the event if m_AllowOverride == False 222 if (handlerOnSimulatorFeaturesRequest != null)
237 // See Robust.ini/Robust.HG.ini [GridExtraFeatures] - AllowRegionOverride
238 if (handlerOnSimulatorFeaturesRequest != null && m_AllowOverride == true)
239 handlerOnSimulatorFeaturesRequest(agentID, ref copy); 223 handlerOnSimulatorFeaturesRequest(agentID, ref copy);
240 224
241 //Send back data 225 //Send back data
@@ -255,32 +239,22 @@ namespace OpenSim.Region.ClientStack.Linden
255 /// <param name='featuresURI'> 239 /// <param name='featuresURI'>
256 /// The URI Robust uses to handle the get_extra_features request 240 /// The URI Robust uses to handle the get_extra_features request
257 /// </param> 241 /// </param>
258 private void GetGridExtraFeatures(string featuresURI) 242 private void GetGridExtraFeatures(Scene scene)
259 { 243 {
260 JsonRpcRequestManager rpc = new JsonRpcRequestManager (); 244 Dictionary<string, object> extraFeatures = scene.GridService.GetExtraFeatures();
261 245
262 OSDMap parameters = new OSDMap ();
263 OSD Params = (OSD)parameters;
264 if (!rpc.JsonRpcRequest (ref Params, "get_extra_features", featuresURI, UUID.Random ().ToString ()))
265 {
266 m_log.Error("[SIMFEATURES]: Could not retrieve extra features from grid. Please check configuration.");
267 return;
268 }
269 parameters = (OSDMap)Params;
270 OSDMap features = (OSDMap)parameters ["result"];
271
272 if(features.ContainsKey("region_override"))
273 m_AllowOverride = features ["region_override"].AsBoolean () ;
274 else
275 m_AllowOverride = true;
276
277 OSDMap test = (OSDMap)features ["extra_features"];
278 lock (m_features) 246 lock (m_features)
279 { 247 {
280 OSDMap extrasMap = new OSDMap(); 248 OSDMap extrasMap = new OSDMap();
281 foreach (string key in test.Keys) 249
250 foreach(string key in extraFeatures.Keys)
282 { 251 {
283 extrasMap[key] = test[key]; 252 extrasMap[key] = (string)extraFeatures[key];
253
254 if (key == "ExportSupported")
255 {
256 bool.TryParse(extraFeatures[key].ToString(), out m_ExportSupported);
257 }
284 } 258 }
285 m_features["OpenSimExtras"] = extrasMap; 259 m_features["OpenSimExtras"] = extrasMap;
286 } 260 }