diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index 13b7123a64..ccd4da6424 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs @@ -445,8 +445,7 @@ namespace OpenSim.Groups UUID itemID = binBucketMap["item_id"].AsUUID(); UUID ownerID = binBucketMap["owner_id"].AsUUID(); - item = new InventoryItemBase(itemID, ownerID); - item = m_sceneList[0].InventoryService.GetItem(item); + item = m_sceneList[0].InventoryService.GetItem(ownerID, itemID); } else m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType()); diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index bae15820dd..1a7c698eb1 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -2836,8 +2836,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController if (wearable[0].ItemID != UUID.Zero) { // Get inventory item and copy it - InventoryItemBase item = new InventoryItemBase(wearable[0].ItemID, source); - item = inventoryService.GetItem(item); + InventoryItemBase item = inventoryService.GetItem(source, wearable[0].ItemID); if (item != null) { @@ -2890,8 +2889,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController if (itemID != UUID.Zero) { // Get inventory item and copy it - InventoryItemBase item = new InventoryItemBase(itemID, source); - item = inventoryService.GetItem(item); + InventoryItemBase item = inventoryService.GetItem(source, itemID); if (item != null) { diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs index 4da6c3df9b..e3a9a2213b 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs @@ -403,10 +403,7 @@ namespace OpenSim.Capabilities.Handlers return contents; } contents = fetchedContents; - InventoryFolderBase containingFolder = new InventoryFolderBase(); - containingFolder.ID = folderID; - containingFolder.Owner = agentID; - containingFolder = m_InventoryService.GetFolder(containingFolder); + InventoryFolderBase containingFolder = m_InventoryService.GetFolder(agentID, folderID); if (containingFolder != null) { @@ -429,7 +426,7 @@ namespace OpenSim.Capabilities.Handlers { if (item.AssetType == (int)AssetType.Link) { - InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID)); + InventoryItemBase linkedItem = m_InventoryService.GetItem(agentID, item.AssetID); // Take care of genuinely broken links where the target doesn't exist // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, @@ -659,10 +656,7 @@ from docs seems this was never a spec // Must fetch it individually else if (contents.FolderID == UUID.Zero) { - InventoryFolderBase containingFolder = new InventoryFolderBase(); - containingFolder.ID = freq.folder_id; - containingFolder.Owner = freq.owner_id; - containingFolder = m_InventoryService.GetFolder(containingFolder); + InventoryFolderBase containingFolder = m_InventoryService.GetFolder(freq.owner_id, freq.folder_id); if (containingFolder != null) { @@ -759,12 +753,9 @@ from docs seems this was never a spec m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); linked = new InventoryItemBase[itemIDs.Count]; int i = 0; - InventoryItemBase item = new InventoryItemBase(); - item.Owner = freq.owner_id; foreach (UUID id in itemIDs) { - item.ID = id; - linked[i++] = m_InventoryService.GetItem(item); + linked[i++] = m_InventoryService.GetItem(freq.owner_id, id); } } @@ -850,4 +841,4 @@ from docs seems this was never a spec public InventoryCollection Collection; public int Descendents; } -} \ No newline at end of file +} diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs index 1753f60411..8200a96caf 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs @@ -81,24 +81,15 @@ namespace OpenSim.Capabilities.Handlers // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); items = new InventoryItemBase[itemsRequested.Count]; - InventoryItemBase item = new InventoryItemBase(); - item.Owner = m_agentID; foreach (UUID id in itemIDs) - { - item.ID = id; - items[i++] = m_inventoryService.GetItem(item); - } + items[i++] = m_inventoryService.GetItem(m_agentID, id); } } else { items = new InventoryItemBase[itemsRequested.Count]; - InventoryItemBase item = new InventoryItemBase(); foreach (UUID id in itemIDs) - { - item.ID = id; - items[i++] = m_inventoryService.GetItem(item); - } + items[i++] = m_inventoryService.GetItem(UUID.Zero, id); } foreach (InventoryItemBase item in items) @@ -152,4 +143,4 @@ namespace OpenSim.Capabilities.Handlers return llsdItem; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 39ba708a8a..19619c1e1a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1386,7 +1386,7 @@ namespace OpenSim.Region.ClientStack.Linden IClientAPI client = null; m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); - item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); + item = m_Scene.InventoryService.GetItem(m_HostCapsObj.AgentID, itemID); if (item != null) { string message; diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 0cc630f608..8f03a0ac7a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -898,8 +898,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState); - InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID); - item = m_scene.InventoryService.GetItem(item); + InventoryItemBase item = m_scene.InventoryService.GetItem(sp.UUID, grp.FromItemID); if (item != null) { @@ -1223,8 +1222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return; } - InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); - item = m_scene.InventoryService.GetItem(item); + InventoryItemBase item = m_scene.InventoryService.GetItem(sp.UUID, itemID); if (item == null) return; diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 10b2ff6ed9..a83342c902 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // sp.Appearance.GetAttachpoint(attSo.FromItemID), // Is.EqualTo((int)AttachmentPoint.Chest)); - InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); + InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID); Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem.Name, Is.EqualTo(attName)); @@ -266,7 +266,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // sp.Appearance.GetAttachpoint(attSo.FromItemID), // Is.EqualTo((int)AttachmentPoint.LeftHand)); - InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); + InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID); Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem.Name, Is.EqualTo(so.Name)); @@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // sp.Appearance.GetAttachpoint(attSo.FromItemID), // Is.EqualTo((int)AttachmentPoint.LeftHand)); - InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); + InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID); Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name)); @@ -332,7 +332,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // sp.Appearance.GetAttachpoint(attSo.FromItemID), // Is.EqualTo((int)AttachmentPoint.LeftHand)); - InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); + InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID); Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name)); @@ -600,7 +600,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(0)); // Check item status - Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null); + Assert.That(scene.InventoryService.GetItem(sp.UUID, attItem.ID), Is.Null); // Check object in scene SceneObjectGroup soInScene = scene.GetSceneObjectGroup("att"); @@ -679,7 +679,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, rezzedSo); - InventoryItemBase userItemUpdated = scene.InventoryService.GetItem(userItem); + InventoryItemBase userItemUpdated = scene.InventoryService.GetItem(userItem.Owner, userItem.ID); AssetBase asset = scene.AssetService.Get(userItemUpdated.AssetID.ToString()); // TODO: It would probably be better here to check script state via the saving and retrieval of state diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index c8003831fa..08b276dba0 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -904,8 +904,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory continue; } - InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); - baseItem = invService.GetItem(baseItem); + InventoryItemBase baseItem = invService.GetItem(userID, appearance.Wearables[i][j].ItemID); if (baseItem != null) { diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs index eb23e8386c..e5bf919e8e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs @@ -239,8 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends InventoryFolderBase trashFolder = invService.GetFolderForType(client.AgentId, FolderType.Trash); - InventoryItemBase item = new InventoryItemBase(transactionID, client.AgentId); - item = invService.GetItem(item); + InventoryItemBase item = invService.GetItem(client.AgentId, transactionID); if (item != null && trashFolder != null) { diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs index 095c57b2bc..4efcd3b629 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs @@ -86,8 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId); - item = invService.GetItem(item); + InventoryItemBase item = invService.GetItem(client.AgentId, gestureId); if (item != null) { item.Flags |= 1; @@ -102,8 +101,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId); - item = invService.GetItem(item); + InventoryItemBase item = invService.GetItem(client.AgentId, gestureId); if (item != null) { item.Flags &= ~(uint)1; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 085328c84a..6c2cf0aeef 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -270,8 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer // RLV uses this if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) { - InventoryFolderBase folder = new InventoryFolderBase(inventoryID, client.AgentId); - folder = invService.GetFolder(folder); + InventoryFolderBase folder = invService.GetFolder(client.AgentId, inventoryID); if (folder != null) { @@ -280,8 +279,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer UUID destFolderID = new UUID(im.binaryBucket, 0); if (destFolderID != UUID.Zero) { - InventoryFolderBase destFolder = new InventoryFolderBase(destFolderID, client.AgentId); - destFolder = invService.GetFolder(destFolder); + InventoryFolderBase destFolder = invService.GetFolder(client.AgentId, destFolderID); if (destFolder != null) { if (folder.ParentID != destFolder.ID) @@ -339,8 +337,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip - InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); - item = invService.GetItem(item); + InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID); InventoryFolderBase folder = null; UUID? previousParentFolderID = null; @@ -354,8 +351,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer } else { - folder = new InventoryFolderBase(inventoryID, client.AgentId); - folder = invService.GetFolder(folder); + folder = invService.GetFolder(client.AgentId, inventoryID); if (folder != null) // It's a folder { @@ -368,9 +364,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). if (previousParentFolderID != null) { - InventoryFolderBase previousParentFolder - = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); - previousParentFolder = invService.GetFolder(previousParentFolder); + InventoryFolderBase previousParentFolder = invService.GetFolder(client.AgentId, (UUID)previousParentFolderID); scene.SendInventoryUpdate(client, previousParentFolder, true, true); scene.SendInventoryUpdate(client, destinationFolder, true, true); @@ -392,8 +386,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip - InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); - item = invService.GetItem(item); + InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID); InventoryFolderBase folder = null; UUID? previousParentFolderID = null; @@ -410,8 +403,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer } else { - folder = new InventoryFolderBase(inventoryID, client.AgentId); - folder = invService.GetFolder(folder); + folder = invService.GetFolder(client.AgentId, inventoryID); if (folder != null & trashFolder != null) { @@ -439,9 +431,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). else if (previousParentFolderID != null) { - InventoryFolderBase previousParentFolder - = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); - previousParentFolder = invService.GetFolder(previousParentFolder); + InventoryFolderBase previousParentFolder = invService.GetFolder(client.AgentId, (UUID)previousParentFolderID); scene.SendInventoryUpdate(client, previousParentFolder, true, true); scene.SendInventoryUpdate(client, trashFolder, true, true); @@ -500,10 +490,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { UUID folderID = new UUID(im.binaryBucket, 1); - InventoryFolderBase given = - new InventoryFolderBase(folderID, recipientID); InventoryFolderBase folder = - scene.InventoryService.GetFolder(given); + scene.InventoryService.GetFolder(recipientID, folderID); if (folder != null) user.ControllingClient.SendBulkUpdateInventory(folder); @@ -512,10 +500,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { UUID itemID = new UUID(im.binaryBucket, 1); - InventoryItemBase given = - new InventoryItemBase(itemID, recipientID); InventoryItemBase item = - scene.InventoryService.GetItem(given); + scene.InventoryService.GetItem(recipientID, itemID); if (item != null) { @@ -538,10 +524,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { UUID folderID = new UUID(im.imSessionID); - InventoryFolderBase given = - new InventoryFolderBase(folderID, recipientID); InventoryFolderBase folder = - scene.InventoryService.GetFolder(given); + scene.InventoryService.GetFolder(recipientID, folderID); if (folder != null) user.ControllingClient.SendBulkUpdateInventory(folder); @@ -550,10 +534,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { UUID itemID = new UUID(im.imSessionID); - InventoryItemBase given = - new InventoryItemBase(itemID, recipientID); InventoryItemBase item = - scene.InventoryService.GetItem(given); + scene.InventoryService.GetItem(recipientID, itemID); if (item != null) { diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index dfc880a9ff..a9aaf124b9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -95,8 +95,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer foreach (AvatarAttachment att in a.GetAttachments()) { - InventoryItemBase item = new InventoryItemBase(att.ItemID, account.PrincipalID); - item = Scene.InventoryService.GetItem(item); + InventoryItemBase item = Scene.InventoryService.GetItem(account.PrincipalID, att.ItemID); if (item != null) a.SetAttachment(att.AttachPoint, att.ItemID, item.AssetID); else diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 06a8f25baf..4119f909c7 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -314,9 +314,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess //if (fromTaskID.Equals(UUID.Zero)) //{ - InventoryItemBase item = new InventoryItemBase(itemID); - item.Owner = remoteClient.AgentId; - item = m_Scene.InventoryService.GetItem(item); + InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID); //if (item == null) //{ // Fetch the item // item = new InventoryItemBase(); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 64233d5be0..781b9ffcbd 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -184,8 +184,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) return; - InventoryFolderBase f = new InventoryFolderBase(folderID, remoteClient.AgentId); - InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(f); + InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(remoteClient.AgentId, folderID); if (folder == null && Enum.IsDefined(typeof(FolderType), (sbyte)invType)) { @@ -260,8 +259,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess /// public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) { - InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); - item = m_Scene.InventoryService.GetItem(item); + InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID); if (item.Owner != remoteClient.AgentId) return UUID.Zero; @@ -719,8 +717,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (DeRezAction.SaveToExistingUserInventoryItem == action) { - item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID); - item = m_Scene.InventoryService.GetItem(item); + item = m_Scene.InventoryService.GetItem(userID, so.RootPart.FromUserInventoryItemID); //item = userInfo.RootFolder.FindItem( // objectGroup.RootPart.FromUserInventoryItemID); @@ -792,9 +789,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { if (so.FromFolderID != UUID.Zero && so.RootPart.OwnerID == remoteClient.AgentId) { - InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); - if (f != null) - folder = m_Scene.InventoryService.GetFolder(f); + folder = m_Scene.InventoryService.GetFolder(userID, so.FromFolderID); if(folder.Type == 14 || folder.Type == 16) { @@ -830,8 +825,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) { // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); - InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); - item = m_Scene.InventoryService.GetItem(item); + InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID); if (item == null) { @@ -1289,8 +1283,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID) { IInventoryService invService = m_Scene.RequestModuleInterface(); - InventoryItemBase item = new InventoryItemBase(itemID, agentID); - item = invService.GetItem(item); + InventoryItemBase item = invService.GetItem(agentID, itemID); if (item != null && item.CreatorData != null && item.CreatorData != string.Empty) UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData); diff --git a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs index e1e1838b2f..21e00b25be 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs @@ -103,13 +103,8 @@ namespace OpenSim.Region.CoreModules.Framework.Library { InventoryItemBase[] itemColl = new InventoryItemBase[itemIDs.Length]; int i = 0; - InventoryItemBase item = new InventoryItemBase(); - item.Owner = principalID; foreach (UUID fid in itemIDs) - { - item.ID = fid; - itemColl[i++] = GetItem(item); - } + itemColl[i++] = GetItem(principalID, fid); return itemColl; } @@ -239,14 +234,14 @@ namespace OpenSim.Region.CoreModules.Framework.Library /// /// /// - public InventoryItemBase GetItem(InventoryItemBase item) { return null; } + public InventoryItemBase GetItem(UUID principalID, UUID itemID) { return null; } /// /// Get a folder, given by its UUID /// /// /// - public InventoryFolderBase GetFolder(InventoryFolderBase folder) { return null; } + public InventoryFolderBase GetFolder(UUID principalID, UUID folderID) { return null; } /// /// Does the given user have an inventory structure? diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 48f228a654..863560b5e2 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -598,21 +598,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return connector.DeleteItems(ownerID, itemIDs); } - public InventoryItemBase GetItem(InventoryItemBase item) + public InventoryItemBase GetItem(UUID principalID, UUID itemID) { - if (item == null) - return null; //m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID); - string invURL = GetInventoryServiceURL(item.Owner); + string invURL = GetInventoryServiceURL(principalID); if (invURL == null) // not there, forward to local inventory connector to resolve lock (m_Lock) - return m_LocalGridInventoryService.GetItem(item); + return m_LocalGridInventoryService.GetItem(principalID, itemID); IInventoryService connector = GetConnector(invURL); - return connector.GetItem(item); + return connector.GetItem(principalID, itemID); } public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs) @@ -632,22 +630,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return connector.GetMultipleItems(userID, itemIDs); } - public InventoryFolderBase GetFolder(InventoryFolderBase folder) + public InventoryFolderBase GetFolder(UUID principalID, UUID folderID) { - if (folder == null) - return null; - //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID); - string invURL = GetInventoryServiceURL(folder.Owner); + string invURL = GetInventoryServiceURL(principalID); if (invURL == null) // not there, forward to local inventory connector to resolve lock (m_Lock) - return m_LocalGridInventoryService.GetFolder(folder); + return m_LocalGridInventoryService.GetFolder(principalID, folderID); IInventoryService connector = GetConnector(invURL); - return connector.GetFolder(folder); + return connector.GetFolder(principalID, folderID); } public bool HasInventoryForUser(UUID userID) @@ -710,4 +705,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return connector; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 20d4e02786..0d36725a5b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -292,13 +292,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_InventoryService.DeleteItems(ownerID, itemIDs); } - public InventoryItemBase GetItem(InventoryItemBase item) + public InventoryItemBase GetItem(UUID principalID, UUID itemID) { // m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); // UUID requestedItemId = item.ID; - item = m_InventoryService.GetItem(item); + InventoryItemBase item = m_InventoryService.GetItem(principalID, itemID); // if (null == item) // m_log.ErrorFormat( @@ -312,9 +312,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_InventoryService.GetMultipleItems(userID, itemIDs); } - public InventoryFolderBase GetFolder(InventoryFolderBase folder) + public InventoryFolderBase GetFolder(UUID principalID, UUID folderID) { - return m_InventoryService.GetFolder(folder); + return m_InventoryService.GetFolder(principalID, folderID); } /// diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 978b9d9932..62b44b1106 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -292,15 +292,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.DeleteItems(ownerID, itemIDs); } - public InventoryItemBase GetItem(InventoryItemBase item) + public InventoryItemBase GetItem(UUID userID, UUID itemID) { //m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID); - if (item == null) - return null; if (m_RemoteConnector == null) m_log.DebugFormat("[XINVENTORY CONNECTOR]: connector stub is null!!!"); - return m_RemoteConnector.GetItem(item); + return m_RemoteConnector.GetItem(userID, itemID); } public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs) @@ -311,13 +309,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.GetMultipleItems(userID, itemIDs); } - public InventoryFolderBase GetFolder(InventoryFolderBase folder) + public InventoryFolderBase GetFolder(UUID userID, UUID folderID) { //m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); - if (folder == null) - return null; - return m_RemoteConnector.GetFolder(folder); + return m_RemoteConnector.GetFolder(userID, folderID); } public bool HasInventoryForUser(UUID userID) @@ -337,4 +333,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index c83454e626..8c1a62867f 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -1100,8 +1100,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (objectID == UUID.Zero) // User inventory { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); - assetRequestItem = invService.GetItem(assetRequestItem); + InventoryItemBase assetRequestItem = invService.GetItem(user, notecard); if (assetRequestItem == null && LibraryRootFolder != null) // Library item { assetRequestItem = LibraryRootFolder.FindItem(notecard); @@ -1625,8 +1624,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (objectID == UUID.Zero) // User inventory { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase assetRequestItem = new InventoryItemBase(script, user); - assetRequestItem = invService.GetItem(assetRequestItem); + InventoryItemBase assetRequestItem = invService.GetItem(user, script); if (assetRequestItem == null && LibraryRootFolder != null) // Library item { assetRequestItem = LibraryRootFolder.FindItem(script); @@ -1722,8 +1720,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (objectID == UUID.Zero) // User inventory { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); - assetRequestItem = invService.GetItem(assetRequestItem); + InventoryItemBase assetRequestItem = invService.GetItem(user, notecard); if (assetRequestItem == null && LibraryRootFolder != null) // Library item { assetRequestItem = LibraryRootFolder.FindItem(notecard); diff --git a/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs b/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs index d9d2e64d87..4362e282ac 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs @@ -143,8 +143,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[ASYNC INVENTORY SENDER]: Handling request from {0} for {1} on queue", fh.Client.Name, fh.ItemID); - InventoryItemBase item = new InventoryItemBase(fh.ItemID, fh.Client.AgentId); - item = m_scene.InventoryService.GetItem(item); + InventoryItemBase item = m_scene.InventoryService.GetItem(fh.Client.AgentId, fh.ItemID); if (item != null) fh.Client.SendInventoryItemDetails(item.Owner, item); @@ -153,4 +152,4 @@ namespace OpenSim.Region.Framework.Scenes } } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 30bc75bfa9..f2df364cf1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -223,8 +223,7 @@ namespace OpenSim.Region.Framework.Scenes if (core.TryGet(out inv)) { - InventoryFolderBase parent = new InventoryFolderBase(f.ParentID, f.Owner); - parent = InventoryService.GetFolder(parent); + InventoryFolderBase parent = InventoryService.GetFolder(f.Owner, f.ParentID); inv.SendRemoveInventoryItems(new UUID[] { item.ID }); inv.SendBulkUpdateInventory(new InventoryFolderBase[0], new InventoryItemBase[] { item }); string message = "The item was placed in folder " + f.Name; @@ -407,8 +406,7 @@ namespace OpenSim.Region.Framework.Scenes // inventory. Rut-Roh. Whatever. Make this secure. Yeah. // // Passing something to another avatar or a an object will already - InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); - item = InventoryService.GetItem(item); + InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID); if (item != null) { @@ -585,8 +583,7 @@ namespace OpenSim.Region.Framework.Scenes return null; } - InventoryItemBase item = new InventoryItemBase(itemId, senderId); - item = InventoryService.GetItem(item); + InventoryItemBase item = InventoryService.GetItem(senderId, itemId); if (item == null) { @@ -807,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) { //// Retrieve the folder from the sender - InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId, senderId)); + InventoryFolderBase folder = InventoryService.GetFolder(senderId, folderId); if (null == folder) { m_log.ErrorFormat( @@ -868,8 +865,7 @@ namespace OpenSim.Region.Framework.Scenes if (item == null) { - item = new InventoryItemBase(oldItemID, remoteClient.AgentId); - item = InventoryService.GetItem(item); + item = InventoryService.GetItem(remoteClient.AgentId, oldItemID); if (item == null) { @@ -953,7 +949,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (InventoryItemBase b in items) { CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); - InventoryItemBase n = InventoryService.GetItem(b); + InventoryItemBase n = InventoryService.GetItem(b.Owner, b.ID); n.Folder = destfolder; moveitems.Add(n); remoteClient.SendInventoryItemCreateUpdate(n, 0); @@ -1605,8 +1601,7 @@ namespace OpenSim.Region.Framework.Scenes InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); // Fetch the folder itself to get its current version - InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId); - containingFolder = InventoryService.GetFolder(containingFolder); + InventoryFolderBase containingFolder = InventoryService.GetFolder(client.AgentId, folder.ID); // m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); @@ -1620,7 +1615,7 @@ namespace OpenSim.Region.Framework.Scenes { if (item.AssetType == (int)AssetType.Link) { - InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID)); + InventoryItemBase linkedItem = InventoryService.GetItem(client.AgentId, item.AssetID); // Take care of genuinely broken links where the target doesn't exist // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, @@ -1680,8 +1675,7 @@ namespace OpenSim.Region.Framework.Scenes UUID copyID = UUID.Random(); if (itemID != UUID.Zero) { - InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); - item = InventoryService.GetItem(item); + InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID); // Try library if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) @@ -1836,8 +1830,7 @@ namespace OpenSim.Region.Framework.Scenes public SceneObjectPart RezScriptFromAgentInventory(UUID agentID, UUID fromItemID, uint localID) { UUID copyID = UUID.Random(); - InventoryItemBase item = new InventoryItemBase(fromItemID, agentID); - item = InventoryService.GetItem(item); + InventoryItemBase item = InventoryService.GetItem(agentID, fromItemID); // Try library // XXX clumsy, possibly should be one call diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 34b9c5fc6c..c49edd16e8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -627,8 +627,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); - InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId); - folder = InventoryService.GetFolder(folder); + InventoryFolderBase folder = InventoryService.GetFolder(remoteClient.AgentId, folderID); if (folder != null) { folder.Name = name; @@ -645,8 +644,7 @@ namespace OpenSim.Region.Framework.Scenes public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) { - InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId); - folder = InventoryService.GetFolder(folder); + InventoryFolderBase folder = InventoryService.GetFolder(remoteClient.AgentId, folderID); if (folder != null) { folder.ParentID = parentID; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 2617723af6..ec34e39b90 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -505,8 +505,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups //variable will be set to null and attachment will //not be included with the group notice. Scene scene = (Scene)remoteClient.Scene; - item = new InventoryItemBase(itemID, ownerID); - item = scene.InventoryService.GetItem(item); + item = scene.InventoryService.GetItem(ownerID, itemID); if (item != null) { diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index b295446c19..0bab5aa826 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs @@ -114,12 +114,12 @@ namespace OpenSim.Server.Handlers.Inventory "POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/QueryItem/", m_InventoryService.GetItem, CheckAuthSession)); + new RestDeserialiseSecureHandler( + "POST", "/QueryItem/", GetItem, CheckAuthSession)); m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/QueryFolder/", m_InventoryService.GetFolder, CheckAuthSession)); + new RestDeserialiseSecureHandler( + "POST", "/QueryFolder/", GetFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseTrustedHandler( @@ -205,6 +205,16 @@ namespace OpenSim.Server.Handlers.Inventory return new Dictionary(); } + public InventoryItemBase GetItem(Guid guid) + { + return m_InventoryService.GetItem(UUID.Zero, new UUID(guid)); + } + + public InventoryFolderBase GetFolder(Guid guid) + { + return m_InventoryService.GetFolder(UUID.Zero, new UUID(guid)); + } + public InventoryCollection GetFolderContent(Guid guid) { return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid)); diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 5c4e7a9be4..96d6451fed 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -566,9 +566,11 @@ namespace OpenSim.Server.Handlers.Inventory Dictionary result = new Dictionary(); UUID id = UUID.Zero; UUID.TryParse(request["ID"].ToString(), out id); + UUID user = UUID.Zero; + if (request.ContainsKey("PRINCIPAL")) + UUID.TryParse(request["PRINCIPAL"].ToString(), out user); - InventoryItemBase item = new InventoryItemBase(id); - item = m_InventoryService.GetItem(item); + InventoryItemBase item = m_InventoryService.GetItem(user, id); if (item != null) result["item"] = EncodeItem(item); @@ -617,9 +619,11 @@ namespace OpenSim.Server.Handlers.Inventory Dictionary result = new Dictionary(); UUID id = UUID.Zero; UUID.TryParse(request["ID"].ToString(), out id); + UUID user = UUID.Zero; + if (request.ContainsKey("PRINCIPAL")) + UUID.TryParse(request["PRINCIPAL"].ToString(), out user); - InventoryFolderBase folder = new InventoryFolderBase(id); - folder = m_InventoryService.GetFolder(folder); + InventoryFolderBase folder = m_InventoryService.GetFolder(user, id); if (folder != null) result["folder"] = EncodeFolder(folder); diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index c7d658a2cc..d80e660553 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs @@ -520,10 +520,10 @@ namespace OpenSim.Services.Connectors return CheckReturn(ret); } - public InventoryItemBase GetItem(InventoryItemBase item) + public InventoryItemBase GetItem(UUID principalID, UUID itemID) { InventoryItemBase retrieved = null; - if (m_ItemCache.TryGetValue(item.ID, out retrieved)) + if (m_ItemCache.TryGetValue(itemID, out retrieved)) { return retrieved; } @@ -532,7 +532,8 @@ namespace OpenSim.Services.Connectors { Dictionary ret = MakeRequest("GETITEM", new Dictionary { - { "ID", item.ID.ToString() } + { "ID", itemID.ToString() }, + { "PRINCIPAL", principalID.ToString() } }); if (!CheckReturn(ret)) @@ -545,7 +546,7 @@ namespace OpenSim.Services.Connectors m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e); } - m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); + m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS); return retrieved; } @@ -613,13 +614,14 @@ namespace OpenSim.Services.Connectors return itemArr; } - public InventoryFolderBase GetFolder(InventoryFolderBase folder) + public InventoryFolderBase GetFolder(UUID principalID, UUID folderID) { try { Dictionary ret = MakeRequest("GETFOLDER", new Dictionary { - { "ID", folder.ID.ToString() } + { "ID", folderID.ToString() }, + { "PRINCIPAL", principalID.ToString() } }); if (!CheckReturn(ret)) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index e793420e2e..3d35834917 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -277,17 +277,17 @@ namespace OpenSim.Services.Connectors.SimianGrid /// /// /// - public InventoryItemBase GetItem(InventoryItemBase item) + public InventoryItemBase GetItem(UUID principalID, UUID itemID) { InventoryItemBase retrieved = null; - if (m_ItemCache.TryGetValue(item.ID, out retrieved)) + if (m_ItemCache.TryGetValue(itemID, out retrieved)) return retrieved; NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "GetInventoryNode" }, - { "ItemID", item.ID.ToString() }, - { "OwnerID", item.Owner.ToString() }, + { "ItemID", itemID.ToString() }, + { "OwnerID", principalID.ToString() }, { "IncludeFolders", "1" }, { "IncludeItems", "1" }, { "ChildrenOnly", "1" } @@ -303,17 +303,17 @@ namespace OpenSim.Services.Connectors.SimianGrid // and sanity check just in case for (int i = 0; i < items.Count; i++) { - if (items[i].ID == item.ID) + if (items[i].ID == itemID) { retrieved = items[i]; - m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); + m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS); return retrieved; } } } } - m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found"); + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + itemID + " owned by " + principalID + " not found"); return null; } @@ -321,13 +321,8 @@ namespace OpenSim.Services.Connectors.SimianGrid { InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length]; int i = 0; - InventoryItemBase item = new InventoryItemBase(); - item.Owner = principalID; foreach (UUID id in itemIDs) - { - item.ID = id; - result[i++] = GetItem(item); - } + result[i++] = GetItem(principalID, id); return result; } @@ -337,13 +332,13 @@ namespace OpenSim.Services.Connectors.SimianGrid /// /// /// - public InventoryFolderBase GetFolder(InventoryFolderBase folder) + public InventoryFolderBase GetFolder(UUID principalID, UUID folderID) { NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "GetInventoryNode" }, - { "ItemID", folder.ID.ToString() }, - { "OwnerID", folder.Owner.ToString() }, + { "ItemID", folderID.ToString() }, + { "OwnerID", principalID.ToString() }, { "IncludeFolders", "1" }, { "IncludeItems", "0" }, { "ChildrenOnly", "1" } @@ -353,7 +348,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (response["Success"].AsBoolean() && response["Items"] is OSDArray) { OSDArray items = (OSDArray)response["Items"]; - List folders = GetFoldersFromResponse(items, folder.ID, true); + List folders = GetFoldersFromResponse(items, folderID, true); if (folders.Count > 0) return folders[0]; diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 9158b417a0..a0d25e394a 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs @@ -291,9 +291,9 @@ namespace OpenSim.Services.HypergridService //{ //} - public override InventoryItemBase GetItem(InventoryItemBase item) + public override InventoryItemBase GetItem(UUID principalID, UUID itemID) { - InventoryItemBase it = base.GetItem(item); + InventoryItemBase it = base.GetItem(principalID, itemID); if (it != null) { UserAccount user = m_Cache.GetUser(it.CreatorId); diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 40eb6d4c84..7f14e8ecf3 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -383,7 +383,7 @@ namespace OpenSim.Services.HypergridService // Check the items' current folders foreach (InventoryItemBase item in items) { - InventoryItemBase originalItem = base.GetItem(item); + InventoryItemBase originalItem = base.GetItem(item.Owner, item.ID); if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); @@ -401,7 +401,7 @@ namespace OpenSim.Services.HypergridService public new InventoryItemBase GetItem(InventoryItemBase item) { - InventoryItemBase it = base.GetItem(item); + InventoryItemBase it = base.GetItem(item.Owner, item.ID); if (it == null) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve item {0} ({1}) in folder {2}", @@ -426,9 +426,9 @@ namespace OpenSim.Services.HypergridService return it; } - public new InventoryFolderBase GetFolder(InventoryFolderBase folder) + public new InventoryFolderBase GetFolder(UUID principalID, UUID folderID) { - InventoryFolderBase f = base.GetFolder(folder); + InventoryFolderBase f = base.GetFolder(principalID, folderID); if (f != null) { diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index 4289bbaef7..c0c9ba8c1e 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs @@ -161,7 +161,7 @@ namespace OpenSim.Services.Interfaces /// /// /// null if no item was found, otherwise the found item - InventoryItemBase GetItem(InventoryItemBase item); + InventoryItemBase GetItem(UUID userID, UUID itemID); /// /// Get multiple items, given by their UUIDs @@ -175,7 +175,7 @@ namespace OpenSim.Services.Interfaces /// /// /// - InventoryFolderBase GetFolder(InventoryFolderBase folder); + InventoryFolderBase GetFolder(UUID userID, UUID folderID); /// /// Does the given user have an inventory structure? diff --git a/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs b/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs index 9e3fa695af..3cfd125054 100644 --- a/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs +++ b/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs @@ -90,8 +90,7 @@ namespace OpenSim.Services.InventoryService.Tests Assert.That(xis.AddItem(itemToStore), Is.True); - InventoryItemBase itemRetrieved = new InventoryItemBase(itemId); - itemRetrieved = xis.GetItem(itemRetrieved); + InventoryItemBase itemRetrieved = xis.GetItem(UUID.Zero, itemId); Assert.That(itemRetrieved, Is.Not.Null); Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId)); @@ -139,8 +138,7 @@ namespace OpenSim.Services.InventoryService.Tests Assert.That(xis.UpdateItem(itemToStore), Is.True); - InventoryItemBase itemRetrieved = new InventoryItemBase(itemId); - itemRetrieved = xis.GetItem(itemRetrieved); + InventoryItemBase itemRetrieved = xis.GetItem(UUID.Zero, itemId); Assert.That(itemRetrieved, Is.Not.Null); Assert.That(itemRetrieved.Name, Is.EqualTo(itemName2)); @@ -162,7 +160,7 @@ namespace OpenSim.Services.InventoryService.Tests Assert.That(xis.UpdateItem(itemToStore), Is.True); - itemRetrieved = xis.GetItem(itemRetrieved); + itemRetrieved = xis.GetItem(itemRetrieved.Owner, itemRetrieved.ID); Assert.That(itemRetrieved, Is.Not.Null); Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId)); @@ -174,4 +172,4 @@ namespace OpenSim.Services.InventoryService.Tests Assert.That(itemRetrieved.Name, Is.EqualTo(itemName3)); } } -} \ No newline at end of file +} diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index b75193f625..004c4bf778 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -315,8 +315,7 @@ namespace OpenSim.Services.InventoryService inventory.Items.Add(ConvertToOpenSim(i)); } - InventoryFolderBase f = new InventoryFolderBase(folderID, principalID); - f = GetFolder(f); + InventoryFolderBase f = GetFolder(principalID, folderID); if (f != null) { inventory.Version = f.Version; @@ -359,7 +358,7 @@ namespace OpenSim.Services.InventoryService { // m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID); - InventoryFolderBase check = GetFolder(folder); + InventoryFolderBase check = GetFolder(folder.Owner, folder.ID); if (check != null) return false; @@ -402,7 +401,7 @@ namespace OpenSim.Services.InventoryService // m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID); XInventoryFolder xFolder = ConvertFromOpenSim(folder); - InventoryFolderBase check = GetFolder(folder); + InventoryFolderBase check = GetFolder(folder.Owner, folder.ID); if (check == null) return AddFolder(folder); @@ -512,7 +511,7 @@ namespace OpenSim.Services.InventoryService // m_log.InfoFormat( // "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); - InventoryItemBase retrievedItem = GetItem(item); + InventoryItemBase retrievedItem = GetItem(item.Owner, item.ID); if (retrievedItem == null) { @@ -598,11 +597,11 @@ namespace OpenSim.Services.InventoryService return true; } - public virtual InventoryItemBase GetItem(InventoryItemBase item) + public virtual InventoryItemBase GetItem(UUID principalID, UUID itemID) { XInventoryItem[] items = m_Database.GetItems( new string[] { "inventoryID" }, - new string[] { item.ID.ToString() }); + new string[] { itemID.ToString() }); if (items.Length == 0) return null; @@ -614,22 +613,17 @@ namespace OpenSim.Services.InventoryService { InventoryItemBase[] items = new InventoryItemBase[ids.Length]; int i = 0; - InventoryItemBase item = new InventoryItemBase(); - item.Owner = userID; foreach (UUID id in ids) - { - item.ID = id; - items[i++] = GetItem(item); - } + items[i++] = GetItem(userID, id); return items; } - public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) + public virtual InventoryFolderBase GetFolder(UUID principalID, UUID folderID) { XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "folderID"}, - new string[] { folder.ID.ToString() }); + new string[] { folderID.ToString() }); if (folders.Length == 0) return null; diff --git a/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs index 0280b7377e..d5c7dcb5fd 100644 --- a/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs +++ b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs @@ -159,8 +159,7 @@ namespace Robust.Tests XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address); // Prefetch Notecard 1, will be cached from here on - InventoryItemBase item = new InventoryItemBase(new UUID("10000000-0000-0000-0000-000000000001"), m_userID); - item = m_Connector.GetItem(item); + InventoryItemBase item = m_Connector.GetItem(m_userID, new UUID("10000000-0000-0000-0000-000000000001")); Assert.NotNull(item, "Failed to get Notecard 1"); Assert.AreEqual("Test Notecard 1", item.Name, "Wrong name for Notecard 1");