aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/TaskInventoryDictionary.cs4
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs19
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs49
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/ScriptException.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs10
9 files changed, 83 insertions, 34 deletions
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs
index 4d07746..62ecbd1 100644
--- a/OpenSim/Framework/TaskInventoryDictionary.cs
+++ b/OpenSim/Framework/TaskInventoryDictionary.cs
@@ -39,10 +39,12 @@ using OpenMetaverse;
39namespace OpenSim.Framework 39namespace OpenSim.Framework
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// A dictionary for task inventory. 42 /// A dictionary containing task inventory items. Indexed by item UUID.
43 /// </summary> 43 /// </summary>
44 /// <remarks>
44 /// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before 45 /// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before
45 /// iterating over it. 46 /// iterating over it.
47 /// </remarks>
46 public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>, 48 public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>,
47 ICloneable, IXmlSerializable 49 ICloneable, IXmlSerializable
48 { 50 {
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index fb818ee..574ee56 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -73,9 +73,6 @@ namespace OpenSim.Framework
73 73
74 private bool _ownerChanged = false; 74 private bool _ownerChanged = false;
75 75
76 // This used ONLY during copy. It can't be relied on at other times!
77 private bool _scriptRunning = true;
78
79 public UUID AssetID { 76 public UUID AssetID {
80 get { 77 get {
81 return _assetID; 78 return _assetID;
@@ -353,14 +350,13 @@ namespace OpenSim.Framework
353 } 350 }
354 } 351 }
355 352
356 public bool ScriptRunning { 353 /// <summary>
357 get { 354 /// This used ONLY during copy. It can't be relied on at other times!
358 return _scriptRunning; 355 /// </summary>
359 } 356 /// <remarks>
360 set { 357 /// For true script running status, use IEntityInventory.TryGetScriptInstanceRunning() for now.
361 _scriptRunning = value; 358 /// </remarks>
362 } 359 public bool ScriptRunning { get; set; }
363 }
364 360
365 // See ICloneable 361 // See ICloneable
366 362
@@ -388,6 +384,7 @@ namespace OpenSim.Framework
388 384
389 public TaskInventoryItem() 385 public TaskInventoryItem()
390 { 386 {
387 ScriptRunning = true;
391 CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 388 CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
392 } 389 }
393 } 390 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 3c65647..1f6af4a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5314,8 +5314,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5314 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); 5314 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false);
5315 AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); 5315 AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false);
5316 AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false); 5316 AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false);
5317 AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest, false); 5317 AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest);
5318 AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest, false); 5318 AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest);
5319 AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage); 5319 AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage);
5320 AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest); 5320 AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest);
5321 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 5321 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index e711afb..acd156e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -639,9 +639,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
639 639
640 if (grp.HasGroupChanged) 640 if (grp.HasGroupChanged)
641 { 641 {
642// m_log.DebugFormat( 642 m_log.DebugFormat(
643// "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", 643 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
644// grp.UUID, grp.AttachmentPoint); 644 grp.UUID, grp.AttachmentPoint);
645 645
646 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState); 646 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState);
647 647
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index b2c9bce..ab8f143 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -606,12 +606,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
606 cdt.AddColumn("Asset UUID", 36); 606 cdt.AddColumn("Asset UUID", 36);
607 607
608 foreach (TaskInventoryItem item in inv.GetInventoryItems()) 608 foreach (TaskInventoryItem item in inv.GetInventoryItems())
609 {
610 bool foundScriptInstance, scriptRunning;
611 foundScriptInstance
612 = SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, item, out scriptRunning);
613
609 cdt.AddRow( 614 cdt.AddRow(
610 item.Name, 615 item.Name,
611 ((InventoryType)item.InvType).ToString(), 616 ((InventoryType)item.InvType).ToString(),
612 (InventoryType)item.InvType == InventoryType.LSL ? item.ScriptRunning.ToString() : "n/a", 617 foundScriptInstance ? scriptRunning.ToString() : "n/a",
613 item.ItemID.ToString(), 618 item.ItemID.ToString(),
614 item.AssetID.ToString()); 619 item.AssetID.ToString());
620 }
615 621
616 return sb.Append(cdt.ToString()); 622 return sb.Append(cdt.ToString());
617 } 623 }
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 9d921de..8028d87 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -152,6 +152,19 @@ namespace OpenSim.Region.Framework.Interfaces
152 void StopScriptInstance(UUID itemId); 152 void StopScriptInstance(UUID itemId);
153 153
154 /// <summary> 154 /// <summary>
155 /// Try to get the script running status.
156 /// </summary>
157 /// <returns>
158 /// Returns true if a script for the item was found in one of the simulator's script engines. In this case,
159 /// the running parameter will reflect the running status.
160 /// Returns false if the item could not be found, if the item is not a script or if a script instance for the
161 /// item was not found in any of the script engines. In this case, running status is irrelevant.
162 /// </returns>
163 /// <param name='itemId'></param>
164 /// <param name='running'></param>
165 bool TryGetScriptInstanceRunning(UUID itemId, out bool running);
166
167 /// <summary>
155 /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative 168 /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative
156 /// name is chosen. 169 /// name is chosen.
157 /// </summary> 170 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index f41e329..3a9a146 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -244,31 +244,52 @@ namespace OpenSim.Region.Framework.Scenes
244 if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) 244 if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null)
245 return; 245 return;
246 246
247 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
248 if (engines == null) // No engine at all
249 return;
250
251 Items.LockItemsForRead(true); 247 Items.LockItemsForRead(true);
252 foreach (TaskInventoryItem item in Items.Values) 248 foreach (TaskInventoryItem item in Items.Values)
253 { 249 {
254 if (item.InvType == (int)InventoryType.LSL) 250 if (item.InvType == (int)InventoryType.LSL)
255 { 251 {
256 foreach (IScriptModule e in engines) 252 bool running;
257 { 253 if (TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running))
258 bool running; 254 item.ScriptRunning = running;
259
260 if (e.HasScript(item.ItemID, out running))
261 {
262 item.ScriptRunning = running;
263 break;
264 }
265 }
266 } 255 }
267 } 256 }
268 257
269 Items.LockItemsForRead(false); 258 Items.LockItemsForRead(false);
270 } 259 }
271 260
261 public bool TryGetScriptInstanceRunning(UUID itemId, out bool running)
262 {
263 running = false;
264
265 TaskInventoryItem item = GetInventoryItem(itemId);
266
267 if (item == null)
268 return false;
269
270 return TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running);
271 }
272
273 public static bool TryGetScriptInstanceRunning(Scene scene, TaskInventoryItem item, out bool running)
274 {
275 running = false;
276
277 if (item.InvType != (int)InventoryType.LSL)
278 return false;
279
280 IScriptModule[] engines = scene.RequestModuleInterfaces<IScriptModule>();
281 if (engines == null) // No engine at all
282 return false;
283
284 foreach (IScriptModule e in engines)
285 {
286 if (e.HasScript(item.ItemID, out running))
287 return true;
288 }
289
290 return false;
291 }
292
272 public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) 293 public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
273 { 294 {
274 int scriptsValidForStarting = 0; 295 int scriptsValidForStarting = 0;
diff --git a/OpenSim/Region/ScriptEngine/Shared/ScriptException.cs b/OpenSim/Region/ScriptEngine/Shared/ScriptException.cs
index ae67fc5..f55ba7e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/ScriptException.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/ScriptException.cs
@@ -26,9 +26,11 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Runtime.Serialization;
29 30
30namespace OpenSim.Region.ScriptEngine.Shared 31namespace OpenSim.Region.ScriptEngine.Shared
31{ 32{
33 [Serializable]
32 public class ScriptException : Exception 34 public class ScriptException : Exception
33 { 35 {
34 public ScriptException() : base() {} 36 public ScriptException() : base() {}
@@ -36,5 +38,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
36 public ScriptException(string message) : base(message) {} 38 public ScriptException(string message) : base(message) {}
37 39
38 public ScriptException(string message, Exception innerException) : base(message, innerException) {} 40 public ScriptException(string message, Exception innerException) : base(message, innerException) {}
41
42 public ScriptException(SerializationInfo info, StreamingContext context) :base(info, context) {}
39 } 43 }
40} \ No newline at end of file 44} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
index f247a0b..f331658 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
90// log4net.Config.XmlConfigurator.Configure(); 90// log4net.Config.XmlConfigurator.Configure();
91 91
92 UUID userId = TestHelpers.ParseTail(0x1); 92 UUID userId = TestHelpers.ParseTail(0x1);
93// UUID objectId = TestHelpers.ParseTail(0x2); 93// UUID objectId = TestHelpers.ParseTail(0x100);
94// UUID itemId = TestHelpers.ParseTail(0x3); 94// UUID itemId = TestHelpers.ParseTail(0x3);
95 string itemName = "TestStartScript() Item"; 95 string itemName = "TestStartScript() Item";
96 96
@@ -105,12 +105,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
105 105
106 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld; 106 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
107 107
108 m_scene.RezNewScript(userId, itemTemplate); 108 SceneObjectPart partWhereRezzed = m_scene.RezNewScript(userId, itemTemplate);
109 109
110 m_chatEvent.WaitOne(60000); 110 m_chatEvent.WaitOne(60000);
111 111
112 Assert.That(m_osChatMessageReceived, Is.Not.Null, "No chat message received in TestStartScript()"); 112 Assert.That(m_osChatMessageReceived, Is.Not.Null, "No chat message received in TestStartScript()");
113 Assert.That(m_osChatMessageReceived.Message, Is.EqualTo("Script running")); 113 Assert.That(m_osChatMessageReceived.Message, Is.EqualTo("Script running"));
114
115 bool running;
116 TaskInventoryItem scriptItem = partWhereRezzed.Inventory.GetInventoryItem(itemName);
117 Assert.That(
118 SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, scriptItem, out running), Is.True);
119 Assert.That(running, Is.True);
114 } 120 }
115 121
116 private void OnChatFromWorld(object sender, OSChatMessage oscm) 122 private void OnChatFromWorld(object sender, OSChatMessage oscm)