From 02fbe5a740e81280bff16caaf50f5f6326fc9c80 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 25 Jan 2017 19:39:58 +0000 Subject: add and use CanDropInObjectInv --- .../Region/Framework/Scenes/Scene.Permissions.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Scene.Permissions.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 968b298..4630497 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -87,6 +87,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart); + public delegate bool DoDropInObjectInv(InventoryItemBase item, ScenePresence sp, SceneObjectPart destPart); public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); public delegate bool CreateUserInventoryHandler(int invType, UUID userID); @@ -160,6 +161,7 @@ namespace OpenSim.Region.Framework.Scenes public event CreateObjectInventoryHandler OnCreateObjectInventory; public event CopyObjectInventoryHandler OnCopyObjectInventory; public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv; + public event DoDropInObjectInv OnDropInObjectInv; public event DeleteObjectInventoryHandler OnDeleteObjectInventory; public event TransferObjectInventoryHandler OnTransferObjectInventory; public event CreateUserInventoryHandler OnCreateUserInventory; @@ -1109,6 +1111,28 @@ namespace OpenSim.Region.Framework.Scenes return true; } + public bool CanDropInObjectInv(InventoryItemBase item, IClientAPI client, SceneObjectPart destPart) + { + DoDropInObjectInv handler = OnDropInObjectInv; + if (handler != null) + { + if (client == null || client.SceneAgent == null|| destPart == null || item == null) + return false; + + ScenePresence sp = client.SceneAgent as ScenePresence; + if(sp == null || sp.IsDeleted) + return false; + + Delegate[] list = handler.GetInvocationList(); + foreach (DoDropInObjectInv h in list) + { + if (h(item, sp, destPart) == false) + return false; + } + } + return true; + } + public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) { DeleteObjectInventoryHandler handler = OnDeleteObjectInventory; -- cgit v1.1