diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 368 |
1 files changed, 281 insertions, 87 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9cc5cde..cba75f1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -103,12 +103,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | engine.StartProcessing(); | 103 | engine.StartProcessing(); |
104 | } | 104 | } |
105 | 105 | ||
106 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) | 106 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item, uint cost) |
107 | { | 107 | { |
108 | IMoneyModule money = RequestModuleInterface<IMoneyModule>(); | 108 | IMoneyModule money = RequestModuleInterface<IMoneyModule>(); |
109 | if (money != null) | 109 | if (money != null) |
110 | { | 110 | { |
111 | money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); | 111 | money.ApplyUploadCharge(agentID, (int)cost, "Asset upload"); |
112 | } | 112 | } |
113 | 113 | ||
114 | AddInventoryItem(item); | 114 | AddInventoryItem(item); |
@@ -171,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
171 | return false; | 171 | return false; |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | if (InventoryService.AddItem(item)) | 175 | if (InventoryService.AddItem(item)) |
176 | { | 176 | { |
177 | int userlevel = 0; | 177 | int userlevel = 0; |
@@ -326,8 +326,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
326 | 326 | ||
327 | // Update item with new asset | 327 | // Update item with new asset |
328 | item.AssetID = asset.FullID; | 328 | item.AssetID = asset.FullID; |
329 | if (group.UpdateInventoryItem(item)) | 329 | group.UpdateInventoryItem(item); |
330 | remoteClient.SendAlertMessage("Script saved"); | ||
331 | 330 | ||
332 | part.SendPropertiesToClient(remoteClient); | 331 | part.SendPropertiesToClient(remoteClient); |
333 | 332 | ||
@@ -338,12 +337,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
338 | { | 337 | { |
339 | // Needs to determine which engine was running it and use that | 338 | // Needs to determine which engine was running it and use that |
340 | // | 339 | // |
341 | part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); | 340 | errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 1); |
342 | errors = part.Inventory.GetScriptErrors(item.ItemID); | ||
343 | } | ||
344 | else | ||
345 | { | ||
346 | remoteClient.SendAlertMessage("Script saved"); | ||
347 | } | 341 | } |
348 | 342 | ||
349 | // Tell anyone managing scripts that a script has been reloaded/changed | 343 | // Tell anyone managing scripts that a script has been reloaded/changed |
@@ -409,6 +403,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
409 | if (item.Owner != remoteClient.AgentId) | 403 | if (item.Owner != remoteClient.AgentId) |
410 | return; | 404 | return; |
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 | ||
@@ -853,6 +848,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
853 | return; | 848 | return; |
854 | } | 849 | } |
855 | 850 | ||
851 | if (newName == null) newName = item.Name; | ||
852 | |||
856 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 853 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
857 | 854 | ||
858 | if (asset != null) | 855 | if (asset != null) |
@@ -913,6 +910,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
913 | } | 910 | } |
914 | 911 | ||
915 | /// <summary> | 912 | /// <summary> |
913 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
914 | /// </summary> | ||
915 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
916 | { | ||
917 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
918 | foreach (InventoryItemBase b in items) | ||
919 | { | ||
920 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
921 | InventoryItemBase n = InventoryService.GetItem(b); | ||
922 | n.Folder = destfolder; | ||
923 | moveitems.Add(n); | ||
924 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
925 | } | ||
926 | |||
927 | MoveInventoryItem(remoteClient, moveitems); | ||
928 | } | ||
929 | |||
930 | /// <summary> | ||
916 | /// Move an item within the agent's inventory. | 931 | /// Move an item within the agent's inventory. |
917 | /// </summary> | 932 | /// </summary> |
918 | /// <param name="remoteClient"></param> | 933 | /// <param name="remoteClient"></param> |
@@ -947,11 +962,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
947 | public void CreateNewInventoryItem( | 962 | public void CreateNewInventoryItem( |
948 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 963 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
949 | string name, string description, uint flags, uint callbackID, | 964 | string name, string description, uint flags, uint callbackID, |
950 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | 965 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID) |
951 | { | 966 | { |
952 | CreateNewInventoryItem( | 967 | CreateNewInventoryItem( |
953 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, | 968 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, |
954 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate); | 969 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate, transationID); |
970 | } | ||
971 | |||
972 | |||
973 | private void CreateNewInventoryItem( | ||
974 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | ||
975 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | ||
976 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | ||
977 | { | ||
978 | CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID, | ||
979 | name, description, flags, callbackID, asset, invType, | ||
980 | baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero); | ||
955 | } | 981 | } |
956 | 982 | ||
957 | /// <summary> | 983 | /// <summary> |
@@ -976,7 +1002,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
976 | private void CreateNewInventoryItem( | 1002 | private void CreateNewInventoryItem( |
977 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 1003 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
978 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 1004 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, |
979 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 1005 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID) |
980 | { | 1006 | { |
981 | InventoryItemBase item = new InventoryItemBase(); | 1007 | InventoryItemBase item = new InventoryItemBase(); |
982 | item.Owner = remoteClient.AgentId; | 1008 | item.Owner = remoteClient.AgentId; |
@@ -999,7 +1025,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
999 | 1025 | ||
1000 | if (AddInventoryItem(item)) | 1026 | if (AddInventoryItem(item)) |
1001 | { | 1027 | { |
1002 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); | 1028 | remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); |
1003 | } | 1029 | } |
1004 | else | 1030 | else |
1005 | { | 1031 | { |
@@ -1281,6 +1307,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1281 | { | 1307 | { |
1282 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 1308 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
1283 | 1309 | ||
1310 | // Can't move a null item | ||
1311 | if (itemId == UUID.Zero) | ||
1312 | return; | ||
1313 | |||
1284 | if (null == part) | 1314 | if (null == part) |
1285 | { | 1315 | { |
1286 | m_log.WarnFormat( | 1316 | m_log.WarnFormat( |
@@ -1385,21 +1415,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1385 | return; | 1415 | return; |
1386 | } | 1416 | } |
1387 | 1417 | ||
1388 | if (part.OwnerID != destPart.OwnerID) | 1418 | // Can't transfer this |
1419 | // | ||
1420 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
1421 | return; | ||
1422 | |||
1423 | bool overrideNoMod = false; | ||
1424 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0) | ||
1425 | overrideNoMod = true; | ||
1426 | |||
1427 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1389 | { | 1428 | { |
1390 | // Source must have transfer permissions | 1429 | // object cannot copy items to an object owned by a different owner |
1391 | if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 1430 | // unless llAllowInventoryDrop has been called |
1392 | return; | ||
1393 | 1431 | ||
1394 | // Object cannot copy items to an object owned by a different owner | 1432 | return; |
1395 | // unless llAllowInventoryDrop has been called on the destination | ||
1396 | if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | ||
1397 | return; | ||
1398 | } | 1433 | } |
1399 | 1434 | ||
1400 | // must have both move and modify permission to put an item in an object | 1435 | // must have both move and modify permission to put an item in an object |
1401 | if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) | 1436 | if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod)) |
1437 | { | ||
1402 | return; | 1438 | return; |
1439 | } | ||
1403 | 1440 | ||
1404 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); | 1441 | TaskInventoryItem destTaskItem = new TaskInventoryItem(); |
1405 | 1442 | ||
@@ -1455,6 +1492,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1455 | 1492 | ||
1456 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1493 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1457 | { | 1494 | { |
1495 | SceneObjectPart destPart = GetSceneObjectPart(destID); | ||
1496 | if (destPart != null) // Move into a prim | ||
1497 | { | ||
1498 | foreach(UUID itemID in items) | ||
1499 | MoveTaskInventoryItem(destID, host, itemID); | ||
1500 | return destID; // Prim folder ID == prim ID | ||
1501 | } | ||
1502 | |||
1458 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1503 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1459 | 1504 | ||
1460 | UUID newFolderID = UUID.Random(); | 1505 | UUID newFolderID = UUID.Random(); |
@@ -1637,12 +1682,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1637 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( | 1682 | AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( |
1638 | remoteClient, part, transactionID, currentItem); | 1683 | remoteClient, part, transactionID, currentItem); |
1639 | 1684 | ||
1640 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1685 | // if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1641 | remoteClient.SendAlertMessage("Notecard saved"); | 1686 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1642 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1687 | // else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1643 | remoteClient.SendAlertMessage("Script saved"); | 1688 | // remoteClient.SendAgentAlertMessage("Script saved", false); |
1644 | else | 1689 | // else |
1645 | remoteClient.SendAlertMessage("Item saved"); | 1690 | // remoteClient.SendAgentAlertMessage("Item saved", false); |
1646 | } | 1691 | } |
1647 | 1692 | ||
1648 | // Base ALWAYS has move | 1693 | // Base ALWAYS has move |
@@ -2012,23 +2057,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
2012 | // build a list of eligible objects | 2057 | // build a list of eligible objects |
2013 | List<uint> deleteIDs = new List<uint>(); | 2058 | List<uint> deleteIDs = new List<uint>(); |
2014 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); | 2059 | List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); |
2015 | 2060 | List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); | |
2016 | // Start with true for both, then remove the flags if objects | ||
2017 | // that we can't derez are part of the selection | ||
2018 | bool permissionToTake = true; | ||
2019 | bool permissionToTakeCopy = true; | ||
2020 | bool permissionToDelete = true; | ||
2021 | 2061 | ||
2022 | foreach (uint localID in localIDs) | 2062 | foreach (uint localID in localIDs) |
2023 | { | 2063 | { |
2064 | // Start with true for both, then remove the flags if objects | ||
2065 | // that we can't derez are part of the selection | ||
2066 | bool permissionToTake = true; | ||
2067 | bool permissionToTakeCopy = true; | ||
2068 | bool permissionToDelete = true; | ||
2069 | |||
2024 | // Invalid id | 2070 | // Invalid id |
2025 | SceneObjectPart part = GetSceneObjectPart(localID); | 2071 | SceneObjectPart part = GetSceneObjectPart(localID); |
2026 | if (part == null) | 2072 | if (part == null) |
2073 | { | ||
2074 | //Client still thinks the object exists, kill it | ||
2075 | deleteIDs.Add(localID); | ||
2027 | continue; | 2076 | continue; |
2077 | } | ||
2028 | 2078 | ||
2029 | // Already deleted by someone else | 2079 | // Already deleted by someone else |
2030 | if (part.ParentGroup.IsDeleted) | 2080 | if (part.ParentGroup.IsDeleted) |
2081 | { | ||
2082 | //Client still thinks the object exists, kill it | ||
2083 | deleteIDs.Add(localID); | ||
2031 | continue; | 2084 | continue; |
2085 | } | ||
2032 | 2086 | ||
2033 | // Can't delete child prims | 2087 | // Can't delete child prims |
2034 | if (part != part.ParentGroup.RootPart) | 2088 | if (part != part.ParentGroup.RootPart) |
@@ -2036,8 +2090,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2036 | 2090 | ||
2037 | SceneObjectGroup grp = part.ParentGroup; | 2091 | SceneObjectGroup grp = part.ParentGroup; |
2038 | 2092 | ||
2039 | deleteIDs.Add(localID); | 2093 | // If child prims have invalid perms, fix them |
2040 | deleteGroups.Add(grp); | 2094 | grp.AdjustChildPrimPermissions(); |
2041 | 2095 | ||
2042 | // If child prims have invalid perms, fix them | 2096 | // If child prims have invalid perms, fix them |
2043 | grp.AdjustChildPrimPermissions(); | 2097 | grp.AdjustChildPrimPermissions(); |
@@ -2058,86 +2112,198 @@ namespace OpenSim.Region.Framework.Scenes | |||
2058 | } | 2112 | } |
2059 | else | 2113 | else |
2060 | { | 2114 | { |
2061 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 2115 | if (action == DeRezAction.TakeCopy) |
2116 | { | ||
2117 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
2118 | permissionToTakeCopy = false; | ||
2119 | } | ||
2120 | else | ||
2121 | { | ||
2062 | permissionToTakeCopy = false; | 2122 | permissionToTakeCopy = false; |
2063 | 2123 | } | |
2064 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 2124 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
2065 | permissionToTake = false; | 2125 | permissionToTake = false; |
2066 | 2126 | ||
2067 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 2127 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
2068 | permissionToDelete = false; | 2128 | permissionToDelete = false; |
2069 | } | 2129 | } |
2070 | } | ||
2071 | 2130 | ||
2072 | // Handle god perms | 2131 | // Handle god perms |
2073 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) | 2132 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
2074 | { | ||
2075 | permissionToTake = true; | ||
2076 | permissionToTakeCopy = true; | ||
2077 | permissionToDelete = true; | ||
2078 | } | ||
2079 | |||
2080 | // If we're re-saving, we don't even want to delete | ||
2081 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | ||
2082 | permissionToDelete = false; | ||
2083 | |||
2084 | // if we want to take a copy, we also don't want to delete | ||
2085 | // Note: after this point, the permissionToTakeCopy flag | ||
2086 | // becomes irrelevant. It already includes the permissionToTake | ||
2087 | // permission and after excluding no copy items here, we can | ||
2088 | // just use that. | ||
2089 | if (action == DeRezAction.TakeCopy) | ||
2090 | { | ||
2091 | // If we don't have permission, stop right here | ||
2092 | if (!permissionToTakeCopy) | ||
2093 | { | 2133 | { |
2094 | remoteClient.SendAlertMessage("You don't have permission to take the object"); | 2134 | permissionToTake = true; |
2095 | return; | 2135 | permissionToTakeCopy = true; |
2136 | permissionToDelete = true; | ||
2096 | } | 2137 | } |
2097 | 2138 | ||
2098 | permissionToTake = true; | 2139 | // If we're re-saving, we don't even want to delete |
2099 | // Don't delete | 2140 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
2100 | permissionToDelete = false; | 2141 | permissionToDelete = false; |
2101 | } | ||
2102 | 2142 | ||
2103 | if (action == DeRezAction.Return) | 2143 | // if we want to take a copy, we also don't want to delete |
2104 | { | 2144 | // Note: after this point, the permissionToTakeCopy flag |
2105 | if (remoteClient != null) | 2145 | // becomes irrelevant. It already includes the permissionToTake |
2146 | // permission and after excluding no copy items here, we can | ||
2147 | // just use that. | ||
2148 | if (action == DeRezAction.TakeCopy) | ||
2106 | { | 2149 | { |
2107 | if (Permissions.CanReturnObjects( | 2150 | // If we don't have permission, stop right here |
2108 | null, | 2151 | if (!permissionToTakeCopy) |
2109 | remoteClient.AgentId, | ||
2110 | deleteGroups)) | ||
2111 | { | 2152 | { |
2112 | permissionToTake = true; | 2153 | remoteClient.SendAlertMessage("You don't have permission to take the object"); |
2113 | permissionToDelete = true; | 2154 | return; |
2155 | } | ||
2156 | |||
2157 | permissionToTake = true; | ||
2158 | // Don't delete | ||
2159 | permissionToDelete = false; | ||
2160 | } | ||
2114 | 2161 | ||
2115 | foreach (SceneObjectGroup g in deleteGroups) | 2162 | if (action == DeRezAction.Return) |
2163 | { | ||
2164 | if (remoteClient != null) | ||
2165 | { | ||
2166 | if (Permissions.CanReturnObjects( | ||
2167 | null, | ||
2168 | remoteClient.AgentId, | ||
2169 | new List<SceneObjectGroup>() {grp})) | ||
2116 | { | 2170 | { |
2117 | AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); | 2171 | permissionToTake = true; |
2172 | permissionToDelete = true; | ||
2173 | |||
2174 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | ||
2118 | } | 2175 | } |
2119 | } | 2176 | } |
2177 | else // Auto return passes through here with null agent | ||
2178 | { | ||
2179 | permissionToTake = true; | ||
2180 | permissionToDelete = true; | ||
2181 | } | ||
2120 | } | 2182 | } |
2121 | else // Auto return passes through here with null agent | 2183 | |
2184 | if (permissionToTake && (!permissionToDelete)) | ||
2185 | takeGroups.Add(grp); | ||
2186 | |||
2187 | if (permissionToDelete) | ||
2122 | { | 2188 | { |
2123 | permissionToTake = true; | 2189 | if (permissionToTake) |
2124 | permissionToDelete = true; | 2190 | deleteGroups.Add(grp); |
2191 | deleteIDs.Add(grp.LocalId); | ||
2125 | } | 2192 | } |
2126 | } | 2193 | } |
2127 | 2194 | ||
2128 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) | 2195 | SendKillObject(deleteIDs); |
2196 | |||
2197 | if (deleteGroups.Count > 0) | ||
2129 | { | 2198 | { |
2199 | foreach (SceneObjectGroup g in deleteGroups) | ||
2200 | deleteIDs.Remove(g.LocalId); | ||
2201 | |||
2130 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2202 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2131 | action, destinationID, deleteGroups, remoteClient, | 2203 | action, destinationID, deleteGroups, remoteClient, |
2132 | permissionToDelete); | 2204 | true); |
2133 | } | 2205 | } |
2134 | else if (permissionToDelete) | 2206 | if (takeGroups.Count > 0) |
2207 | { | ||
2208 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
2209 | action, destinationID, takeGroups, remoteClient, | ||
2210 | false); | ||
2211 | } | ||
2212 | if (deleteIDs.Count > 0) | ||
2135 | { | 2213 | { |
2136 | foreach (SceneObjectGroup g in deleteGroups) | 2214 | foreach (SceneObjectGroup g in deleteGroups) |
2137 | DeleteSceneObject(g, false); | 2215 | DeleteSceneObject(g, true); |
2138 | } | 2216 | } |
2139 | } | 2217 | } |
2140 | 2218 | ||
2219 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
2220 | { | ||
2221 | itemID = UUID.Zero; | ||
2222 | if (grp != null) | ||
2223 | { | ||
2224 | Vector3 inventoryStoredPosition = new Vector3 | ||
2225 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2226 | ? 250 | ||
2227 | : grp.AbsolutePosition.X) | ||
2228 | , | ||
2229 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2230 | ? 250 | ||
2231 | : grp.AbsolutePosition.X, | ||
2232 | grp.AbsolutePosition.Z); | ||
2233 | |||
2234 | Vector3 originalPosition = grp.AbsolutePosition; | ||
2235 | |||
2236 | grp.AbsolutePosition = inventoryStoredPosition; | ||
2237 | |||
2238 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
2239 | |||
2240 | grp.AbsolutePosition = originalPosition; | ||
2241 | |||
2242 | AssetBase asset = CreateAsset( | ||
2243 | grp.GetPartName(grp.LocalId), | ||
2244 | grp.GetPartDescription(grp.LocalId), | ||
2245 | (sbyte)AssetType.Object, | ||
2246 | Utils.StringToBytes(sceneObjectXml), | ||
2247 | remoteClient.AgentId); | ||
2248 | AssetService.Store(asset); | ||
2249 | |||
2250 | InventoryItemBase item = new InventoryItemBase(); | ||
2251 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2252 | item.CreatorData = grp.RootPart.CreatorData; | ||
2253 | item.Owner = remoteClient.AgentId; | ||
2254 | item.ID = UUID.Random(); | ||
2255 | item.AssetID = asset.FullID; | ||
2256 | item.Description = asset.Description; | ||
2257 | item.Name = asset.Name; | ||
2258 | item.AssetType = asset.Type; | ||
2259 | item.InvType = (int)InventoryType.Object; | ||
2260 | |||
2261 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
2262 | if (folder != null) | ||
2263 | item.Folder = folder.ID; | ||
2264 | else // oopsies | ||
2265 | item.Folder = UUID.Zero; | ||
2266 | |||
2267 | // Set up base perms properly | ||
2268 | uint permsBase = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify); | ||
2269 | permsBase &= grp.RootPart.BaseMask; | ||
2270 | permsBase |= (uint)PermissionMask.Move; | ||
2271 | |||
2272 | // Make sure we don't lock it | ||
2273 | grp.RootPart.NextOwnerMask |= (uint)PermissionMask.Move; | ||
2274 | |||
2275 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
2276 | { | ||
2277 | item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2278 | item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2279 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2280 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
2281 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
2282 | } | ||
2283 | else | ||
2284 | { | ||
2285 | item.BasePermissions = permsBase; | ||
2286 | item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask; | ||
2287 | item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask; | ||
2288 | item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask; | ||
2289 | item.GroupPermissions = permsBase & grp.RootPart.GroupMask; | ||
2290 | } | ||
2291 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
2292 | |||
2293 | // sets itemID so client can show item as 'attached' in inventory | ||
2294 | grp.FromItemID = item.ID; | ||
2295 | |||
2296 | if (AddInventoryItem(item)) | ||
2297 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2298 | else | ||
2299 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2300 | |||
2301 | itemID = item.ID; | ||
2302 | return item.AssetID; | ||
2303 | } | ||
2304 | return UUID.Zero; | ||
2305 | } | ||
2306 | |||
2141 | /// <summary> | 2307 | /// <summary> |
2142 | /// Returns the list of Scene Objects in an asset. | 2308 | /// Returns the list of Scene Objects in an asset. |
2143 | /// </summary> | 2309 | /// </summary> |
@@ -2166,6 +2332,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2166 | if (e == null || attachment) // Single | 2332 | if (e == null || attachment) // Single |
2167 | { | 2333 | { |
2168 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 2334 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
2335 | |||
2336 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
2337 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
2338 | g.RootPart.AttachRotation = g.GroupRotation; | ||
2339 | if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && | ||
2340 | g.RootPart.Shape.PCode != (byte)PCode.Tree) | ||
2341 | g.RootPart.Shape.State = 0; | ||
2342 | |||
2169 | objlist.Add(g); | 2343 | objlist.Add(g); |
2170 | veclist.Add(new Vector3(0, 0, 0)); | 2344 | veclist.Add(new Vector3(0, 0, 0)); |
2171 | bbox = g.GetAxisAlignedBoundingBox(out offsetHeight); | 2345 | bbox = g.GetAxisAlignedBoundingBox(out offsetHeight); |
@@ -2184,6 +2358,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2184 | foreach (XmlNode n in groups) | 2358 | foreach (XmlNode n in groups) |
2185 | { | 2359 | { |
2186 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); | 2360 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); |
2361 | |||
2362 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
2363 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
2364 | g.RootPart.AttachRotation = g.GroupRotation; | ||
2365 | if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && | ||
2366 | g.RootPart.Shape.PCode != (byte)PCode.Tree) | ||
2367 | g.RootPart.Shape.State = 0; | ||
2368 | |||
2187 | objlist.Add(g); | 2369 | objlist.Add(g); |
2188 | 2370 | ||
2189 | XmlElement el = (XmlElement)n; | 2371 | XmlElement el = (XmlElement)n; |
@@ -2346,6 +2528,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2346 | 2528 | ||
2347 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) | 2529 | public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) |
2348 | { | 2530 | { |
2531 | if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId)) | ||
2532 | return; | ||
2533 | |||
2349 | SceneObjectPart part = GetSceneObjectPart(objectID); | 2534 | SceneObjectPart part = GetSceneObjectPart(objectID); |
2350 | if (part == null) | 2535 | if (part == null) |
2351 | return; | 2536 | return; |
@@ -2402,7 +2587,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2402 | } | 2587 | } |
2403 | else | 2588 | else |
2404 | { | 2589 | { |
2405 | if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) | 2590 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) |
2591 | continue; | ||
2592 | |||
2593 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | ||
2406 | continue; | 2594 | continue; |
2407 | 2595 | ||
2408 | if (sog.GroupID != groupID) | 2596 | if (sog.GroupID != groupID) |
@@ -2514,6 +2702,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2514 | } | 2702 | } |
2515 | 2703 | ||
2516 | m_sceneGraph.LinkObjects(root, children); | 2704 | m_sceneGraph.LinkObjects(root, children); |
2705 | |||
2706 | ScenePresence sp; | ||
2707 | if (TryGetScenePresence(agentId, out sp)) | ||
2708 | { | ||
2709 | root.SendPropertiesToClient(sp.ControllingClient); | ||
2710 | } | ||
2517 | } | 2711 | } |
2518 | 2712 | ||
2519 | private string PermissionString(uint permissions) | 2713 | private string PermissionString(uint permissions) |