From ea8f3c83bf96453e8223d918933d5708fa49a3cc Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 4 Jul 2016 03:35:48 +0100 Subject: Finally remove the requirement for an InventoryItem/FolderBase object to be passed into inventory queries. This makes the API more homogenous and also will more clearly show coding errors related to HG inventory where the .Owner field has a meaning for a query but wasn't always set. --- .../Handlers/FetchInventory/FetchInvDescHandler.cs | 19 +++++-------------- .../Handlers/FetchInventory/FetchInventory2Handler.cs | 15 +++------------ 2 files changed, 8 insertions(+), 26 deletions(-) (limited to 'OpenSim/Capabilities/Handlers') diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs index 4da6c3d..e3a9a22 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 1753f60..8200a96 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 +} -- cgit v1.1