make use of CanDoObjectInvToObjectInv
parent
b45f6b933f
commit
74ac2034e0
|
@ -303,6 +303,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;
|
||||
m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory;
|
||||
m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory;
|
||||
m_scene.Permissions.OnDoObjectInvToObjectInv += CanDoObjectInvToObjectInv;
|
||||
|
||||
m_scene.Permissions.OnViewNotecard += CanViewNotecard;
|
||||
m_scene.Permissions.OnViewScript += CanViewScript;
|
||||
|
|
|
@ -1461,29 +1461,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
// Can't transfer this
|
||||
//
|
||||
if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
|
||||
if(!Permissions.CanDoObjectInvToObjectInv(srcTaskItem, part, destPart))
|
||||
return;
|
||||
|
||||
bool overrideNoMod = false;
|
||||
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0)
|
||||
overrideNoMod = true;
|
||||
|
||||
if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
|
||||
{
|
||||
// object cannot copy items to an object owned by a different owner
|
||||
// unless llAllowInventoryDrop has been called
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// must have both move and modify permission to put an item in an object
|
||||
if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TaskInventoryItem destTaskItem = new TaskInventoryItem();
|
||||
|
||||
destTaskItem.ItemID = UUID.Random();
|
||||
|
|
|
@ -86,6 +86,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
|
||||
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 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);
|
||||
|
@ -158,6 +159,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event DelinkObjectHandler OnDelinkObject;
|
||||
public event CreateObjectInventoryHandler OnCreateObjectInventory;
|
||||
public event CopyObjectInventoryHandler OnCopyObjectInventory;
|
||||
public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv;
|
||||
public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
|
||||
public event TransferObjectInventoryHandler OnTransferObjectInventory;
|
||||
public event CreateUserInventoryHandler OnCreateUserInventory;
|
||||
|
@ -1090,6 +1092,23 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart)
|
||||
{
|
||||
DoObjectInvToObjectInv handler = OnDoObjectInvToObjectInv;
|
||||
if (handler != null)
|
||||
{
|
||||
if (sourcePart == null || destPart == null || item == null)
|
||||
return false;
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (DoObjectInvToObjectInv h in list)
|
||||
{
|
||||
if (h(item, sourcePart, destPart) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
|
||||
{
|
||||
DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;
|
||||
|
|
Loading…
Reference in New Issue