diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 519 |
1 files changed, 13 insertions, 506 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 62a831e..45806dd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -126,61 +126,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
126 | } | 126 | } |
127 | 127 | ||
128 | /// <summary> | 128 | /// <summary> |
129 | /// Capability originating call to update the asset of an item in an agent's inventory | ||
130 | /// </summary> | ||
131 | /// <param name="remoteClient"></param> | ||
132 | /// <param name="itemID"></param> | ||
133 | /// <param name="data"></param> | ||
134 | /// <returns></returns> | ||
135 | public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) | ||
136 | { | ||
137 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
138 | item = InventoryService.GetItem(item); | ||
139 | |||
140 | if (item != null) | ||
141 | { | ||
142 | if ((InventoryType)item.InvType == InventoryType.Notecard) | ||
143 | { | ||
144 | if (!Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId)) | ||
145 | { | ||
146 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); | ||
147 | return UUID.Zero; | ||
148 | } | ||
149 | |||
150 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | ||
151 | } | ||
152 | else if ((InventoryType)item.InvType == InventoryType.LSL) | ||
153 | { | ||
154 | if (!Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) | ||
155 | { | ||
156 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); | ||
157 | return UUID.Zero; | ||
158 | } | ||
159 | |||
160 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
161 | } | ||
162 | |||
163 | AssetBase asset = | ||
164 | CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); | ||
165 | item.AssetID = asset.FullID; | ||
166 | AssetService.Store(asset); | ||
167 | |||
168 | InventoryService.UpdateItem(item); | ||
169 | |||
170 | // remoteClient.SendInventoryItemCreateUpdate(item); | ||
171 | return (asset.FullID); | ||
172 | } | ||
173 | else | ||
174 | { | ||
175 | m_log.ErrorFormat( | ||
176 | "[AGENT INVENTORY]: Could not find item {0} for caps inventory update", | ||
177 | itemID); | ||
178 | } | ||
179 | |||
180 | return UUID.Zero; | ||
181 | } | ||
182 | |||
183 | /// <summary> | ||
184 | /// <see>CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])</see> | 129 | /// <see>CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])</see> |
185 | /// </summary> | 130 | /// </summary> |
186 | public UUID CapsUpdateInventoryItemAsset(UUID avatarId, UUID itemID, byte[] data) | 131 | public UUID CapsUpdateInventoryItemAsset(UUID avatarId, UUID itemID, byte[] data) |
@@ -189,7 +134,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | 134 | ||
190 | if (TryGetAvatar(avatarId, out avatar)) | 135 | if (TryGetAvatar(avatarId, out avatar)) |
191 | { | 136 | { |
192 | return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); | 137 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); |
138 | if (invAccess != null) | ||
139 | return invAccess.CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); | ||
193 | } | 140 | } |
194 | else | 141 | else |
195 | { | 142 | { |
@@ -472,7 +419,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
472 | itemCopy.SaleType = item.SaleType; | 419 | itemCopy.SaleType = item.SaleType; |
473 | 420 | ||
474 | if (InventoryService.AddItem(itemCopy)) | 421 | if (InventoryService.AddItem(itemCopy)) |
475 | TransferInventoryAssets(itemCopy, senderId, recipient); | 422 | { |
423 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); | ||
424 | if (invAccess != null) | ||
425 | invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); | ||
426 | } | ||
476 | 427 | ||
477 | if (!Permissions.BypassPermissions()) | 428 | if (!Permissions.BypassPermissions()) |
478 | { | 429 | { |
@@ -494,10 +445,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
494 | 445 | ||
495 | } | 446 | } |
496 | 447 | ||
497 | protected virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) | ||
498 | { | ||
499 | } | ||
500 | |||
501 | /// <summary> | 448 | /// <summary> |
502 | /// Give an entire inventory folder from one user to another. The entire contents (including all descendent | 449 | /// Give an entire inventory folder from one user to another. The entire contents (including all descendent |
503 | /// folders) is given. | 450 | /// folders) is given. |
@@ -1605,232 +1552,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1605 | } | 1552 | } |
1606 | } | 1553 | } |
1607 | 1554 | ||
1608 | /// <summary> | ||
1609 | /// Delete a scene object from a scene and place in the given avatar's inventory. | ||
1610 | /// Returns the UUID of the newly created asset. | ||
1611 | /// </summary> | ||
1612 | /// <param name="action"></param> | ||
1613 | /// <param name="folderID"></param> | ||
1614 | /// <param name="objectGroup"></param> | ||
1615 | /// <param name="remoteClient"> </param> | ||
1616 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | ||
1617 | SceneObjectGroup objectGroup, IClientAPI remoteClient) | ||
1618 | { | ||
1619 | UUID assetID = UUID.Zero; | ||
1620 | |||
1621 | Vector3 inventoryStoredPosition = new Vector3 | ||
1622 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
1623 | ? 250 | ||
1624 | : objectGroup.AbsolutePosition.X) | ||
1625 | , | ||
1626 | (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
1627 | ? 250 | ||
1628 | : objectGroup.AbsolutePosition.X, | ||
1629 | objectGroup.AbsolutePosition.Z); | ||
1630 | |||
1631 | Vector3 originalPosition = objectGroup.AbsolutePosition; | ||
1632 | |||
1633 | objectGroup.AbsolutePosition = inventoryStoredPosition; | ||
1634 | |||
1635 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); | ||
1636 | |||
1637 | objectGroup.AbsolutePosition = originalPosition; | ||
1638 | |||
1639 | // Get the user info of the item destination | ||
1640 | // | ||
1641 | UUID userID = UUID.Zero; | ||
1642 | |||
1643 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | ||
1644 | action == DeRezAction.SaveToExistingUserInventoryItem) | ||
1645 | { | ||
1646 | // Take or take copy require a taker | ||
1647 | // Saving changes requires a local user | ||
1648 | // | ||
1649 | if (remoteClient == null) | ||
1650 | return UUID.Zero; | ||
1651 | |||
1652 | userID = remoteClient.AgentId; | ||
1653 | } | ||
1654 | else | ||
1655 | { | ||
1656 | // All returns / deletes go to the object owner | ||
1657 | // | ||
1658 | |||
1659 | userID = objectGroup.RootPart.OwnerID; | ||
1660 | } | ||
1661 | |||
1662 | if (userID == UUID.Zero) // Can't proceed | ||
1663 | { | ||
1664 | return UUID.Zero; | ||
1665 | } | ||
1666 | |||
1667 | // If we're returning someone's item, it goes back to the | ||
1668 | // owner's Lost And Found folder. | ||
1669 | // Delete is treated like return in this case | ||
1670 | // Deleting your own items makes them go to trash | ||
1671 | // | ||
1672 | |||
1673 | InventoryFolderBase folder = null; | ||
1674 | InventoryItemBase item = null; | ||
1675 | |||
1676 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
1677 | { | ||
1678 | item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID); | ||
1679 | item = InventoryService.GetItem(item); | ||
1680 | |||
1681 | //item = userInfo.RootFolder.FindItem( | ||
1682 | // objectGroup.RootPart.FromUserInventoryItemID); | ||
1683 | |||
1684 | if (null == item) | ||
1685 | { | ||
1686 | m_log.DebugFormat( | ||
1687 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
1688 | objectGroup.Name, objectGroup.UUID); | ||
1689 | return UUID.Zero; | ||
1690 | } | ||
1691 | } | ||
1692 | else | ||
1693 | { | ||
1694 | // Folder magic | ||
1695 | // | ||
1696 | if (action == DeRezAction.Delete) | ||
1697 | { | ||
1698 | // Deleting someone else's item | ||
1699 | // | ||
1700 | |||
1701 | |||
1702 | if (remoteClient == null || | ||
1703 | objectGroup.OwnerID != remoteClient.AgentId) | ||
1704 | { | ||
1705 | // Folder skeleton may not be loaded and we | ||
1706 | // have to wait for the inventory to find | ||
1707 | // the destination folder | ||
1708 | // | ||
1709 | folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
1710 | } | ||
1711 | else | ||
1712 | { | ||
1713 | // Assume inventory skeleton was loaded during login | ||
1714 | // and all folders can be found | ||
1715 | // | ||
1716 | folder = InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
1717 | } | ||
1718 | } | ||
1719 | else if (action == DeRezAction.Return) | ||
1720 | { | ||
1721 | |||
1722 | // Dump to lost + found unconditionally | ||
1723 | // | ||
1724 | folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
1725 | } | ||
1726 | |||
1727 | if (folderID == UUID.Zero && folder == null) | ||
1728 | { | ||
1729 | if (action == DeRezAction.Delete) | ||
1730 | { | ||
1731 | // Deletes go to trash by default | ||
1732 | // | ||
1733 | folder = InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
1734 | } | ||
1735 | else | ||
1736 | { | ||
1737 | // Catch all. Use lost & found | ||
1738 | // | ||
1739 | |||
1740 | folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
1741 | } | ||
1742 | } | ||
1743 | |||
1744 | if (folder == null) // None of the above | ||
1745 | { | ||
1746 | //folder = userInfo.RootFolder.FindFolder(folderID); | ||
1747 | folder = new InventoryFolderBase(folderID); | ||
1748 | |||
1749 | if (folder == null) // Nowhere to put it | ||
1750 | { | ||
1751 | return UUID.Zero; | ||
1752 | } | ||
1753 | } | ||
1754 | |||
1755 | item = new InventoryItemBase(); | ||
1756 | item.CreatorId = objectGroup.RootPart.CreatorID.ToString(); | ||
1757 | item.ID = UUID.Random(); | ||
1758 | item.InvType = (int)InventoryType.Object; | ||
1759 | item.Folder = folder.ID; | ||
1760 | item.Owner = userID; | ||
1761 | } | ||
1762 | |||
1763 | AssetBase asset = CreateAsset( | ||
1764 | objectGroup.GetPartName(objectGroup.RootPart.LocalId), | ||
1765 | objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), | ||
1766 | (sbyte)AssetType.Object, | ||
1767 | Utils.StringToBytes(sceneObjectXml)); | ||
1768 | AssetService.Store(asset); | ||
1769 | assetID = asset.FullID; | ||
1770 | |||
1771 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
1772 | { | ||
1773 | item.AssetID = asset.FullID; | ||
1774 | InventoryService.UpdateItem(item); | ||
1775 | } | ||
1776 | else | ||
1777 | { | ||
1778 | item.AssetID = asset.FullID; | ||
1779 | |||
1780 | if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
1781 | { | ||
1782 | uint perms=objectGroup.GetEffectivePermissions(); | ||
1783 | uint nextPerms=(perms & 7) << 13; | ||
1784 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
1785 | perms &= ~(uint)PermissionMask.Copy; | ||
1786 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
1787 | perms &= ~(uint)PermissionMask.Transfer; | ||
1788 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
1789 | perms &= ~(uint)PermissionMask.Modify; | ||
1790 | |||
1791 | item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; | ||
1792 | item.CurrentPermissions = item.BasePermissions; | ||
1793 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1794 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; | ||
1795 | item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; | ||
1796 | item.CurrentPermissions |= 8; // Slam! | ||
1797 | } | ||
1798 | else | ||
1799 | { | ||
1800 | item.BasePermissions = objectGroup.GetEffectivePermissions(); | ||
1801 | item.CurrentPermissions = objectGroup.GetEffectivePermissions(); | ||
1802 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1803 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | ||
1804 | item.GroupPermissions = objectGroup.RootPart.GroupMask; | ||
1805 | |||
1806 | item.CurrentPermissions |= 8; // Slam! | ||
1807 | } | ||
1808 | |||
1809 | // TODO: add the new fields (Flags, Sale info, etc) | ||
1810 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
1811 | item.Description = asset.Description; | ||
1812 | item.Name = asset.Name; | ||
1813 | item.AssetType = asset.Type; | ||
1814 | |||
1815 | InventoryService.AddItem(item); | ||
1816 | |||
1817 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | ||
1818 | { | ||
1819 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
1820 | } | ||
1821 | else | ||
1822 | { | ||
1823 | ScenePresence notifyUser = GetScenePresence(item.Owner); | ||
1824 | if (notifyUser != null) | ||
1825 | { | ||
1826 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
1827 | } | ||
1828 | } | ||
1829 | } | ||
1830 | |||
1831 | return assetID; | ||
1832 | } | ||
1833 | |||
1834 | public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) | 1555 | public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) |
1835 | { | 1556 | { |
1836 | SceneObjectGroup objectGroup = grp; | 1557 | SceneObjectGroup objectGroup = grp; |
@@ -1971,225 +1692,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1971 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 1692 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
1972 | bool RezSelected, bool RemoveItem, UUID fromTaskID) | 1693 | bool RezSelected, bool RemoveItem, UUID fromTaskID) |
1973 | { | 1694 | { |
1974 | RezObject( | 1695 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); |
1975 | remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | 1696 | if (invAccess != null) |
1976 | RezSelected, RemoveItem, fromTaskID, false); | 1697 | invAccess.RezObject( |
1977 | } | 1698 | remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, |
1978 | 1699 | RezSelected, RemoveItem, fromTaskID, false); | |
1979 | /// <summary> | ||
1980 | /// Rez an object into the scene from the user's inventory | ||
1981 | /// </summary> | ||
1982 | /// <param name="remoteClient"></param> | ||
1983 | /// <param name="itemID"></param> | ||
1984 | /// <param name="RayEnd"></param> | ||
1985 | /// <param name="RayStart"></param> | ||
1986 | /// <param name="RayTargetID"></param> | ||
1987 | /// <param name="BypassRayCast"></param> | ||
1988 | /// <param name="RayEndIsIntersection"></param> | ||
1989 | /// <param name="RezSelected"></param> | ||
1990 | /// <param name="RemoveItem"></param> | ||
1991 | /// <param name="fromTaskID"></param> | ||
1992 | /// <param name="attachment"></param> | ||
1993 | /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful.</returns> | ||
1994 | public virtual SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, | ||
1995 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | ||
1996 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | ||
1997 | { | ||
1998 | // Work out position details | ||
1999 | byte bRayEndIsIntersection = (byte)0; | ||
2000 | |||
2001 | if (RayEndIsIntersection) | ||
2002 | { | ||
2003 | bRayEndIsIntersection = (byte)1; | ||
2004 | } | ||
2005 | else | ||
2006 | { | ||
2007 | bRayEndIsIntersection = (byte)0; | ||
2008 | } | ||
2009 | |||
2010 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); | ||
2011 | |||
2012 | |||
2013 | Vector3 pos = GetNewRezLocation( | ||
2014 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | ||
2015 | BypassRayCast, bRayEndIsIntersection,true,scale, false); | ||
2016 | |||
2017 | // Rez object | ||
2018 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
2019 | item = InventoryService.GetItem(item); | ||
2020 | |||
2021 | if (item != null) | ||
2022 | { | ||
2023 | AssetBase rezAsset = AssetService.Get(item.AssetID.ToString()); | ||
2024 | |||
2025 | if (rezAsset != null) | ||
2026 | { | ||
2027 | UUID itemId = UUID.Zero; | ||
2028 | |||
2029 | // If we have permission to copy then link the rezzed object back to the user inventory | ||
2030 | // item that it came from. This allows us to enable 'save object to inventory' | ||
2031 | if (!Permissions.BypassPermissions()) | ||
2032 | { | ||
2033 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) | ||
2034 | { | ||
2035 | itemId = item.ID; | ||
2036 | } | ||
2037 | } | ||
2038 | else | ||
2039 | { | ||
2040 | // Brave new fullperm world | ||
2041 | // | ||
2042 | itemId = item.ID; | ||
2043 | } | ||
2044 | |||
2045 | string xmlData = Utils.BytesToString(rezAsset.Data); | ||
2046 | SceneObjectGroup group | ||
2047 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); | ||
2048 | |||
2049 | if (!Permissions.CanRezObject( | ||
2050 | group.Children.Count, remoteClient.AgentId, pos) | ||
2051 | && !attachment) | ||
2052 | { | ||
2053 | // The client operates in no fail mode. It will | ||
2054 | // have already removed the item from the folder | ||
2055 | // if it's no copy. | ||
2056 | // Put it back if it's not an attachment | ||
2057 | // | ||
2058 | if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment)) | ||
2059 | remoteClient.SendBulkUpdateInventory(item); | ||
2060 | return null; | ||
2061 | } | ||
2062 | |||
2063 | group.ResetIDs(); | ||
2064 | |||
2065 | if (attachment) | ||
2066 | { | ||
2067 | group.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom; | ||
2068 | group.RootPart.IsAttachment = true; | ||
2069 | } | ||
2070 | |||
2071 | AddNewSceneObject(group, true); | ||
2072 | |||
2073 | // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); | ||
2074 | // if attachment we set it's asset id so object updates can reflect that | ||
2075 | // if not, we set it's position in world. | ||
2076 | if (!attachment) | ||
2077 | { | ||
2078 | float offsetHeight = 0; | ||
2079 | pos = GetNewRezLocation( | ||
2080 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | ||
2081 | BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false); | ||
2082 | pos.Z += offsetHeight; | ||
2083 | group.AbsolutePosition = pos; | ||
2084 | // m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight); | ||
2085 | |||
2086 | } | ||
2087 | else | ||
2088 | { | ||
2089 | group.SetFromItemID(itemID); | ||
2090 | } | ||
2091 | |||
2092 | SceneObjectPart rootPart = null; | ||
2093 | try | ||
2094 | { | ||
2095 | rootPart = group.GetChildPart(group.UUID); | ||
2096 | } | ||
2097 | catch (NullReferenceException) | ||
2098 | { | ||
2099 | string isAttachment = ""; | ||
2100 | |||
2101 | if (attachment) | ||
2102 | isAttachment = " Object was an attachment"; | ||
2103 | |||
2104 | m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); | ||
2105 | } | ||
2106 | |||
2107 | // Since renaming the item in the inventory does not affect the name stored | ||
2108 | // in the serialization, transfer the correct name from the inventory to the | ||
2109 | // object itself before we rez. | ||
2110 | rootPart.Name = item.Name; | ||
2111 | rootPart.Description = item.Description; | ||
2112 | |||
2113 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | ||
2114 | |||
2115 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | ||
2116 | if (rootPart.OwnerID != item.Owner) | ||
2117 | { | ||
2118 | //Need to kill the for sale here | ||
2119 | rootPart.ObjectSaleType = 0; | ||
2120 | rootPart.SalePrice = 10; | ||
2121 | |||
2122 | if (Permissions.PropagatePermissions()) | ||
2123 | { | ||
2124 | if ((item.CurrentPermissions & 8) != 0) | ||
2125 | { | ||
2126 | foreach (SceneObjectPart part in partList) | ||
2127 | { | ||
2128 | part.EveryoneMask = item.EveryOnePermissions; | ||
2129 | part.NextOwnerMask = item.NextPermissions; | ||
2130 | part.GroupMask = 0; // DO NOT propagate here | ||
2131 | } | ||
2132 | } | ||
2133 | group.ApplyNextOwnerPermissions(); | ||
2134 | } | ||
2135 | } | ||
2136 | |||
2137 | foreach (SceneObjectPart part in partList) | ||
2138 | { | ||
2139 | if (part.OwnerID != item.Owner) | ||
2140 | { | ||
2141 | part.LastOwnerID = part.OwnerID; | ||
2142 | part.OwnerID = item.Owner; | ||
2143 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
2144 | } | ||
2145 | else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam! | ||
2146 | { | ||
2147 | part.EveryoneMask = item.EveryOnePermissions; | ||
2148 | part.NextOwnerMask = item.NextPermissions; | ||
2149 | |||
2150 | part.GroupMask = 0; // DO NOT propagate here | ||
2151 | } | ||
2152 | } | ||
2153 | |||
2154 | rootPart.TrimPermissions(); | ||
2155 | |||
2156 | if (!attachment) | ||
2157 | { | ||
2158 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
2159 | { | ||
2160 | group.ClearPartAttachmentData(); | ||
2161 | } | ||
2162 | } | ||
2163 | |||
2164 | if (!attachment) | ||
2165 | { | ||
2166 | // Fire on_rez | ||
2167 | group.CreateScriptInstances(0, true, DefaultScriptEngine, 0); | ||
2168 | |||
2169 | rootPart.ScheduleFullUpdate(); | ||
2170 | } | ||
2171 | |||
2172 | if (!Permissions.BypassPermissions()) | ||
2173 | { | ||
2174 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | ||
2175 | { | ||
2176 | // If this is done on attachments, no | ||
2177 | // copy ones will be lost, so avoid it | ||
2178 | // | ||
2179 | if (!attachment) | ||
2180 | { | ||
2181 | List<UUID> uuids = new List<UUID>(); | ||
2182 | uuids.Add(item.ID); | ||
2183 | InventoryService.DeleteItems(item.Owner, uuids); | ||
2184 | } | ||
2185 | } | ||
2186 | } | ||
2187 | |||
2188 | return rootPart.ParentGroup; | ||
2189 | } | ||
2190 | } | ||
2191 | |||
2192 | return null; | ||
2193 | } | 1700 | } |
2194 | 1701 | ||
2195 | /// <summary> | 1702 | /// <summary> |