From 614b9e14c42d69bf8048218c889cc047756b0b5a Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Mon, 5 May 2014 16:09:51 +0300
Subject: When moving an item from a prim to a user's inventory, don't delete
the item from the prim until it was successfully copied to the user
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 29 +++++++++++++++++++---
1 file changed, 25 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4988868..91f1b63 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1196,6 +1196,10 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+
+ ///
+ /// Creates (in memory only) a user inventory item that will contain a copy of a task inventory item.
+ ///
private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId, out string message)
{
TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
@@ -1259,11 +1263,24 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.GroupPermissions = taskItem.GroupPermissions;
}
+ message = null;
+ return agentItem;
+ }
+
+ ///
+ /// If the task item is not-copyable then remove it from the prim.
+ ///
+ private void RemoveNonCopyTaskItemFromPrim(SceneObjectPart part, UUID itemId)
+ {
+ TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
+ if (taskItem == null)
+ return;
+
if (!Permissions.BypassPermissions())
{
if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
{
- if (taskItem.Type == 10)
+ if (taskItem.Type == (int)AssetType.LSLText)
{
part.RemoveScriptEvents(itemId);
EventManager.TriggerRemoveScript(part.LocalId, itemId);
@@ -1272,9 +1289,6 @@ namespace OpenSim.Region.Framework.Scenes
part.Inventory.RemoveInventoryItem(itemId);
}
}
-
- message = null;
- return agentItem;
}
///
@@ -1296,6 +1310,9 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.Folder = folderId;
AddInventoryItem(remoteClient, agentItem);
+
+ RemoveNonCopyTaskItemFromPrim(part, itemId);
+
message = null;
return agentItem;
}
@@ -1384,6 +1401,8 @@ namespace OpenSim.Region.Framework.Scenes
AddInventoryItem(agentItem);
+ RemoveNonCopyTaskItemFromPrim(part, itemId);
+
return agentItem;
}
}
@@ -1511,6 +1530,8 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.Folder = newFolderID;
AddInventoryItem(agentItem);
+
+ RemoveNonCopyTaskItemFromPrim(host, itemID);
}
else
{
--
cgit v1.1