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