From 568614af2cee0c9e6cd86dd682c7bc768afe655b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 16 Jan 2017 14:53:42 +0000 Subject: [PATCH] Remove the last instance of the legacy slam but being set New objects now get only the real slam bit. --- OpenSim/Framework/Util.cs | 8 ++++++++ .../Framework/InventoryAccess/InventoryAccessModule.cs | 4 ++-- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 +++++- .../Region/Framework/Scenes/SceneObjectPartInventory.cs | 6 ++---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 2deb1fb01f..0037f4f4ae 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -67,6 +67,14 @@ namespace OpenSim.Framework FoldedModify = 1 << 1, FoldedCopy = 1 << 2, FoldedExport = 1 << 3, + + // DO NOT USE THIS FOR NEW WORK. IT IS DEPRECATED AND + // EXISTS ONLY TO REACT TO EXISTING OBJECTS HAVING IT. + // NEW CODE SHOULD NEVER SET THIS BIT! + // Use InventoryItemFlags.ObjectSlamPerm in the Flags field of + // this legacy slam bit. It comes from prior incomplete + // understanding of the code and the prohibition on + // reading viewer code that used to be in place. Slam = (1 << 4), FoldedMask = 0x0f, diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 6fe7e896ff..b37744d8ae 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -608,7 +608,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // item.BasePermissions = perms & so.RootPart.NextOwnerMask; - uint nextp = so.RootPart.NextOwnerMask | 0x0f; + uint nextp = so.RootPart.NextOwnerMask | (uint)PermissionMask.FoldedMask; item.BasePermissions = perms & nextp; item.CurrentPermissions = item.BasePermissions; item.NextPermissions = perms & so.RootPart.NextOwnerMask; @@ -616,7 +616,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; // apply next owner perms on rez - item.CurrentPermissions |= (uint)PermissionMask.Slam; + item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; } else { diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 0d09cefae2..c1faf21e3a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1258,6 +1258,10 @@ namespace OpenSim.Region.Framework.Scenes agentItem.InvType = taskItem.InvType; agentItem.Flags = taskItem.Flags; + // The code below isn't OK. It doesn't account for flags being changed + // in the object inventory, so it will break when you do it. That + // is the previous behaviour, so no matter at this moment. However, there is a lot + // TODO: Fix this after the inventory fixer exists and has beenr run if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) { agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); @@ -1266,7 +1270,7 @@ namespace OpenSim.Region.Framework.Scenes else agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; - agentItem.CurrentPermissions = agentItem.BasePermissions; + agentItem.BasePermissions = agentItem.CurrentPermissions; agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 02b94ce8b8..bf56de2867 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -943,8 +943,7 @@ namespace OpenSim.Region.Framework.Scenes group.SetGroup(m_part.GroupID, null); - // TODO: Remove magic number badness - if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number + if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) { if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) { @@ -964,8 +963,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectPart part in partList) { - // TODO: Remove magic number badness - if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number + if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) { part.LastOwnerID = part.OwnerID; part.OwnerID = item.OwnerID;