From e3dbd0e049e96c30660155584d034d8b550f9063 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 11 Aug 2009 12:30:28 -0700 Subject: Added http handlers for the two new inventory operations. --- .../Inventory/InventoryServerInConnector.cs | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 3354b84..c74c431 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs @@ -85,6 +85,14 @@ namespace OpenSim.Server.Handlers.Inventory "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); m_httpServer.AddStreamHandler( + new RestDeserialiseSecureHandler>( + "GET", "/SystemFolders/", GetSystemFolders, CheckAuthSession)); + + m_httpServer.AddStreamHandler( + new RestDeserialiseSecureHandler( + "POST", "/GetFolderContent/", GetFolderContent, CheckAuthSession)); + + m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler( "POST", "/UpdateFolder/", m_InventoryService.UpdateFolder, CheckAuthSession)); @@ -155,6 +163,40 @@ namespace OpenSim.Server.Handlers.Inventory return m_InventoryService.GetUserInventory(userID); } + public Dictionary GetSystemFolders(Guid guid) + { + UUID userID = new UUID(guid); + return GetSystemFolders(userID); + } + + // This shouldn't be here, it should be in the inventory service. + // But I don't want to deal with types and dependencies for now. + private Dictionary GetSystemFolders(UUID userID) + { + InventoryFolderBase root = m_InventoryService.GetRootFolder(userID); + if (root != null) + { + InventoryCollection content = m_InventoryService.GetFolderContent(userID, root.ID); + if (content != null) + { + Dictionary folders = new Dictionary(); + foreach (InventoryFolderBase folder in content.Folders) + { + if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) + folders[(AssetType)folder.Type] = folder; + } + return folders; + } + } + m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID); + return new Dictionary(); + } + + public InventoryCollection GetFolderContent(Guid guid) + { + return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid)); + } + public List GetFolderItems(Guid folderID) { List allItems = new List(); -- cgit v1.1