aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs74
1 files changed, 65 insertions, 9 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index e4d8a20..587cb70 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -56,13 +56,15 @@ namespace OpenSim.Region.ClientStack.Linden
56 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimulatorFeaturesModule")] 56 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimulatorFeaturesModule")]
57 public class SimulatorFeaturesModule : ISharedRegionModule, ISimulatorFeaturesModule 57 public class SimulatorFeaturesModule : ISharedRegionModule, ISimulatorFeaturesModule
58 { 58 {
59// private static readonly ILog m_log = 59 private static readonly ILog m_log =
60// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 60 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
61 61
62 public event SimulatorFeaturesRequestDelegate OnSimulatorFeaturesRequest; 62 public event SimulatorFeaturesRequestDelegate OnSimulatorFeaturesRequest;
63 63
64 private Scene m_scene; 64 private Scene m_scene;
65 65
66 bool m_AllowOverride = true;
67
66 /// <summary> 68 /// <summary>
67 /// Simulator features 69 /// Simulator features
68 /// </summary> 70 /// </summary>
@@ -75,8 +77,15 @@ namespace OpenSim.Region.ClientStack.Linden
75 77
76 public void Initialise(IConfigSource source) 78 public void Initialise(IConfigSource source)
77 { 79 {
78 IConfig config = source.Configs["SimulatorFeatures"]; 80 IConfig config = source.Configs ["SimulatorFeatures"];
79 if (config != null) 81 string featuresURI = config.GetString ("ExtraFeaturesServiceURI", string.Empty);
82 if (string.IsNullOrEmpty (featuresURI)) {
83 m_log.Info ("ExtraFeaturesServiceURI is undefined. The grid's ExtraFeatures will not be available to regions in this instnace.");
84 } else {
85 GetGridExtraFeatures(featuresURI);
86 }
87
88 if (config != null && m_AllowOverride == true)
80 { 89 {
81 m_SearchURL = config.GetString("SearchServerURI", string.Empty); 90 m_SearchURL = config.GetString("SearchServerURI", string.Empty);
82 91
@@ -126,6 +135,7 @@ namespace OpenSim.Region.ClientStack.Linden
126 /// </remarks> 135 /// </remarks>
127 private void AddDefaultFeatures() 136 private void AddDefaultFeatures()
128 { 137 {
138
129 lock (m_features) 139 lock (m_features)
130 { 140 {
131 m_features["MeshRezEnabled"] = true; 141 m_features["MeshRezEnabled"] = true;
@@ -141,15 +151,21 @@ namespace OpenSim.Region.ClientStack.Linden
141 151
142 // Extra information for viewers that want to use it 152 // Extra information for viewers that want to use it
143 // TODO: Take these out of here into their respective modules, like map-server-url 153 // TODO: Take these out of here into their respective modules, like map-server-url
144 OSDMap extrasMap = new OSDMap(); 154 OSDMap extrasMap;
145 if (m_SearchURL != string.Empty) 155 if(m_features.ContainsKey("OpenSimExtras"))
156 {
157 extrasMap = (OSDMap)m_features["OpenSimExtras"];
158 }
159 else
160 extrasMap = new OSDMap();
161
162 if (m_SearchURL != string.Empty && m_AllowOverride == true)
146 extrasMap["search-server-url"] = m_SearchURL; 163 extrasMap["search-server-url"] = m_SearchURL;
147 if (m_ExportSupported) 164 if (m_ExportSupported && m_AllowOverride == true)
148 extrasMap["ExportSupported"] = true; 165 extrasMap["ExportSupported"] = true;
149 166
150 if (extrasMap.Count > 0) 167 if (extrasMap.Count > 0)
151 m_features["OpenSimExtras"] = extrasMap; 168 m_features["OpenSimExtras"] = extrasMap;
152
153 } 169 }
154 } 170 }
155 171
@@ -204,7 +220,10 @@ namespace OpenSim.Region.ClientStack.Linden
204 OSDMap copy = DeepCopy(); 220 OSDMap copy = DeepCopy();
205 221
206 SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest; 222 SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest;
207 if (handlerOnSimulatorFeaturesRequest != null) 223
224 // We will not trigger the event if m_AllowOverride == False
225 // See Robust.ini/Robust.HG.ini [GridExtraFeatures] - AllowRegionOverride
226 if (handlerOnSimulatorFeaturesRequest != null && m_AllowOverride == true)
208 handlerOnSimulatorFeaturesRequest(agentID, ref copy); 227 handlerOnSimulatorFeaturesRequest(agentID, ref copy);
209 228
210 //Send back data 229 //Send back data
@@ -217,5 +236,42 @@ namespace OpenSim.Region.ClientStack.Linden
217 236
218 return responsedata; 237 return responsedata;
219 } 238 }
239
240 /// <summary>
241 /// Gets the grid extra features.
242 /// </summary>
243 /// <param name='featuresURI'>
244 /// The URI Robust uses to handle the get_extra_features request
245 /// </param>
246 private void GetGridExtraFeatures(string featuresURI)
247 {
248 JsonRpcRequestManager rpc = new JsonRpcRequestManager ();
249
250 OSDMap parameters = new OSDMap ();
251 OSD Params = (OSD)parameters;
252 if (!rpc.JsonRpcRequest (ref Params, "get_extra_features", featuresURI, UUID.Random ().ToString ()))
253 {
254 m_log.Error("[SIMFEATURES]: Could not retrieve extra features from grid. Please check configuration.");
255 return;
256 }
257 parameters = (OSDMap)Params;
258 OSDMap features = (OSDMap)parameters ["result"];
259
260 if(features.ContainsKey("region_override"))
261 m_AllowOverride = features ["region_override"].AsBoolean () ;
262 else
263 m_AllowOverride = true;
264
265 OSDMap test = (OSDMap)features ["extra_features"];
266 lock (m_features)
267 {
268 OSDMap extrasMap = new OSDMap();
269 foreach (string key in test.Keys)
270 {
271 extrasMap[key] = test[key];
272 }
273 m_features["OpenSimExtras"] = extrasMap;
274 }
275 }
220 } 276 }
221} 277}