From a5b6492223ae0dfeb12d768c12e6347e93225d14 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 14 Aug 2012 13:40:13 +0100 Subject: [PATCH] Perform ownership transfer and permission propagation as well as needed updates on the new temp attachment. --- .../Attachments/TempAttachmentsModule.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs index 7011f38986..27ba5c93ea 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs @@ -120,6 +120,34 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments if (!m_scene.TryGetScenePresence(item.PermsGranter, out target)) return; + if (target.UUID != hostPart.ParentGroup.OwnerID) + { + uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions(); + + if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) + return; + + hostPart.ParentGroup.SetOwnerId(target.UUID); + hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId); + + if (m_scene.Permissions.PropagatePermissions()) + { + foreach (SceneObjectPart child in hostPart.ParentGroup.Parts) + { + child.Inventory.ChangeInventoryOwner(target.UUID); + child.TriggerScriptChangedEvent(Changed.OWNER); + child.ApplyNextOwnerPermissions(); + } + } + + hostPart.ParentGroup.RootPart.ObjectSaleType = 0; + hostPart.ParentGroup.RootPart.SalePrice = 10; + + hostPart.ParentGroup.HasGroupChanged = true; + hostPart.ParentGroup.RootPart.SendPropertiesToClient(target.ControllingClient); + hostPart.ParentGroup.RootPart.ScheduleFullUpdate(); + } + attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true); } }