aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2018-10-19 03:43:01 +0100
committerUbitUmarov2018-10-19 03:43:01 +0100
commit6569f12d4005551bac44069246f7ecdc59e8fe1a (patch)
tree52c404c0808ccd9d115be0f03eb686ba9ba37f36 /OpenSim
parentfix AGENT_MALE lsl constant havinf same value as AGENT_AUTOPILOT (diff)
downloadopensim-SC-6569f12d4005551bac44069246f7ecdc59e8fe1a.zip
opensim-SC-6569f12d4005551bac44069246f7ecdc59e8fe1a.tar.gz
opensim-SC-6569f12d4005551bac44069246f7ecdc59e8fe1a.tar.bz2
opensim-SC-6569f12d4005551bac44069246f7ecdc59e8fe1a.tar.xz
add initial test support for cap LSLSyntax. This does not seem to work for Opensimulator on viewers, In particular with FireStorm seems impossible to replace its own definitions, viwers do note revert to defaults on tp to a region that does not suport this cap, etc. So possible just a dead end. Disabled by default
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs79
1 files changed, 73 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index cbcbd2d..8c7fb56 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -28,7 +28,9 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO;
31using System.Reflection; 32using System.Reflection;
33using System.Text;
32using log4net; 34using log4net;
33using Nini.Config; 35using Nini.Config;
34using Mono.Addins; 36using Mono.Addins;
@@ -75,12 +77,16 @@ namespace OpenSim.Region.ClientStack.Linden
75 private string m_GridName = string.Empty; 77 private string m_GridName = string.Empty;
76 private string m_GridURL = string.Empty; 78 private string m_GridURL = string.Empty;
77 79
80 static private UUID m_scriptSyntaxeID = UUID.Zero;
81 static private string m_scriptSyntaxeXML;
82 private bool m_doScriptSyntax;
83
78 #region ISharedRegionModule Members 84 #region ISharedRegionModule Members
79 85
80 public void Initialise(IConfigSource source) 86 public void Initialise(IConfigSource source)
81 { 87 {
82 IConfig config = source.Configs["SimulatorFeatures"]; 88 IConfig config = source.Configs["SimulatorFeatures"];
83 89 m_doScriptSyntax = false;
84 if (config != null) 90 if (config != null)
85 { 91 {
86 // 92 //
@@ -103,8 +109,10 @@ namespace OpenSim.Region.ClientStack.Linden
103 if (m_GridName == string.Empty) 109 if (m_GridName == string.Empty)
104 m_GridName = Util.GetConfigVarFromSections<string>( 110 m_GridName = Util.GetConfigVarFromSections<string>(
105 source, "gridname", new string[] { "GridInfo", "SimulatorFeatures" }, String.Empty); 111 source, "gridname", new string[] { "GridInfo", "SimulatorFeatures" }, String.Empty);
112 m_doScriptSyntax = config.GetBoolean("ScriptSyntaxe", m_doScriptSyntax);
106 } 113 }
107 114
115 ReadScriptSyntaxe();
108 AddDefaultFeatures(); 116 AddDefaultFeatures();
109 } 117 }
110 118
@@ -160,6 +168,9 @@ namespace OpenSim.Region.ClientStack.Linden
160 typesMap["prim"] = true; 168 typesMap["prim"] = true;
161 m_features["PhysicsShapeTypes"] = typesMap; 169 m_features["PhysicsShapeTypes"] = typesMap;
162 170
171 if(m_doScriptSyntax && m_scriptSyntaxeID != UUID.Zero)
172 m_features["LSLSyntaxId"] = OSD.FromUUID(m_scriptSyntaxeID);
173
163 // Extra information for viewers that want to use it 174 // Extra information for viewers that want to use it
164 // TODO: Take these out of here into their respective modules, like map-server-url 175 // TODO: Take these out of here into their respective modules, like map-server-url
165 OSDMap extrasMap; 176 OSDMap extrasMap;
@@ -192,12 +203,20 @@ namespace OpenSim.Region.ClientStack.Linden
192 203
193 public void RegisterCaps(UUID agentID, Caps caps) 204 public void RegisterCaps(UUID agentID, Caps caps)
194 { 205 {
195 IRequestHandler reqHandler 206 IRequestHandler reqHandler = new RestHTTPHandler(
196 = new RestHTTPHandler(
197 "GET", "/CAPS/" + UUID.Random(), 207 "GET", "/CAPS/" + UUID.Random(),
198 x => { return HandleSimulatorFeaturesRequest(x, agentID); }, "SimulatorFeatures", agentID.ToString()); 208 x => { return HandleSimulatorFeaturesRequest(x, agentID); },
199 209 "SimulatorFeatures", agentID.ToString());
200 caps.RegisterHandler("SimulatorFeatures", reqHandler); 210 caps.RegisterHandler("SimulatorFeatures", reqHandler);
211
212 if (m_doScriptSyntax && m_scriptSyntaxeID != UUID.Zero && !String.IsNullOrEmpty(m_scriptSyntaxeXML))
213 {
214 IRequestHandler sreqHandler = new RestHTTPHandler(
215 "GET", "/CAPS/" + UUID.Random(),
216 x => { return HandleSyntaxeRequest(x, agentID); },
217 "LSLSyntax", agentID.ToString());
218 caps.RegisterHandler("LSLSyntax", sreqHandler);
219 }
201 } 220 }
202 221
203 public void AddFeature(string name, OSD value) 222 public void AddFeature(string name, OSD value)
@@ -236,7 +255,7 @@ namespace OpenSim.Region.ClientStack.Linden
236 255
237 private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID) 256 private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID)
238 { 257 {
239// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); 258 // m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
240 259
241 OSDMap copy = DeepCopy(); 260 OSDMap copy = DeepCopy();
242 261
@@ -259,12 +278,21 @@ namespace OpenSim.Region.ClientStack.Linden
259 return responsedata; 278 return responsedata;
260 } 279 }
261 280
281 private Hashtable HandleSyntaxeRequest(Hashtable mDhttpMethod, UUID agentID)
282 {
283 Hashtable responsedata = new Hashtable();
284 responsedata["int_response_code"] = 200;
285 responsedata["str_response_string"] = m_scriptSyntaxeXML;
286 return responsedata;
287 }
288
262 /// <summary> 289 /// <summary>
263 /// Gets the grid extra features. 290 /// Gets the grid extra features.
264 /// </summary> 291 /// </summary>
265 /// <param name='featuresURI'> 292 /// <param name='featuresURI'>
266 /// The URI Robust uses to handle the get_extra_features request 293 /// The URI Robust uses to handle the get_extra_features request
267 /// </param> 294 /// </param>
295
268 private void GetGridExtraFeatures(Scene scene) 296 private void GetGridExtraFeatures(Scene scene)
269 { 297 {
270 Dictionary<string, object> extraFeatures = scene.GridService.GetExtraFeatures(); 298 Dictionary<string, object> extraFeatures = scene.GridService.GetExtraFeatures();
@@ -299,5 +327,44 @@ namespace OpenSim.Region.ClientStack.Linden
299 327
300 return url; 328 return url;
301 } 329 }
330
331 private void ReadScriptSyntaxe()
332 {
333 if(!m_doScriptSyntax || m_scriptSyntaxeID != UUID.Zero)
334 return;
335
336 if(!File.Exists("ScriptSyntaxe.xml"))
337 return;
338
339 try
340 {
341 using (StreamReader sr = File.OpenText("ScriptSyntaxe.xml"))
342 {
343 string version = sr.ReadLine();
344 if(string.IsNullOrEmpty(version))
345 return;
346 if(!UUID.TryParse(version, out m_scriptSyntaxeID))
347 return;
348
349 StringBuilder sb = new StringBuilder(400*1024);
350 string s="";
351 char[] trimc = new char[] {' ','\t', '\n', '\r'};
352 while((s = sr.ReadLine()) != null)
353 {
354 s = s.Trim(trimc);
355 if(String.IsNullOrEmpty(s) || s.StartsWith("<--"))
356 continue;
357 sb.Append(s);
358 }
359 m_scriptSyntaxeXML = sb.ToString();
360 }
361 }
362 catch
363 {
364 m_log.Error("[SIMULATOR FEATURES MODULE] fail read ScriptSyntaxe.xml file");
365 m_scriptSyntaxeID = UUID.Zero;
366 m_scriptSyntaxeXML = "";
367 }
368 }
302 } 369 }
303} 370}