aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs22
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs9
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs6
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs12
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs128
9 files changed, 130 insertions, 71 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index d3bb0bc..d1ce5df 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -136,7 +136,6 @@ namespace OpenSim.Region.ClientStack.Linden
136 TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; 136 TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
137 CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS; 137 CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS;
138 GetClient = m_Scene.SceneContents.GetControllingClient; 138 GetClient = m_Scene.SceneContents.GetControllingClient;
139
140 } 139 }
141 140
142 /// <summary> 141 /// <summary>
@@ -232,7 +231,7 @@ namespace OpenSim.Region.ClientStack.Linden
232 public string SeedCapRequest(string request, string path, string param, 231 public string SeedCapRequest(string request, string path, string param,
233 OSHttpRequest httpRequest, OSHttpResponse httpResponse) 232 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
234 { 233 {
235 m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); 234// m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
236 235
237 if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) 236 if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
238 { 237 {
@@ -331,14 +330,22 @@ namespace OpenSim.Region.ClientStack.Linden
331 } 330 }
332 } 331 }
333 332
333 /// <summary>
334 /// Handle a request from the client for a Uri to upload a baked texture.
335 /// </summary>
336 /// <param name="request"></param>
337 /// <param name="path"></param>
338 /// <param name="param"></param>
339 /// <param name="httpRequest"></param>
340 /// <param name="httpResponse"></param>
341 /// <returns>The upload response if the request is successful, null otherwise.</returns>
334 public string UploadBakedTexture(string request, string path, 342 public string UploadBakedTexture(string request, string path,
335 string param, OSHttpRequest httpRequest, 343 string param, OSHttpRequest httpRequest,
336 OSHttpResponse httpResponse) 344 OSHttpResponse httpResponse)
337 { 345 {
338 try 346 try
339 { 347 {
340 // m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + 348// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + m_regionName);
341 // m_regionName);
342 349
343 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; 350 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
344 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 351 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
@@ -374,6 +381,11 @@ namespace OpenSim.Region.ClientStack.Linden
374 return null; 381 return null;
375 } 382 }
376 383
384 /// <summary>
385 /// Called when a baked texture has been successfully uploaded by a client.
386 /// </summary>
387 /// <param name="assetID"></param>
388 /// <param name="data"></param>
377 public void BakedTextureUploaded(UUID assetID, byte[] data) 389 public void BakedTextureUploaded(UUID assetID, byte[] data)
378 { 390 {
379 // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); 391 // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
@@ -687,7 +699,7 @@ namespace OpenSim.Region.ClientStack.Linden
687 item.CurrentPermissions = (uint)PermissionMask.All; 699 item.CurrentPermissions = (uint)PermissionMask.All;
688 item.BasePermissions = (uint)PermissionMask.All; 700 item.BasePermissions = (uint)PermissionMask.All;
689 item.EveryOnePermissions = 0; 701 item.EveryOnePermissions = 0;
690 item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); 702 item.NextPermissions = (uint)PermissionMask.All;
691 item.CreationDate = Util.UnixTimeSinceEpoch(); 703 item.CreationDate = Util.UnixTimeSinceEpoch();
692 704
693 if (AddNewInventoryItem != null) 705 if (AddNewInventoryItem != null)
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
index 14160ae..66b865f 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
@@ -48,8 +48,8 @@ namespace OpenSim.Region.ClientStack.Linden
48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
49 public class BunchOfCapsModule : INonSharedRegionModule 49 public class BunchOfCapsModule : INonSharedRegionModule
50 { 50 {
51 private static readonly ILog m_log = 51// private static readonly ILog m_log =
52 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 private Scene m_Scene; 54 private Scene m_Scene;
55 55
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index e0807ee..e7bd2e7 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -50,8 +50,8 @@ namespace OpenSim.Region.ClientStack.Linden
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class GetMeshModule : INonSharedRegionModule 51 public class GetMeshModule : INonSharedRegionModule
52 { 52 {
53 private static readonly ILog m_log = 53// private static readonly ILog m_log =
54 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 private Scene m_scene; 56 private Scene m_scene;
57 private IAssetService m_AssetService; 57 private IAssetService m_AssetService;
@@ -113,12 +113,12 @@ namespace OpenSim.Region.ClientStack.Linden
113 113
114 public void RegisterCaps(UUID agentID, Caps caps) 114 public void RegisterCaps(UUID agentID, Caps caps)
115 { 115 {
116 UUID capID = UUID.Random(); 116// UUID capID = UUID.Random();
117 117
118 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); 118 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
119 if (m_URL == "localhost") 119 if (m_URL == "localhost")
120 { 120 {
121 m_log.InfoFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); 121// m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
122 GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); 122 GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
123 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), 123 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(),
124 delegate(Hashtable m_dhttpMethod) 124 delegate(Hashtable m_dhttpMethod)
@@ -130,7 +130,7 @@ namespace OpenSim.Region.ClientStack.Linden
130 } 130 }
131 else 131 else
132 { 132 {
133 m_log.InfoFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); 133// m_log.DebugFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
134 caps.RegisterHandler("GetMesh", m_URL); 134 caps.RegisterHandler("GetMesh", m_URL);
135 } 135 }
136 } 136 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index 35eedb4..fffcee2 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -54,8 +54,9 @@ namespace OpenSim.Region.ClientStack.Linden
54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
55 public class GetTextureModule : INonSharedRegionModule 55 public class GetTextureModule : INonSharedRegionModule
56 { 56 {
57 private static readonly ILog m_log = 57// private static readonly ILog m_log =
58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59
59 private Scene m_scene; 60 private Scene m_scene;
60 private IAssetService m_assetService; 61 private IAssetService m_assetService;
61 62
@@ -128,12 +129,12 @@ namespace OpenSim.Region.ClientStack.Linden
128 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); 129 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
129 if (m_URL == "localhost") 130 if (m_URL == "localhost")
130 { 131 {
131 m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); 132// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
132 caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); 133 caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService));
133 } 134 }
134 else 135 else
135 { 136 {
136 m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); 137// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
137 caps.RegisterHandler("GetTexture", m_URL); 138 caps.RegisterHandler("GetTexture", m_URL);
138 } 139 }
139 } 140 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
index c9d7ae1..18c7eae 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
@@ -48,8 +48,8 @@ namespace OpenSim.Region.ClientStack.Linden
48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
49 public class MeshUploadFlagModule : INonSharedRegionModule 49 public class MeshUploadFlagModule : INonSharedRegionModule
50 { 50 {
51 private static readonly ILog m_log = 51// private static readonly ILog m_log =
52 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 /// <summary> 54 /// <summary>
55 /// Is this module enabled? 55 /// Is this module enabled?
@@ -124,7 +124,7 @@ namespace OpenSim.Region.ClientStack.Linden
124 124
125 private Hashtable MeshUploadFlag(Hashtable mDhttpMethod) 125 private Hashtable MeshUploadFlag(Hashtable mDhttpMethod)
126 { 126 {
127 m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request"); 127// m_log.DebugFormat("[MESH UPLOAD FLAG MODULE]: MeshUploadFlag request");
128 128
129 OSDMap data = new OSDMap(); 129 OSDMap data = new OSDMap();
130 ScenePresence sp = m_scene.GetScenePresence(m_agentID); 130 ScenePresence sp = m_scene.GetScenePresence(m_agentID);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
index b7e79cc..b2f04f9 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
@@ -160,8 +160,6 @@ namespace OpenSim.Region.ClientStack.Linden
160 } 160 }
161 } 161 }
162 // } 162 // }
163
164
165 163
166 string assetName = llsdRequest.name; 164 string assetName = llsdRequest.name;
167 string assetDes = llsdRequest.description; 165 string assetDes = llsdRequest.description;
@@ -208,12 +206,10 @@ namespace OpenSim.Region.ClientStack.Linden
208 return uploadResponse; 206 return uploadResponse;
209 } 207 }
210 208
211
212 public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, 209 public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
213 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, 210 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
214 string assetType,UUID AgentID) 211 string assetType,UUID AgentID)
215 { 212 {
216
217 sbyte assType = 0; 213 sbyte assType = 0;
218 sbyte inType = 0; 214 sbyte inType = 0;
219 215
@@ -266,10 +262,10 @@ namespace OpenSim.Region.ClientStack.Linden
266 item.CurrentPermissions = (uint)PermissionMask.All; 262 item.CurrentPermissions = (uint)PermissionMask.All;
267 item.BasePermissions = (uint)PermissionMask.All; 263 item.BasePermissions = (uint)PermissionMask.All;
268 item.EveryOnePermissions = 0; 264 item.EveryOnePermissions = 0;
269 item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); 265 item.NextPermissions = (uint)PermissionMask.All;
270 item.CreationDate = Util.UnixTimeSinceEpoch(); 266 item.CreationDate = Util.UnixTimeSinceEpoch();
271 m_scene.AddInventoryItem(item); 267 m_scene.AddInventoryItem(item);
272 268
273 } 269 }
274 } 270 }
275} 271} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
index 15139a3..1c47f0e 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
@@ -322,8 +322,6 @@ namespace OpenSim.Region.ClientStack.Linden
322 rootpart.NextOwnerMask = next_owner_mask; 322 rootpart.NextOwnerMask = next_owner_mask;
323 rootpart.Material = (byte)material; 323 rootpart.Material = (byte)material;
324 324
325
326
327 m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); 325 m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
328 326
329 responsedata["int_response_code"] = 200; //501; //410; //404; 327 responsedata["int_response_code"] = 200; //501; //410; //404;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
index 15ed3b3..c07fc73 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
@@ -129,7 +129,7 @@ namespace OpenSim.Region.ClientStack.Linden
129 129
130 130
131 /// <summary> 131 /// <summary>
132 /// Parses ad request 132 /// Parses add request
133 /// </summary> 133 /// </summary>
134 /// <param name="request"></param> 134 /// <param name="request"></param>
135 /// <param name="AgentId"></param> 135 /// <param name="AgentId"></param>
@@ -312,11 +312,11 @@ namespace OpenSim.Region.ClientStack.Linden
312 primFace.RepeatV = face.ScaleT; 312 primFace.RepeatV = face.ScaleT;
313 primFace.TexMapType = (MappingType) (face.MediaFlags & 6); 313 primFace.TexMapType = (MappingType) (face.MediaFlags & 6);
314 } 314 }
315
315 pbs.TextureEntry = tmp.GetBytes(); 316 pbs.TextureEntry = tmp.GetBytes();
316 prim.Shape = pbs; 317 prim.Shape = pbs;
317 prim.Scale = obj.Scale; 318 prim.Scale = obj.Scale;
318 319
319
320 SceneObjectGroup grp = new SceneObjectGroup(); 320 SceneObjectGroup grp = new SceneObjectGroup();
321 321
322 grp.SetRootPart(prim); 322 grp.SetRootPart(prim);
@@ -330,7 +330,7 @@ namespace OpenSim.Region.ClientStack.Linden
330 grp.AbsolutePosition = obj.Position; 330 grp.AbsolutePosition = obj.Position;
331 prim.RotationOffset = obj.Rotation; 331 prim.RotationOffset = obj.Rotation;
332 332
333 grp.RootPart.IsAttachment = false; 333 grp.IsAttachment = false;
334 // Required for linking 334 // Required for linking
335 grp.RootPart.UpdateFlag = 0; 335 grp.RootPart.UpdateFlag = 0;
336 336
@@ -339,8 +339,8 @@ namespace OpenSim.Region.ClientStack.Linden
339 m_scene.AddSceneObject(grp); 339 m_scene.AddSceneObject(grp);
340 grp.AbsolutePosition = obj.Position; 340 grp.AbsolutePosition = obj.Position;
341 } 341 }
342
342 allparts[i] = grp; 343 allparts[i] = grp;
343
344 } 344 }
345 345
346 for (int j = 1; j < allparts.Length; j++) 346 for (int j = 1; j < allparts.Length; j++)
@@ -351,7 +351,9 @@ namespace OpenSim.Region.ClientStack.Linden
351 } 351 }
352 352
353 rootGroup.ScheduleGroupForFullUpdate(); 353 rootGroup.ScheduleGroupForFullUpdate();
354 pos = m_scene.GetNewRezLocation(Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale(), false); 354 pos
355 = m_scene.GetNewRezLocation(
356 Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale, false);
355 357
356 responsedata["int_response_code"] = 200; //501; //410; //404; 358 responsedata["int_response_code"] = 200; //501; //410; //404;
357 responsedata["content_type"] = "text/plain"; 359 responsedata["content_type"] = "text/plain";
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index 9f78948..1dd8938 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -43,21 +43,29 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
43namespace OpenSim.Region.ClientStack.Linden 43namespace OpenSim.Region.ClientStack.Linden
44{ 44{
45 /// <summary> 45 /// <summary>
46 /// SimulatorFeatures capability. This is required for uploading Mesh. 46 /// SimulatorFeatures capability.
47 /// </summary>
48 /// <remarks>
49 /// This is required for uploading Mesh.
47 /// Since is accepts an open-ended response, we also send more information 50 /// Since is accepts an open-ended response, we also send more information
48 /// for viewers that care to interpret it. 51 /// for viewers that care to interpret it.
49 /// 52 ///
50 /// NOTE: Part of this code was adapted from the Aurora project, specifically 53 /// NOTE: Part of this code was adapted from the Aurora project, specifically
51 /// the normal part of the response in the capability handler. 54 /// the normal part of the response in the capability handler.
52 /// </summary> 55 /// </remarks>
53 ///
54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 56 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
55 public class SimulatorFeaturesModule : ISharedRegionModule 57 public class SimulatorFeaturesModule : ISharedRegionModule, ISimulatorFeaturesModule
56 { 58 {
57 private static readonly ILog m_log = 59// private static readonly ILog m_log =
58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 60// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
61
59 private Scene m_scene; 62 private Scene m_scene;
60 63
64 /// <summary>
65 /// Simulator features
66 /// </summary>
67 private OSDMap m_features = new OSDMap();
68
61 private string m_MapImageServerURL = string.Empty; 69 private string m_MapImageServerURL = string.Empty;
62 private string m_SearchURL = string.Empty; 70 private string m_SearchURL = string.Empty;
63 71
@@ -66,18 +74,20 @@ namespace OpenSim.Region.ClientStack.Linden
66 public void Initialise(IConfigSource source) 74 public void Initialise(IConfigSource source)
67 { 75 {
68 IConfig config = source.Configs["SimulatorFeatures"]; 76 IConfig config = source.Configs["SimulatorFeatures"];
69 if (config == null) 77 if (config != null)
70 return;
71
72 m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
73 if (m_MapImageServerURL != string.Empty)
74 { 78 {
75 m_MapImageServerURL = m_MapImageServerURL.Trim(); 79 m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
76 if (!m_MapImageServerURL.EndsWith("/")) 80 if (m_MapImageServerURL != string.Empty)
77 m_MapImageServerURL = m_MapImageServerURL + "/"; 81 {
82 m_MapImageServerURL = m_MapImageServerURL.Trim();
83 if (!m_MapImageServerURL.EndsWith("/"))
84 m_MapImageServerURL = m_MapImageServerURL + "/";
85 }
86
87 m_SearchURL = config.GetString("SearchServerURI", string.Empty);
78 } 88 }
79 89
80 m_SearchURL = config.GetString("SearchServerURI", string.Empty); 90 AddDefaultFeatures();
81 } 91 }
82 92
83 public void AddRegion(Scene s) 93 public void AddRegion(Scene s)
@@ -110,43 +120,83 @@ namespace OpenSim.Region.ClientStack.Linden
110 120
111 #endregion 121 #endregion
112 122
123 /// <summary>
124 /// Add default features
125 /// </summary>
126 /// <remarks>
127 /// TODO: These should be added from other modules rather than hardcoded.
128 /// </remarks>
129 private void AddDefaultFeatures()
130 {
131 lock (m_features)
132 {
133 m_features["MeshRezEnabled"] = true;
134 m_features["MeshUploadEnabled"] = true;
135 m_features["MeshXferEnabled"] = true;
136 m_features["PhysicsMaterialsEnabled"] = true;
137
138 OSDMap typesMap = new OSDMap();
139 typesMap["convex"] = true;
140 typesMap["none"] = true;
141 typesMap["prim"] = true;
142 m_features["PhysicsShapeTypes"] = typesMap;
143
144 // Extra information for viewers that want to use it
145 OSDMap gridServicesMap = new OSDMap();
146 if (m_MapImageServerURL != string.Empty)
147 gridServicesMap["map-server-url"] = m_MapImageServerURL;
148 if (m_SearchURL != string.Empty)
149 gridServicesMap["search"] = m_SearchURL;
150 m_features["GridServices"] = gridServicesMap;
151 }
152 }
153
113 public void RegisterCaps(UUID agentID, Caps caps) 154 public void RegisterCaps(UUID agentID, Caps caps)
114 { 155 {
115 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), SimulatorFeatures); 156 IRequestHandler reqHandler
157 = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), HandleSimulatorFeaturesRequest);
158
116 caps.RegisterHandler("SimulatorFeatures", reqHandler); 159 caps.RegisterHandler("SimulatorFeatures", reqHandler);
117 } 160 }
118 161
119 private Hashtable SimulatorFeatures(Hashtable mDhttpMethod) 162 public void AddFeature(string name, OSD value)
120 { 163 {
121 m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); 164 lock (m_features)
122 OSDMap data = new OSDMap(); 165 m_features[name] = value;
123 data["MeshRezEnabled"] = true; 166 }
124 data["MeshUploadEnabled"] = true; 167
125 data["MeshXferEnabled"] = true; 168 public bool RemoveFeature(string name)
126 data["PhysicsMaterialsEnabled"] = true; 169 {
127 170 lock (m_features)
128 OSDMap typesMap = new OSDMap(); 171 return m_features.Remove(name);
129 typesMap["convex"] = true; 172 }
130 typesMap["none"] = true; 173
131 typesMap["prim"] = true; 174 public bool TryGetFeature(string name, out OSD value)
132 data["PhysicsShapeTypes"] = typesMap; 175 {
133 176 lock (m_features)
134 // Extra information for viewers that want to use it 177 return m_features.TryGetValue(name, out value);
135 OSDMap gridServicesMap = new OSDMap(); 178 }
136 if (m_MapImageServerURL != string.Empty) 179
137 gridServicesMap["map-server-url"] = m_MapImageServerURL; 180 public OSDMap GetFeatures()
138 if (m_SearchURL != string.Empty) 181 {
139 gridServicesMap["search"] = m_SearchURL; 182 lock (m_features)
140 data["GridServices"] = gridServicesMap; 183 return new OSDMap(m_features);
184 }
185
186 private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod)
187 {
188// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
141 189
142 //Send back data 190 //Send back data
143 Hashtable responsedata = new Hashtable(); 191 Hashtable responsedata = new Hashtable();
144 responsedata["int_response_code"] = 200; 192 responsedata["int_response_code"] = 200;
145 responsedata["content_type"] = "text/plain"; 193 responsedata["content_type"] = "text/plain";
146 responsedata["keepalive"] = false; 194 responsedata["keepalive"] = false;
147 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data); 195
196 lock (m_features)
197 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features);
198
148 return responsedata; 199 return responsedata;
149 } 200 }
150
151 } 201 }
152} 202}