diff options
Diffstat (limited to 'OpenSim/Region/Framework')
4 files changed, 39 insertions, 6 deletions
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 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Collections; | ||
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
31 | 32 | ||
@@ -71,6 +72,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
71 | /// Start all the scripts contained in this entity's inventory | 72 | /// Start all the scripts contained in this entity's inventory |
72 | /// </summary> | 73 | /// </summary> |
73 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); | 74 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); |
75 | ArrayList GetScriptErrors(UUID itemID); | ||
74 | 76 | ||
75 | /// <summary> | 77 | /// <summary> |
76 | /// Stop all the scripts in this entity. | 78 | /// 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 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | 31 | ||
31 | namespace OpenSim.Region.Framework.Interfaces | 32 | namespace OpenSim.Region.Framework.Interfaces |
@@ -39,5 +40,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | 40 | ||
40 | bool PostScriptEvent(UUID itemID, string name, Object[] args); | 41 | bool PostScriptEvent(UUID itemID, string name, Object[] args); |
41 | bool PostObjectEvent(UUID itemID, string name, Object[] args); | 42 | bool PostObjectEvent(UUID itemID, string name, Object[] args); |
43 | |||
44 | ArrayList GetScriptErrors(UUID itemID); | ||
42 | } | 45 | } |
43 | } | 46 | } |
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 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Collections; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Text; | 32 | using System.Text; |
32 | using System.Timers; | 33 | using System.Timers; |
@@ -215,13 +216,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
215 | /// <param name="primID">The prim which contains the item to update</param> | 216 | /// <param name="primID">The prim which contains the item to update</param> |
216 | /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param> | 217 | /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param> |
217 | /// <param name="data"></param> | 218 | /// <param name="data"></param> |
218 | public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId, | 219 | public ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId, |
219 | UUID primId, bool isScriptRunning, byte[] data) | 220 | UUID primId, bool isScriptRunning, byte[] data) |
220 | { | 221 | { |
221 | if (!Permissions.CanEditScript(itemId, primId, remoteClient.AgentId)) | 222 | if (!Permissions.CanEditScript(itemId, primId, remoteClient.AgentId)) |
222 | { | 223 | { |
223 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); | 224 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); |
224 | return; | 225 | return new ArrayList(); |
225 | } | 226 | } |
226 | 227 | ||
227 | // Retrieve group | 228 | // Retrieve group |
@@ -234,7 +235,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
234 | "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist", | 235 | "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist", |
235 | itemId, primId); | 236 | itemId, primId); |
236 | 237 | ||
237 | return; | 238 | return new ArrayList(); |
238 | } | 239 | } |
239 | 240 | ||
240 | // Retrieve item | 241 | // Retrieve item |
@@ -247,7 +248,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
247 | + " but the item does not exist in this inventory", | 248 | + " but the item does not exist in this inventory", |
248 | itemId, part.Name, part.UUID); | 249 | itemId, part.Name, part.UUID); |
249 | 250 | ||
250 | return; | 251 | return new ArrayList(); |
251 | } | 252 | } |
252 | 253 | ||
253 | AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data); | 254 | AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data); |
@@ -264,29 +265,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | part.GetProperties(remoteClient); | 265 | part.GetProperties(remoteClient); |
265 | 266 | ||
266 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) | 267 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) |
268 | ArrayList errors = new ArrayList(); | ||
269 | |||
267 | if (isScriptRunning) | 270 | if (isScriptRunning) |
268 | { | 271 | { |
269 | // Needs to determine which engine was running it and use that | 272 | // Needs to determine which engine was running it and use that |
270 | // | 273 | // |
271 | part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); | 274 | part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); |
275 | errors = part.Inventory.GetScriptErrors(item.ItemID); | ||
272 | } | 276 | } |
273 | else | 277 | else |
274 | { | 278 | { |
275 | remoteClient.SendAgentAlertMessage("Script saved", false); | 279 | remoteClient.SendAgentAlertMessage("Script saved", false); |
276 | } | 280 | } |
281 | return errors; | ||
277 | } | 282 | } |
278 | 283 | ||
279 | /// <summary> | 284 | /// <summary> |
280 | /// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, UUID, UUID, bool, byte[])</see> | 285 | /// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, UUID, UUID, bool, byte[])</see> |
281 | /// </summary> | 286 | /// </summary> |
282 | public void CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId, | 287 | public ArrayList CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId, |
283 | UUID primId, bool isScriptRunning, byte[] data) | 288 | UUID primId, bool isScriptRunning, byte[] data) |
284 | { | 289 | { |
285 | ScenePresence avatar; | 290 | ScenePresence avatar; |
286 | 291 | ||
287 | if (TryGetAvatar(avatarId, out avatar)) | 292 | if (TryGetAvatar(avatarId, out avatar)) |
288 | { | 293 | { |
289 | CapsUpdateTaskInventoryScriptAsset( | 294 | return CapsUpdateTaskInventoryScriptAsset( |
290 | avatar.ControllingClient, itemId, primId, isScriptRunning, data); | 295 | avatar.ControllingClient, itemId, primId, isScriptRunning, data); |
291 | } | 296 | } |
292 | else | 297 | else |
@@ -295,6 +300,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
295 | "[PRIM INVENTORY]: " + | 300 | "[PRIM INVENTORY]: " + |
296 | "Avatar {0} cannot be found to update its prim item asset", | 301 | "Avatar {0} cannot be found to update its prim item asset", |
297 | avatarId); | 302 | avatarId); |
303 | return new ArrayList(); | ||
298 | } | 304 | } |
299 | } | 305 | } |
300 | 306 | ||
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; | |||
29 | using System.Xml; | 29 | using System.Xml; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Collections; | ||
32 | using System.Reflection; | 33 | using System.Reflection; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using log4net; | 35 | using log4net; |
@@ -205,6 +206,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
205 | } | 206 | } |
206 | } | 207 | } |
207 | 208 | ||
209 | public ArrayList GetScriptErrors(UUID itemID) | ||
210 | { | ||
211 | ArrayList ret = new ArrayList(); | ||
212 | |||
213 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
214 | if (engines == null) // No engine at all | ||
215 | return ret; | ||
216 | |||
217 | foreach (IScriptModule e in engines) | ||
218 | { | ||
219 | if (e != null) | ||
220 | { | ||
221 | ArrayList errors = e.GetScriptErrors(itemID); | ||
222 | foreach (Object line in errors) | ||
223 | ret.Add(line); | ||
224 | } | ||
225 | } | ||
226 | |||
227 | return ret; | ||
228 | } | ||
229 | |||
208 | /// <summary> | 230 | /// <summary> |
209 | /// Stop all the scripts in this prim. | 231 | /// Stop all the scripts in this prim. |
210 | /// </summary> | 232 | /// </summary> |