diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index b62023b..2444367 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -979,25 +979,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
979 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) | 979 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) |
980 | { | 980 | { |
981 | SceneObjectPart part = GetSceneObjectPart(localID); | 981 | SceneObjectPart part = GetSceneObjectPart(localID); |
982 | if (part == null) | 982 | SceneObjectGroup group = null; |
983 | return; | 983 | if (part != null) |
984 | { | ||
985 | group = part.ParentGroup; | ||
986 | } | ||
987 | if (part != null && group != null) | ||
988 | { | ||
989 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | ||
990 | return; | ||
984 | 991 | ||
985 | SceneObjectGroup group = part.ParentGroup; | 992 | TaskInventoryItem item = group.GetInventoryItem(localID, itemID); |
986 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | 993 | if (item == null) |
987 | return; | 994 | return; |
988 | |||
989 | TaskInventoryItem item = group.GetInventoryItem(localID, itemID); | ||
990 | if (item == null) | ||
991 | return; | ||
992 | 995 | ||
993 | if (item.Type == 10) | 996 | InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); |
994 | { | 997 | |
995 | part.RemoveScriptEvents(itemID); | 998 | // Move the item to trash. If this is a copiable item, only |
996 | EventManager.TriggerRemoveScript(localID, itemID); | 999 | // a copy will be moved and we will still need to delete |
1000 | // the item from the prim. If it was no copy, is will be | ||
1001 | // deleted by this method. | ||
1002 | MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID); | ||
1003 | |||
1004 | if (group.GetInventoryItem(localID, itemID) != null) | ||
1005 | { | ||
1006 | if (item.Type == 10) | ||
1007 | { | ||
1008 | part.RemoveScriptEvents(itemID); | ||
1009 | EventManager.TriggerRemoveScript(localID, itemID); | ||
1010 | } | ||
1011 | |||
1012 | group.RemoveInventoryItem(localID, itemID); | ||
1013 | } | ||
1014 | part.SendPropertiesToClient(remoteClient); | ||
997 | } | 1015 | } |
998 | |||
999 | group.RemoveInventoryItem(localID, itemID); | ||
1000 | part.SendPropertiesToClient(remoteClient); | ||
1001 | } | 1016 | } |
1002 | 1017 | ||
1003 | private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) | 1018 | private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) |
@@ -1058,7 +1073,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1058 | if (!Permissions.BypassPermissions()) | 1073 | if (!Permissions.BypassPermissions()) |
1059 | { | 1074 | { |
1060 | if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1075 | if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1076 | { | ||
1077 | if (taskItem.Type == 10) | ||
1078 | { | ||
1079 | part.RemoveScriptEvents(itemId); | ||
1080 | EventManager.TriggerRemoveScript(part.LocalId, itemId); | ||
1081 | } | ||
1082 | |||
1061 | part.Inventory.RemoveInventoryItem(itemId); | 1083 | part.Inventory.RemoveInventoryItem(itemId); |
1084 | } | ||
1062 | } | 1085 | } |
1063 | 1086 | ||
1064 | return agentItem; | 1087 | return agentItem; |