Add a data path for error messages
parent
49fbe0ddb4
commit
b53b871669
|
@ -46,7 +46,7 @@ namespace OpenSim.Framework.Capabilities
|
||||||
|
|
||||||
public delegate UUID UpdateItem(UUID itemID, byte[] data);
|
public delegate UUID UpdateItem(UUID itemID, byte[] data);
|
||||||
|
|
||||||
public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data);
|
public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors);
|
||||||
|
|
||||||
public delegate void NewInventoryItem(UUID userID, InventoryItemBase item);
|
public delegate void NewInventoryItem(UUID userID, InventoryItemBase item);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ namespace OpenSim.Framework.Capabilities
|
||||||
|
|
||||||
public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data);
|
public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data);
|
||||||
|
|
||||||
public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID,
|
public delegate ArrayList TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID,
|
||||||
bool isScriptRunning, byte[] data);
|
bool isScriptRunning, byte[] data);
|
||||||
|
|
||||||
public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
|
public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
|
||||||
|
@ -940,11 +940,13 @@ namespace OpenSim.Framework.Capabilities
|
||||||
/// <param name="primID">Prim containing item to update</param>
|
/// <param name="primID">Prim containing item to update</param>
|
||||||
/// <param name="isScriptRunning">Signals whether the script to update is currently running</param>
|
/// <param name="isScriptRunning">Signals whether the script to update is currently running</param>
|
||||||
/// <param name="data">New asset data</param>
|
/// <param name="data">New asset data</param>
|
||||||
public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data)
|
public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors)
|
||||||
{
|
{
|
||||||
if (TaskScriptUpdatedCall != null)
|
if (TaskScriptUpdatedCall != null)
|
||||||
{
|
{
|
||||||
TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data);
|
ArrayList e = TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data);
|
||||||
|
foreach (Object item in e)
|
||||||
|
errors.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1174,17 +1176,20 @@ namespace OpenSim.Framework.Capabilities
|
||||||
// data, path, param));
|
// data, path, param));
|
||||||
|
|
||||||
string res = String.Empty;
|
string res = String.Empty;
|
||||||
LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete();
|
LLSDTaskScriptUploadComplete uploadComplete = new LLSDTaskScriptUploadComplete();
|
||||||
|
|
||||||
|
ArrayList errors = new ArrayList();
|
||||||
handlerUpdateTaskScript = OnUpLoad;
|
handlerUpdateTaskScript = OnUpLoad;
|
||||||
if (handlerUpdateTaskScript != null)
|
if (handlerUpdateTaskScript != null)
|
||||||
{
|
{
|
||||||
handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data);
|
handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data, ref errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadComplete.item_id = inventoryItemID;
|
uploadComplete.new_asset = inventoryItemID;
|
||||||
uploadComplete.task_id = primID;
|
uploadComplete.compiled = errors.Count > 0 ? false : true;
|
||||||
uploadComplete.state = "complete";
|
uploadComplete.state = "complete";
|
||||||
|
uploadComplete.errors = new OSDArray();
|
||||||
|
uploadComplete.errors.Array = errors;
|
||||||
|
|
||||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
@ -71,6 +72,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// Start all the scripts contained in this entity's inventory
|
/// Start all the scripts contained in this entity's inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
|
void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
|
||||||
|
ArrayList GetScriptErrors(UUID itemID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop all the scripts in this entity.
|
/// Stop all the scripts in this entity.
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
|
@ -39,5 +40,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
|
|
||||||
bool PostScriptEvent(UUID itemID, string name, Object[] args);
|
bool PostScriptEvent(UUID itemID, string name, Object[] args);
|
||||||
bool PostObjectEvent(UUID itemID, string name, Object[] args);
|
bool PostObjectEvent(UUID itemID, string name, Object[] args);
|
||||||
|
|
||||||
|
ArrayList GetScriptErrors(UUID itemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
@ -215,13 +216,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="primID">The prim which contains the item to update</param>
|
/// <param name="primID">The prim which contains the item to update</param>
|
||||||
/// <param name="isScriptRunning">Indicates whether the script to update is currently running</param>
|
/// <param name="isScriptRunning">Indicates whether the script to update is currently running</param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId,
|
public ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId,
|
||||||
UUID primId, bool isScriptRunning, byte[] data)
|
UUID primId, bool isScriptRunning, byte[] data)
|
||||||
{
|
{
|
||||||
if (!Permissions.CanEditScript(itemId, primId, remoteClient.AgentId))
|
if (!Permissions.CanEditScript(itemId, primId, remoteClient.AgentId))
|
||||||
{
|
{
|
||||||
remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false);
|
remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false);
|
||||||
return;
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve group
|
// 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",
|
"Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist",
|
||||||
itemId, primId);
|
itemId, primId);
|
||||||
|
|
||||||
return;
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve item
|
// Retrieve item
|
||||||
|
@ -247,7 +248,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
+ " but the item does not exist in this inventory",
|
+ " but the item does not exist in this inventory",
|
||||||
itemId, part.Name, part.UUID);
|
itemId, part.Name, part.UUID);
|
||||||
|
|
||||||
return;
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data);
|
AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data);
|
||||||
|
@ -264,29 +265,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.GetProperties(remoteClient);
|
part.GetProperties(remoteClient);
|
||||||
|
|
||||||
// Trigger rerunning of script (use TriggerRezScript event, see RezScript)
|
// Trigger rerunning of script (use TriggerRezScript event, see RezScript)
|
||||||
|
ArrayList errors = new ArrayList();
|
||||||
|
|
||||||
if (isScriptRunning)
|
if (isScriptRunning)
|
||||||
{
|
{
|
||||||
// Needs to determine which engine was running it and use that
|
// Needs to determine which engine was running it and use that
|
||||||
//
|
//
|
||||||
part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0);
|
part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0);
|
||||||
|
errors = part.Inventory.GetScriptErrors(item.ItemID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
remoteClient.SendAgentAlertMessage("Script saved", false);
|
remoteClient.SendAgentAlertMessage("Script saved", false);
|
||||||
}
|
}
|
||||||
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, UUID, UUID, bool, byte[])</see>
|
/// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, UUID, UUID, bool, byte[])</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId,
|
public ArrayList CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId,
|
||||||
UUID primId, bool isScriptRunning, byte[] data)
|
UUID primId, bool isScriptRunning, byte[] data)
|
||||||
{
|
{
|
||||||
ScenePresence avatar;
|
ScenePresence avatar;
|
||||||
|
|
||||||
if (TryGetAvatar(avatarId, out avatar))
|
if (TryGetAvatar(avatarId, out avatar))
|
||||||
{
|
{
|
||||||
CapsUpdateTaskInventoryScriptAsset(
|
return CapsUpdateTaskInventoryScriptAsset(
|
||||||
avatar.ControllingClient, itemId, primId, isScriptRunning, data);
|
avatar.ControllingClient, itemId, primId, isScriptRunning, data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -295,6 +300,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
"[PRIM INVENTORY]: " +
|
"[PRIM INVENTORY]: " +
|
||||||
"Avatar {0} cannot be found to update its prim item asset",
|
"Avatar {0} cannot be found to update its prim item asset",
|
||||||
avatarId);
|
avatarId);
|
||||||
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
@ -210,6 +211,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList GetScriptErrors(UUID itemID)
|
||||||
|
{
|
||||||
|
ArrayList ret = new ArrayList();
|
||||||
|
|
||||||
|
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop all the scripts in this prim.
|
/// Stop all the scripts in this prim.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1552,5 +1552,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList GetScriptErrors(UUID itemID)
|
||||||
|
{
|
||||||
|
return new ArrayList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue