diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | 59 |
2 files changed, 63 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6ae4adc..d10136f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1210,9 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1210 | /// <summary> | 1210 | /// <summary> |
1211 | /// Copy a task (prim) inventory item to another task (prim) | 1211 | /// Copy a task (prim) inventory item to another task (prim) |
1212 | /// </summary> | 1212 | /// </summary> |
1213 | /// <param name="destId"></param> | 1213 | /// <param name="destId">ID of destination part</param> |
1214 | /// <param name="part"></param> | 1214 | /// <param name="part">Source part</param> |
1215 | /// <param name="itemId"></param> | 1215 | /// <param name="itemId">Source item id to transfer</param> |
1216 | public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId) | 1216 | public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId) |
1217 | { | 1217 | { |
1218 | TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId); | 1218 | TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId); |
@@ -1240,10 +1240,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1240 | 1240 | ||
1241 | // Can't transfer this | 1241 | // Can't transfer this |
1242 | // | 1242 | // |
1243 | if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) | 1243 | if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) |
1244 | return; | 1244 | return; |
1245 | 1245 | ||
1246 | if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) | 1246 | if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) |
1247 | { | 1247 | { |
1248 | // object cannot copy items to an object owned by a different owner | 1248 | // object cannot copy items to an object owned by a different owner |
1249 | // unless llAllowInventoryDrop has been called | 1249 | // unless llAllowInventoryDrop has been called |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index ca27b27..e2d0db2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | |||
@@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
75 | /// Test giving inventory from an object to an object where both are owned by the same user. | 75 | /// Test giving inventory from an object to an object where both are owned by the same user. |
76 | /// </summary> | 76 | /// </summary> |
77 | [Test] | 77 | [Test] |
78 | public void TestLlGiveInventorySameOwner() | 78 | public void TestLlGiveInventoryO2OSameOwner() |
79 | { | 79 | { |
80 | TestHelpers.InMethod(); | 80 | TestHelpers.InMethod(); |
81 | // log4net.Config.XmlConfigurator.Configure(); | 81 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -107,5 +107,62 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
107 | Assert.That(copiedItems.Count, Is.EqualTo(1)); | 107 | Assert.That(copiedItems.Count, Is.EqualTo(1)); |
108 | Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName)); | 108 | Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName)); |
109 | } | 109 | } |
110 | |||
111 | /// <summary> | ||
112 | /// Test giving inventory from an object to an object where they have different owners | ||
113 | /// </summary> | ||
114 | [Test] | ||
115 | public void TestLlGiveInventoryO2ODifferentOwners() | ||
116 | { | ||
117 | TestHelpers.InMethod(); | ||
118 | // log4net.Config.XmlConfigurator.Configure(); | ||
119 | |||
120 | UUID user1Id = TestHelpers.ParseTail(0x1); | ||
121 | UUID user2Id = TestHelpers.ParseTail(0x2); | ||
122 | string inventoryItemName = "item1"; | ||
123 | |||
124 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); | ||
125 | m_scene.AddSceneObject(so1); | ||
126 | LSL_Api api = new LSL_Api(); | ||
127 | api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID); | ||
128 | |||
129 | // Create an object embedded inside the first | ||
130 | UUID itemId = TestHelpers.ParseTail(0x20); | ||
131 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); | ||
132 | |||
133 | // Create a second object | ||
134 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); | ||
135 | m_scene.AddSceneObject(so2); | ||
136 | LSL_Api api2 = new LSL_Api(); | ||
137 | api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, so2.RootPart.UUID); | ||
138 | |||
139 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** | ||
140 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); | ||
141 | |||
142 | { | ||
143 | // Item has copy permissions so original should stay intact. | ||
144 | List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems(); | ||
145 | Assert.That(originalItems.Count, Is.EqualTo(1)); | ||
146 | |||
147 | // Should have not copied | ||
148 | List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName); | ||
149 | Assert.That(copiedItems.Count, Is.EqualTo(0)); | ||
150 | } | ||
151 | |||
152 | // *** Secondly, we turn on allow inventory drop in the target and retest. *** | ||
153 | api2.llAllowInventoryDrop(1); | ||
154 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); | ||
155 | |||
156 | { | ||
157 | // Item has copy permissions so original should stay intact. | ||
158 | List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems(); | ||
159 | Assert.That(originalItems.Count, Is.EqualTo(1)); | ||
160 | |||
161 | // Should now have copied. | ||
162 | List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName); | ||
163 | Assert.That(copiedItems.Count, Is.EqualTo(1)); | ||
164 | Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName)); | ||
165 | } | ||
166 | } | ||
110 | } | 167 | } |
111 | } \ No newline at end of file | 168 | } \ No newline at end of file |