diff options
author | root | 2009-12-22 06:25:32 +0100 |
---|---|---|
committer | Melanie | 2009-12-22 04:55:43 +0000 |
commit | 05e8b4e72c440e19c54fbcb17e2120834a27c3ab (patch) | |
tree | 70103466881cedae8c63de87b8747ccaba58f7a2 /OpenSim | |
parent | Glue code for a couple of new LSL function implementations (diff) | |
download | opensim-SC_OLD-05e8b4e72c440e19c54fbcb17e2120834a27c3ab.zip opensim-SC_OLD-05e8b4e72c440e19c54fbcb17e2120834a27c3ab.tar.gz opensim-SC_OLD-05e8b4e72c440e19c54fbcb17e2120834a27c3ab.tar.bz2 opensim-SC_OLD-05e8b4e72c440e19c54fbcb17e2120834a27c3ab.tar.xz |
Add a data path for error messages
Committed from my other box where git is not configured properly
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to '')
6 files changed, 57 insertions, 14 deletions
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 1f1ac78..74c6ab0 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Framework.Capabilities | |||
46 | 46 | ||
47 | public delegate UUID UpdateItem(UUID itemID, byte[] data); | 47 | public delegate UUID UpdateItem(UUID itemID, byte[] data); |
48 | 48 | ||
49 | public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data); | 49 | public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); |
50 | 50 | ||
51 | public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); | 51 | public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); |
52 | 52 | ||
@@ -54,7 +54,7 @@ namespace OpenSim.Framework.Capabilities | |||
54 | 54 | ||
55 | public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data); | 55 | public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data); |
56 | 56 | ||
57 | public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, | 57 | public delegate ArrayList TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, |
58 | bool isScriptRunning, byte[] data); | 58 | bool isScriptRunning, byte[] data); |
59 | 59 | ||
60 | public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, | 60 | public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, |
@@ -940,11 +940,13 @@ namespace OpenSim.Framework.Capabilities | |||
940 | /// <param name="primID">Prim containing item to update</param> | 940 | /// <param name="primID">Prim containing item to update</param> |
941 | /// <param name="isScriptRunning">Signals whether the script to update is currently running</param> | 941 | /// <param name="isScriptRunning">Signals whether the script to update is currently running</param> |
942 | /// <param name="data">New asset data</param> | 942 | /// <param name="data">New asset data</param> |
943 | public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data) | 943 | public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors) |
944 | { | 944 | { |
945 | if (TaskScriptUpdatedCall != null) | 945 | if (TaskScriptUpdatedCall != null) |
946 | { | 946 | { |
947 | TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data); | 947 | ArrayList e = TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data); |
948 | foreach (Object item in e) | ||
949 | errors.Add(item); | ||
948 | } | 950 | } |
949 | } | 951 | } |
950 | 952 | ||
@@ -1174,17 +1176,20 @@ namespace OpenSim.Framework.Capabilities | |||
1174 | // data, path, param)); | 1176 | // data, path, param)); |
1175 | 1177 | ||
1176 | string res = String.Empty; | 1178 | string res = String.Empty; |
1177 | LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); | 1179 | LLSDTaskScriptUploadComplete uploadComplete = new LLSDTaskScriptUploadComplete(); |
1178 | 1180 | ||
1181 | ArrayList errors = new ArrayList(); | ||
1179 | handlerUpdateTaskScript = OnUpLoad; | 1182 | handlerUpdateTaskScript = OnUpLoad; |
1180 | if (handlerUpdateTaskScript != null) | 1183 | if (handlerUpdateTaskScript != null) |
1181 | { | 1184 | { |
1182 | handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data); | 1185 | handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data, ref errors); |
1183 | } | 1186 | } |
1184 | 1187 | ||
1185 | uploadComplete.item_id = inventoryItemID; | 1188 | uploadComplete.new_asset = inventoryItemID; |
1186 | uploadComplete.task_id = primID; | 1189 | uploadComplete.compiled = errors.Count > 0 ? false : true; |
1187 | uploadComplete.state = "complete"; | 1190 | uploadComplete.state = "complete"; |
1191 | uploadComplete.errors = new OSDArray(); | ||
1192 | uploadComplete.errors.Array = errors; | ||
1188 | 1193 | ||
1189 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | 1194 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); |
1190 | 1195 | ||
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> |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 25a4cd6..035686e 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1470,5 +1470,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1470 | 1470 | ||
1471 | return true; | 1471 | return true; |
1472 | } | 1472 | } |
1473 | |||
1474 | public ArrayList GetScriptErrors(UUID itemID) | ||
1475 | { | ||
1476 | return new ArrayList(); | ||
1477 | } | ||
1473 | } | 1478 | } |
1474 | } | 1479 | } |