From 22a0dff22624984080bebc03ff63025fc213eeff Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 28 Aug 2009 23:28:32 +0100 Subject: Modify CAPS inventory code. Currently this is not executed --- OpenSim/Framework/Capabilities/Caps.cs | 81 +++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 31 deletions(-) (limited to 'OpenSim/Framework/Capabilities/Caps.cs') diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index df29c4e..5ae33d6 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -57,7 +57,7 @@ namespace OpenSim.Framework.Capabilities public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, bool isScriptRunning, byte[] data); - public delegate List FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, + public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); /// @@ -460,47 +460,52 @@ namespace OpenSim.Framework.Capabilities contents.descendents = 0; reply.folders.Array.Add(contents); - List itemList = null; + InventoryCollection inv = new InventoryCollection(); + inv.Folders = new List(); + inv.Items = new List(); if (CAPSFetchInventoryDescendents != null) { - itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); + inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); } - if (itemList != null) + if (inv.Folders != null) { - foreach (InventoryItemBase invItem in itemList) + foreach (InventoryFolderBase invFolder in inv.Folders) { - contents.items.Array.Add(ConvertInventoryItem(invItem)); + contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); } } - /* The following block is removed as it ALWAYS sends the error to the client because the RC 1.22.9 client tries to - find items that have become dissasociated with a paret folder and have parent of 00000000-0000-00000.... - else - { - IClientAPI client = GetClient(m_agentID); - // We're going to both notify the client of inventory service failure and send back a 'no folder contents' response. - // If we don't send back the response, - // the client becomes unhappy (see Teravus' comment in FetchInventoryRequest()) - if (client != null) - { - client.SendAgentAlertMessage( - "AGIN0001E: The inventory service has either failed or is not responding. Your inventory will not function properly for the rest of this session. Please clear your cache and relog.", - true); - } - else + if (inv.Items != null) + { + foreach (InventoryItemBase invItem in inv.Items) { - m_log.ErrorFormat( - "[AGENT INVENTORY]: Could not lookup controlling client for {0} in order to notify them of the inventory service failure", - m_agentID); + contents.items.Array.Add(ConvertInventoryItem(invItem)); } - }*/ + } contents.descendents = contents.items.Array.Count; return reply; } /// + /// Convert an internal inventory folder object into an LLSD object. + /// + /// + /// + private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder) + { + LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder(); + llsdFolder.folder_id = invFolder.ID; + llsdFolder.parent_id = invFolder.ParentID; + llsdFolder.name = invFolder.Name; + llsdFolder.type = TaskInventoryItem.InvTypes[invFolder.Type]; + llsdFolder.preferred_type = "-1"; + + return llsdFolder; + } + + /// /// Convert an internal inventory item object into an LLSD object. /// /// @@ -529,15 +534,29 @@ namespace OpenSim.Framework.Capabilities llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; - llsdItem.permissions.group_id = UUID.Zero; - llsdItem.permissions.group_mask = 0; - llsdItem.permissions.is_owner_group = false; + llsdItem.permissions.group_id = invItem.GroupID; + llsdItem.permissions.group_mask = (int)invItem.GroupPermissions; + llsdItem.permissions.is_owner_group = invItem.GroupOwned; llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; - llsdItem.permissions.owner_id = m_agentID; // FixMe + llsdItem.permissions.owner_id = m_agentID; llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; llsdItem.sale_info = new LLSDSaleInfo(); - llsdItem.sale_info.sale_price = 10; - llsdItem.sale_info.sale_type = "not"; + llsdItem.sale_info.sale_price = invItem.SalePrice; + switch (invItem.SaleType) + { + default: + llsdItem.sale_info.sale_type = "not"; + break; + case 1: + llsdItem.sale_info.sale_type = "original"; + break; + case 2: + llsdItem.sale_info.sale_type = "copy"; + break; + case 3: + llsdItem.sale_info.sale_type = "contents"; + break; + } return llsdItem; } -- cgit v1.1 From 976cf4284bdbef14553c2e164cb67d25bd2b9076 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 29 Aug 2009 03:26:44 +0100 Subject: Fix up WebFetchInventoryDescendents to really return all data needed, especially the folder version and the subfolders. Fixes inventory search hang and folders not loading. --- OpenSim/Framework/Capabilities/Caps.cs | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'OpenSim/Framework/Capabilities/Caps.cs') diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 5ae33d6..c5560b8 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -58,7 +58,7 @@ namespace OpenSim.Framework.Capabilities bool isScriptRunning, byte[] data); public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, - bool fetchFolders, bool fetchItems, int sortOrder); + bool fetchFolders, bool fetchItems, int sortOrder, out int version); /// /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that @@ -89,7 +89,7 @@ namespace OpenSim.Framework.Capabilities //private static readonly string m_requestTexture = "0003/"; private static readonly string m_notecardUpdatePath = "0004/"; private static readonly string m_notecardTaskUpdatePath = "0005/"; - // private static readonly string m_fetchInventoryPath = "0006/"; + private static readonly string m_fetchInventoryPath = "0006/"; // The following entries are in a module, however, they are also here so that we don't re-assign // the path to another cap by mistake. @@ -207,7 +207,7 @@ namespace OpenSim.Framework.Capabilities // As of RC 1.22.9 of the Linden client this is // supported - // m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); + m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires @@ -449,23 +449,14 @@ namespace OpenSim.Framework.Capabilities contents.owner_id = invFetch.owner_id; contents.folder_id = invFetch.folder_id; - // The version number being sent back was originally 1. - // Unfortunately, on 1.19.1.4, this means that we see a problem where on subsequent logins - // without clearing client cache, objects in the root folder disappear until the cache is cleared, - // at which point they reappear. - // - // Seeing the version to something other than 0 may be the right thing to do, but there is - // a greater subtlety of the second life protocol that needs to be understood first. - contents.version = 0; - - contents.descendents = 0; reply.folders.Array.Add(contents); InventoryCollection inv = new InventoryCollection(); inv.Folders = new List(); inv.Items = new List(); + int version = 0; if (CAPSFetchInventoryDescendents != null) { - inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); + inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version); } if (inv.Folders != null) @@ -484,7 +475,9 @@ namespace OpenSim.Framework.Capabilities } } - contents.descendents = contents.items.Array.Count; + contents.descendents = contents.items.Array.Count + contents.categories.Array.Count; + contents.version = version; + return reply; } @@ -499,7 +492,10 @@ namespace OpenSim.Framework.Capabilities llsdFolder.folder_id = invFolder.ID; llsdFolder.parent_id = invFolder.ParentID; llsdFolder.name = invFolder.Name; - llsdFolder.type = TaskInventoryItem.InvTypes[invFolder.Type]; + if (invFolder.Type == -1) + llsdFolder.type = "-1"; + else + llsdFolder.type = TaskInventoryItem.Types[invFolder.Type]; llsdFolder.preferred_type = "-1"; return llsdFolder; -- cgit v1.1