diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 350 |
1 files changed, 264 insertions, 86 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 5c8b097..65c50bf 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -101,12 +101,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
101 | engine.StartProcessing(); | 101 | engine.StartProcessing(); |
102 | } | 102 | } |
103 | 103 | ||
104 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) | 104 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item, uint cost) |
105 | { | 105 | { |
106 | IMoneyModule money = RequestModuleInterface<IMoneyModule>(); | 106 | IMoneyModule money = RequestModuleInterface<IMoneyModule>(); |
107 | if (money != null) | 107 | if (money != null) |
108 | { | 108 | { |
109 | money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); | 109 | money.ApplyUploadCharge(agentID, (int)cost, "Asset upload"); |
110 | } | 110 | } |
111 | 111 | ||
112 | AddInventoryItem(item); | 112 | AddInventoryItem(item); |
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
169 | return false; | 169 | return false; |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | if (InventoryService.AddItem(item)) | 173 | if (InventoryService.AddItem(item)) |
174 | { | 174 | { |
175 | int userlevel = 0; | 175 | int userlevel = 0; |
@@ -324,8 +324,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
324 | 324 | ||
325 | // Update item with new asset | 325 | // Update item with new asset |
326 | item.AssetID = asset.FullID; | 326 | item.AssetID = asset.FullID; |
327 | if (group.UpdateInventoryItem(item)) | 327 | group.UpdateInventoryItem(item); |
328 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
329 | 328 | ||
330 | part.SendPropertiesToClient(remoteClient); | 329 | part.SendPropertiesToClient(remoteClient); |
331 | 330 | ||
@@ -336,12 +335,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
336 | { | 335 | { |
337 | // Needs to determine which engine was running it and use that | 336 | // Needs to determine which engine was running it and use that |
338 | // | 337 | // |
339 | part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); | 338 | errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 1); |
340 | errors = part.Inventory.GetScriptErrors(item.ItemID); | ||
341 | } | ||
342 | else | ||
343 | { | ||
344 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
345 | } | 339 | } |
346 | 340 | ||
347 | // Tell anyone managing scripts that a script has been reloaded/changed | 341 | // Tell anyone managing scripts that a script has been reloaded/changed |
@@ -409,6 +403,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
409 | 403 | ||
410 | if (UUID.Zero == transactionID) | 404 | if (UUID.Zero == transactionID) |
411 | { | 405 | { |
406 | item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); | ||
412 | item.Name = itemUpd.Name; | 407 | item.Name = itemUpd.Name; |
413 | item.Description = itemUpd.Description; | 408 | item.Description = itemUpd.Description; |
414 | 409 | ||
@@ -793,6 +788,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
793 | return; | 788 | return; |
794 | } | 789 | } |
795 | 790 | ||
791 | if (newName == null) newName = item.Name; | ||
792 | |||
796 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 793 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
797 | 794 | ||
798 | if (asset != null) | 795 | if (asset != null) |
@@ -853,6 +850,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
853 | } | 850 | } |
854 | 851 | ||
855 | /// <summary> | 852 | /// <summary> |
853 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
854 | /// </summary> | ||
855 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
856 | { | ||
857 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
858 | foreach (InventoryItemBase b in items) | ||
859 | { | ||
860 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
861 | InventoryItemBase n = InventoryService.GetItem(b); | ||
862 | n.Folder = destfolder; | ||
863 | moveitems.Add(n); | ||
864 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
865 | } | ||
866 | |||
867 | MoveInventoryItem(remoteClient, moveitems); | ||
868 | } | ||
869 | |||
870 | /// <summary> | ||
856 | /// Move an item within the agent's inventory. | 871 | /// Move an item within the agent's inventory. |
857 | /// </summary> | 872 | /// </summary> |
858 | /// <param name="remoteClient"></param> | 873 | /// <param name="remoteClient"></param> |
@@ -887,11 +902,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
887 | public void CreateNewInventoryItem( | 902 | public void CreateNewInventoryItem( |
888 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 903 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
889 | string name, string description, uint flags, uint callbackID, | 904 | string name, string description, uint flags, uint callbackID, |
890 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | 905 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID) |
891 | { | 906 | { |
892 | CreateNewInventoryItem( | 907 | CreateNewInventoryItem( |
893 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, | 908 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, |
894 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); | 909 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate, transationID); |
910 | } | ||
911 | |||
912 | |||
913 | private void CreateNewInventoryItem( | ||
914 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | ||
915 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | ||
916 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | ||
917 | { | ||
918 | CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID, | ||
919 | name, description, flags, callbackID, asset, invType, | ||
920 | baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero); | ||
895 | } | 921 | } |
896 | 922 | ||
897 | /// <summary> | 923 | /// <summary> |
@@ -916,7 +942,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
916 | private void CreateNewInventoryItem( | 942 | private void CreateNewInventoryItem( |
917 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 943 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
918 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 944 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, |
919 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 945 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID) |
920 | { | 946 | { |
921 | InventoryItemBase item = new InventoryItemBase(); | 947 | InventoryItemBase item = new InventoryItemBase(); |
922 | item.Owner = remoteClient.AgentId; | 948 | item.Owner = remoteClient.AgentId; |
@@ -939,7 +965,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
939 | 965 | ||
940 | if (AddInventoryItem(item)) | 966 | if (AddInventoryItem(item)) |
941 | { | 967 | { |
942 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); | 968 | remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); |
943 | } | 969 | } |
944 | else | 970 | else |
945 | { | 971 | { |
@@ -1214,6 +1240,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1214 | { | 1240 | { |
1215 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 1241 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
1216 | 1242 | ||
1243 | // Can't move a null item | ||
1244 | if (itemId == UUID.Zero) | ||
1245 | return; | ||
1246 | |||
1217 | if (null == part) | 1247 | if (null == part) |
1218 | { | 1248 | { |
1219 | m_log.WarnFormat( | 1249 | m_log.WarnFormat( |
@@ -1318,21 +1348,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1318 | return; | 1348 | return; |
1319 | } | 1349 | } |
1320 | 1350 | ||
1321 | if (part.OwnerID != destPart.OwnerID) | 1351 | // Can't transfer this |
1352 | // | ||
1353 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
1354 | return; | ||
1355 | |||
1356 | bool overrideNoMod = false; | ||
1357 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1358 | overrideNoMod = true; | ||
1359 | |||
1360 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1322 | { | 1361 | { |
1323 | // Source must have transfer permissions | 1362 | // object cannot copy items to an object owned by a different owner |
1324 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 1363 | // unless llAllowInventoryDrop has been called |
1325 | return; | ||
1326 | 1364 | ||
1327 | // Object cannot copy items to an object owned by a different owner | 1365 | return; |
1328 | // unless llAllowInventoryDrop has been called on the destination | ||
1329 | if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1330 | return; | ||
1331 | } | 1366 | } |
1332 | 1367 | ||
1333 | // must have both move and modify permission to put an item in an object | 1368 | // must have both move and modify permission to put an item in an object |
1334 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1369 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1370 | { | ||
1335 | return; | 1371 | return; |
1372 | } | ||
1336 | 1373 | ||
1337 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); | 1374 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); |
1338 | 1375 | ||
@@ -1388,6 +1425,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1388 | 1425 | ||
1389 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1426 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1390 | { | 1427 | { |
1428 | SceneObjectPart destPart = GetSceneObjectPart(destID); | ||
1429 | if (destPart != null) // Move into a prim | ||
1430 | { | ||
1431 | foreach(UUID itemID in items) | ||
1432 | MoveTaskInventoryItem(destID, host, itemID); | ||
1433 | return destID; // Prim folder ID == prim ID | ||
1434 | } | ||
1435 | |||
1391 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1436 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1392 | 1437 | ||
1393 | UUID newFolderID = UUID.Random(); | 1438 | UUID newFolderID = UUID.Random(); |
@@ -1570,12 +1615,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1570 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | 1615 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( |
1571 | remoteClient, part, transactionID, currentItem); | 1616 | remoteClient, part, transactionID, currentItem); |
1572 | 1617 | ||
1573 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1618 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1574 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1619 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1575 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1620 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1576 | remoteClient.SendAgentAlertMessage("Script saved", false); | 1621 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1577 | else | 1622 | // else |
1578 | remoteClient.SendAgentAlertMessage("Item saved", false); | 1623 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1579 | } | 1624 | } |
1580 | 1625 | ||
1581 | // Base ALWAYS has move | 1626 | // Base ALWAYS has move |
@@ -1758,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1758 | } | 1803 | } |
1759 | 1804 | ||
1760 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1805 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1761 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1806 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1762 | agentID); | 1807 | agentID); |
1763 | AssetService.Store(asset); | 1808 | AssetService.Store(asset); |
1764 | 1809 | ||
@@ -1925,23 +1970,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1925 | // build a list of eligible objects | 1970 | // build a list of eligible objects |
1926 | List<uint> deleteIDs = new List<uint>(); | 1971 | List<uint> deleteIDs = new List<uint>(); |
1927 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 1972 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
1928 | 1973 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
1929 | // Start with true for both, then remove the flags if objects | ||
1930 | // that we can't derez are part of the selection | ||
1931 | bool permissionToTake = true; | ||
1932 | bool permissionToTakeCopy = true; | ||
1933 | bool permissionToDelete = true; | ||
1934 | 1974 | ||
1935 | foreach (uint localID in localIDs) | 1975 | foreach (uint localID in localIDs) |
1936 | { | 1976 | { |
1977 | // Start with true for both, then remove the flags if objects | ||
1978 | // that we can't derez are part of the selection | ||
1979 | bool permissionToTake = true; | ||
1980 | bool permissionToTakeCopy = true; | ||
1981 | bool permissionToDelete = true; | ||
1982 | |||
1937 | // Invalid id | 1983 | // Invalid id |
1938 | SceneObjectPart part = GetSceneObjectPart(localID); | 1984 | SceneObjectPart part = GetSceneObjectPart(localID); |
1939 | if (part == null) | 1985 | if (part == null) |
1986 | { | ||
1987 | //Client still thinks the object exists, kill it | ||
1988 | deleteIDs.Add(localID); | ||
1940 | continue; | 1989 | continue; |
1990 | } | ||
1941 | 1991 | ||
1942 | // Already deleted by someone else | 1992 | // Already deleted by someone else |
1943 | if (part.ParentGroup.IsDeleted) | 1993 | if (part.ParentGroup.IsDeleted) |
1994 | { | ||
1995 | //Client still thinks the object exists, kill it | ||
1996 | deleteIDs.Add(localID); | ||
1944 | continue; | 1997 | continue; |
1998 | } | ||
1945 | 1999 | ||
1946 | // Can't delete child prims | 2000 | // Can't delete child prims |
1947 | if (part != part.ParentGroup.RootPart) | 2001 | if (part != part.ParentGroup.RootPart) |
@@ -1949,8 +2003,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1949 | 2003 | ||
1950 | SceneObjectGroup grp = part.ParentGroup; | 2004 | SceneObjectGroup grp = part.ParentGroup; |
1951 | 2005 | ||
1952 | deleteIDs.Add(localID); | 2006 | // If child prims have invalid perms, fix them |
1953 | deleteGroups.Add(grp); | 2007 | grp.AdjustChildPrimPermissions(); |
1954 | 2008 | ||
1955 | // If child prims have invalid perms, fix them | 2009 | // If child prims have invalid perms, fix them |
1956 | grp.AdjustChildPrimPermissions(); | 2010 | grp.AdjustChildPrimPermissions(); |
@@ -1971,81 +2025,193 @@ namespace OpenSim.Region.Framework.Scenes | |||
1971 | } | 2025 | } |
1972 | else | 2026 | else |
1973 | { | 2027 | { |
1974 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 2028 | if (action == DeRezAction.TakeCopy) |
2029 | { | ||
2030 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
2031 | permissionToTakeCopy = false; | ||
2032 | } | ||
2033 | else | ||
2034 | { | ||
1975 | permissionToTakeCopy = false; | 2035 | permissionToTakeCopy = false; |
1976 | 2036 | } | |
1977 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 2037 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1978 | permissionToTake = false; | 2038 | permissionToTake = false; |
1979 | 2039 | ||
1980 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 2040 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1981 | permissionToDelete = false; | 2041 | permissionToDelete = false; |
1982 | } | 2042 | } |
1983 | } | ||
1984 | 2043 | ||
1985 | // Handle god perms | 2044 | // Handle god perms |
1986 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 2045 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
1987 | { | 2046 | { |
1988 | permissionToTake = true; | 2047 | permissionToTake = true; |
1989 | permissionToTakeCopy = true; | 2048 | permissionToTakeCopy = true; |
1990 | permissionToDelete = true; | 2049 | permissionToDelete = true; |
1991 | } | 2050 | } |
1992 | 2051 | ||
1993 | // If we're re-saving, we don't even want to delete | 2052 | // If we're re-saving, we don't even want to delete |
1994 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 2053 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
1995 | permissionToDelete = false; | 2054 | permissionToDelete = false; |
1996 | 2055 | ||
1997 | // if we want to take a copy, we also don't want to delete | 2056 | // if we want to take a copy, we also don't want to delete |
1998 | // Note: after this point, the permissionToTakeCopy flag | 2057 | // Note: after this point, the permissionToTakeCopy flag |
1999 | // becomes irrelevant. It already includes the permissionToTake | 2058 | // becomes irrelevant. It already includes the permissionToTake |
2000 | // permission and after excluding no copy items here, we can | 2059 | // permission and after excluding no copy items here, we can |
2001 | // just use that. | 2060 | // just use that. |
2002 | if (action == DeRezAction.TakeCopy) | 2061 | if (action == DeRezAction.TakeCopy) |
2003 | { | 2062 | { |
2004 | // If we don't have permission, stop right here | 2063 | // If we don't have permission, stop right here |
2005 | if (!permissionToTakeCopy) | 2064 | if (!permissionToTakeCopy) |
2006 | return; | 2065 | return; |
2007 | 2066 | ||
2008 | permissionToTake = true; | 2067 | permissionToTake = true; |
2009 | // Don't delete | 2068 | // Don't delete |
2010 | permissionToDelete = false; | 2069 | permissionToDelete = false; |
2011 | } | 2070 | } |
2012 | 2071 | ||
2013 | if (action == DeRezAction.Return) | 2072 | if (action == DeRezAction.Return) |
2014 | { | ||
2015 | if (remoteClient != null) | ||
2016 | { | 2073 | { |
2017 | if (Permissions.CanReturnObjects( | 2074 | if (remoteClient != null) |
2018 | null, | ||
2019 | remoteClient.AgentId, | ||
2020 | deleteGroups)) | ||
2021 | { | 2075 | { |
2022 | permissionToTake = true; | 2076 | if (Permissions.CanReturnObjects( |
2023 | permissionToDelete = true; | 2077 | null, |
2024 | 2078 | remoteClient.AgentId, | |
2025 | foreach (SceneObjectGroup g in deleteGroups) | 2079 | new List<SceneObjectGroup>() {grp})) |
2026 | { | 2080 | { |
2027 | AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 2081 | permissionToTake = true; |
2082 | permissionToDelete = true; | ||
2083 | |||
2084 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
2028 | } | 2085 | } |
2029 | } | 2086 | } |
2087 | else // Auto return passes through here with null agent | ||
2088 | { | ||
2089 | permissionToTake = true; | ||
2090 | permissionToDelete = true; | ||
2091 | } | ||
2030 | } | 2092 | } |
2031 | else // Auto return passes through here with null agent | 2093 | |
2094 | if (permissionToTake && (!permissionToDelete)) | ||
2095 | takeGroups.Add(grp); | ||
2096 | |||
2097 | if (permissionToDelete) | ||
2032 | { | 2098 | { |
2033 | permissionToTake = true; | 2099 | if (permissionToTake) |
2034 | permissionToDelete = true; | 2100 | deleteGroups.Add(grp); |
2101 | deleteIDs.Add(grp.LocalId); | ||
2035 | } | 2102 | } |
2036 | } | 2103 | } |
2037 | 2104 | ||
2038 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) | 2105 | SendKillObject(deleteIDs); |
2106 | |||
2107 | if (deleteGroups.Count > 0) | ||
2039 | { | 2108 | { |
2109 | foreach (SceneObjectGroup g in deleteGroups) | ||
2110 | deleteIDs.Remove(g.LocalId); | ||
2111 | |||
2040 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2112 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2041 | action, destinationID, deleteGroups, remoteClient, | 2113 | action, destinationID, deleteGroups, remoteClient, |
2042 | permissionToDelete); | 2114 | true); |
2115 | } | ||
2116 | if (takeGroups.Count > 0) | ||
2117 | { | ||
2118 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
2119 | action, destinationID, takeGroups, remoteClient, | ||
2120 | false); | ||
2043 | } | 2121 | } |
2044 | else if (permissionToDelete) | 2122 | if (deleteIDs.Count > 0) |
2045 | { | 2123 | { |
2046 | foreach (SceneObjectGroup g in deleteGroups) | 2124 | foreach (SceneObjectGroup g in deleteGroups) |
2047 | DeleteSceneObject(g, false); | 2125 | DeleteSceneObject(g, true); |
2126 | } | ||
2127 | } | ||
2128 | |||
2129 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
2130 | { | ||
2131 | itemID = UUID.Zero; | ||
2132 | if (grp != null) | ||
2133 | { | ||
2134 | Vector3 inventoryStoredPosition = new Vector3 | ||
2135 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2136 | ? 250 | ||
2137 | : grp.AbsolutePosition.X) | ||
2138 | , | ||
2139 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2140 | ? 250 | ||
2141 | : grp.AbsolutePosition.X, | ||
2142 | grp.AbsolutePosition.Z); | ||
2143 | |||
2144 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2145 | |||
2146 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2147 | |||
2148 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2149 | |||
2150 | grp.AbsolutePosition = originalPosition; | ||
2151 | |||
2152 | AssetBase asset = CreateAsset( | ||
2153 | grp.GetPartName(grp.LocalId), | ||
2154 | grp.GetPartDescription(grp.LocalId), | ||
2155 | (sbyte)AssetType.Object, | ||
2156 | Utils.StringToBytes(sceneObjectXml), | ||
2157 | remoteClient.AgentId); | ||
2158 | AssetService.Store(asset); | ||
2159 | |||
2160 | InventoryItemBase item = new InventoryItemBase(); | ||
2161 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2162 | item.CreatorData = grp.RootPart.CreatorData; | ||
2163 | item.Owner = remoteClient.AgentId; | ||
2164 | item.ID = UUID.Random(); | ||
2165 | item.AssetID = asset.FullID; | ||
2166 | item.Description = asset.Description; | ||
2167 | item.Name = asset.Name; | ||
2168 | item.AssetType = asset.Type; | ||
2169 | item.InvType = (int)InventoryType.Object; | ||
2170 | |||
2171 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2172 | if (folder != null) | ||
2173 | item.Folder = folder.ID; | ||
2174 | else // oopsies | ||
2175 | item.Folder = UUID.Zero; | ||
2176 | |||
2177 | // Set up base perms properly | ||
2178 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2179 | permsBase &= grp.RootPart.BaseMask; | ||
2180 | permsBase |= (uint)PermissionMask.Move; | ||
2181 | |||
2182 | // Make sure we don't lock it | ||
2183 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2184 | |||
2185 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2186 | { | ||
2187 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2188 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2189 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2190 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2191 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2192 | } | ||
2193 | else | ||
2194 | { | ||
2195 | item.BasePermissions = permsBase; | ||
2196 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2197 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2198 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2199 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2200 | } | ||
2201 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2202 | |||
2203 | // sets itemID so client can show item as 'attached' in inventory | ||
2204 | grp.FromItemID = item.ID; | ||
2205 | |||
2206 | if (AddInventoryItem(item)) | ||
2207 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2208 | else | ||
2209 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2210 | |||
2211 | itemID = item.ID; | ||
2212 | return item.AssetID; | ||
2048 | } | 2213 | } |
2214 | return UUID.Zero; | ||
2049 | } | 2215 | } |
2050 | 2216 | ||
2051 | /// <summary> | 2217 | /// <summary> |
@@ -2175,6 +2341,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2175 | 2341 | ||
2176 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2342 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2177 | { | 2343 | { |
2344 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2345 | return; | ||
2346 | |||
2178 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2347 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2179 | if (part == null) | 2348 | if (part == null) |
2180 | return; | 2349 | return; |
@@ -2231,7 +2400,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2231 | } | 2400 | } |
2232 | else | 2401 | else |
2233 | { | 2402 | { |
2234 | if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) | 2403 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) |
2404 | continue; | ||
2405 | |||
2406 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | ||
2235 | continue; | 2407 | continue; |
2236 | 2408 | ||
2237 | if (sog.GroupID != groupID) | 2409 | if (sog.GroupID != groupID) |
@@ -2343,6 +2515,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2343 | } | 2515 | } |
2344 | 2516 | ||
2345 | m_sceneGraph.LinkObjects(root, children); | 2517 | m_sceneGraph.LinkObjects(root, children); |
2518 | |||
2519 | ScenePresence sp; | ||
2520 | if (TryGetScenePresence(agentId, out sp)) | ||
2521 | { | ||
2522 | root.SendPropertiesToClient(sp.ControllingClient); | ||
2523 | } | ||
2346 | } | 2524 | } |
2347 | 2525 | ||
2348 | private string PermissionString(uint permissions) | 2526 | private string PermissionString(uint permissions) |