From f8c15d38a614ca7fcfc78a0c2883831ea6cf8137 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 6 Jan 2012 17:43:35 +0000 Subject: If dragging a script that is no copy from prim inventory into agent inventory, stop it first in scene. If deleting from prims, move to trash rather then making it poof. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 55 +++++++++++++++------- 1 file 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 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) { SceneObjectPart part = GetSceneObjectPart(localID); - if (part == null) - return; + SceneObjectGroup group = null; + if (part != null) + { + group = part.ParentGroup; + } + if (part != null && group != null) + { + if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) + return; - SceneObjectGroup group = part.ParentGroup; - if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) - return; - - TaskInventoryItem item = group.GetInventoryItem(localID, itemID); - if (item == null) - return; + TaskInventoryItem item = group.GetInventoryItem(localID, itemID); + if (item == null) + return; - if (item.Type == 10) - { - part.RemoveScriptEvents(itemID); - EventManager.TriggerRemoveScript(localID, itemID); + InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); + + // Move the item to trash. If this is a copiable item, only + // a copy will be moved and we will still need to delete + // the item from the prim. If it was no copy, is will be + // deleted by this method. + MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID); + + if (group.GetInventoryItem(localID, itemID) != null) + { + if (item.Type == 10) + { + part.RemoveScriptEvents(itemID); + EventManager.TriggerRemoveScript(localID, itemID); + } + + group.RemoveInventoryItem(localID, itemID); + } + part.SendPropertiesToClient(remoteClient); } - - group.RemoveInventoryItem(localID, itemID); - part.SendPropertiesToClient(remoteClient); } private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) @@ -1058,7 +1073,15 @@ namespace OpenSim.Region.Framework.Scenes if (!Permissions.BypassPermissions()) { if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + { + if (taskItem.Type == 10) + { + part.RemoveScriptEvents(itemId); + EventManager.TriggerRemoveScript(part.LocalId, itemId); + } + part.Inventory.RemoveInventoryItem(itemId); + } } return agentItem; -- cgit v1.1