diff options
Diffstat (limited to 'OpenSim/Server')
-rw-r--r-- | OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 3354b84..8d104ac 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs | |||
@@ -85,6 +85,14 @@ namespace OpenSim.Server.Handlers.Inventory | |||
85 | "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); | 85 | "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); |
86 | 86 | ||
87 | m_httpServer.AddStreamHandler( | 87 | m_httpServer.AddStreamHandler( |
88 | new RestDeserialiseSecureHandler<Guid, List<InventoryFolderBase>>( | ||
89 | "POST", "/SystemFolders/", GetSystemFolders, CheckAuthSession)); | ||
90 | |||
91 | m_httpServer.AddStreamHandler( | ||
92 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( | ||
93 | "POST", "/GetFolderContent/", GetFolderContent, CheckAuthSession)); | ||
94 | |||
95 | m_httpServer.AddStreamHandler( | ||
88 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 96 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
89 | "POST", "/UpdateFolder/", m_InventoryService.UpdateFolder, CheckAuthSession)); | 97 | "POST", "/UpdateFolder/", m_InventoryService.UpdateFolder, CheckAuthSession)); |
90 | 98 | ||
@@ -155,6 +163,40 @@ namespace OpenSim.Server.Handlers.Inventory | |||
155 | return m_InventoryService.GetUserInventory(userID); | 163 | return m_InventoryService.GetUserInventory(userID); |
156 | } | 164 | } |
157 | 165 | ||
166 | public List<InventoryFolderBase> GetSystemFolders(Guid guid) | ||
167 | { | ||
168 | UUID userID = new UUID(guid); | ||
169 | return new List<InventoryFolderBase>(GetSystemFolders(userID).Values); | ||
170 | } | ||
171 | |||
172 | // This shouldn't be here, it should be in the inventory service. | ||
173 | // But I don't want to deal with types and dependencies for now. | ||
174 | private Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
175 | { | ||
176 | InventoryFolderBase root = m_InventoryService.GetRootFolder(userID); | ||
177 | if (root != null) | ||
178 | { | ||
179 | InventoryCollection content = m_InventoryService.GetFolderContent(userID, root.ID); | ||
180 | if (content != null) | ||
181 | { | ||
182 | Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
183 | foreach (InventoryFolderBase folder in content.Folders) | ||
184 | { | ||
185 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | ||
186 | folders[(AssetType)folder.Type] = folder; | ||
187 | } | ||
188 | return folders; | ||
189 | } | ||
190 | } | ||
191 | m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID); | ||
192 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
193 | } | ||
194 | |||
195 | public InventoryCollection GetFolderContent(Guid guid) | ||
196 | { | ||
197 | return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid)); | ||
198 | } | ||
199 | |||
158 | public List<InventoryItemBase> GetFolderItems(Guid folderID) | 200 | public List<InventoryItemBase> GetFolderItems(Guid folderID) |
159 | { | 201 | { |
160 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); | 202 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); |