From 05e8b4e72c440e19c54fbcb17e2120834a27c3ab Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Dec 2009 06:25:32 +0100 Subject: Add a data path for error messages Committed from my other box where git is not configured properly Signed-off-by: Melanie --- .../Framework/Interfaces/IEntityInventory.cs | 2 ++ .../Region/Framework/Interfaces/IScriptModule.cs | 3 +++ OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 18 ++++++++++++------ .../Framework/Scenes/SceneObjectPartInventory.cs | 22 ++++++++++++++++++++++ 4 files changed, 39 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 89a45da..67395fa 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -26,6 +26,7 @@ */ using System.Collections.Generic; +using System.Collections; using OpenMetaverse; using OpenSim.Framework; @@ -71,6 +72,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Start all the scripts contained in this entity's inventory /// void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); + ArrayList GetScriptErrors(UUID itemID); /// /// Stop all the scripts in this entity. diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 98efcbe..e90b300 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections; using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces @@ -39,5 +40,7 @@ namespace OpenSim.Region.Framework.Interfaces bool PostScriptEvent(UUID itemID, string name, Object[] args); bool PostObjectEvent(UUID itemID, string name, Object[] args); + + ArrayList GetScriptErrors(UUID itemID); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 0b0c205..89ce4ae 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.Collections; using System.Reflection; using System.Text; using System.Timers; @@ -215,13 +216,13 @@ namespace OpenSim.Region.Framework.Scenes /// The prim which contains the item to update /// Indicates whether the script to update is currently running /// - public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId, + public ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId, UUID primId, bool isScriptRunning, byte[] data) { if (!Permissions.CanEditScript(itemId, primId, remoteClient.AgentId)) { remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); - return; + return new ArrayList(); } // Retrieve group @@ -234,7 +235,7 @@ namespace OpenSim.Region.Framework.Scenes "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist", itemId, primId); - return; + return new ArrayList(); } // Retrieve item @@ -247,7 +248,7 @@ namespace OpenSim.Region.Framework.Scenes + " but the item does not exist in this inventory", itemId, part.Name, part.UUID); - return; + return new ArrayList(); } AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data); @@ -264,29 +265,33 @@ namespace OpenSim.Region.Framework.Scenes part.GetProperties(remoteClient); // Trigger rerunning of script (use TriggerRezScript event, see RezScript) + ArrayList errors = new ArrayList(); + if (isScriptRunning) { // Needs to determine which engine was running it and use that // part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); + errors = part.Inventory.GetScriptErrors(item.ItemID); } else { remoteClient.SendAgentAlertMessage("Script saved", false); } + return errors; } /// /// CapsUpdateTaskInventoryScriptAsset(IClientAPI, UUID, UUID, bool, byte[]) /// - public void CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId, + public ArrayList CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId, UUID primId, bool isScriptRunning, byte[] data) { ScenePresence avatar; if (TryGetAvatar(avatarId, out avatar)) { - CapsUpdateTaskInventoryScriptAsset( + return CapsUpdateTaskInventoryScriptAsset( avatar.ControllingClient, itemId, primId, isScriptRunning, data); } else @@ -295,6 +300,7 @@ namespace OpenSim.Region.Framework.Scenes "[PRIM INVENTORY]: " + "Avatar {0} cannot be found to update its prim item asset", avatarId); + return new ArrayList(); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index b98747a..eb7f5ff 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -29,6 +29,7 @@ using System; using System.Xml; using System.IO; using System.Collections.Generic; +using System.Collections; using System.Reflection; using OpenMetaverse; using log4net; @@ -205,6 +206,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public ArrayList GetScriptErrors(UUID itemID) + { + ArrayList ret = new ArrayList(); + + IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); + if (engines == null) // No engine at all + return ret; + + foreach (IScriptModule e in engines) + { + if (e != null) + { + ArrayList errors = e.GetScriptErrors(itemID); + foreach (Object line in errors) + ret.Add(line); + } + } + + return ret; + } + /// /// Stop all the scripts in this prim. /// -- cgit v1.1