From 76e87181b2cfd7a9dd7a73367fd4fe5c26ccd6ce Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 26 Apr 2010 20:28:37 -0700 Subject: RemoteXInventoryServiceConnector, the plugin region module. Not active in default configs yet. --- .../Handlers/Inventory/XInventoryInConnector.cs | 48 +++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 34f7dcc..7164520 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -144,6 +144,8 @@ namespace OpenSim.Server.Handlers.Asset return HandleGetActiveGestures(request); case "GETASSETPERMISSIONS": return HandleGetAssetPermissions(request); + case "GETSYSTEMFOLDERS": + return HandleGetSystemFolders(request); } m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); } @@ -197,7 +199,7 @@ namespace OpenSim.Server.Handlers.Asset return ms.ToArray(); } - + byte[] HandleCreateUserInventory(Dictionary request) { Dictionary result = new Dictionary(); @@ -540,6 +542,24 @@ namespace OpenSim.Server.Handlers.Asset return encoding.GetBytes(xmlString); } + byte[] HandleGetSystemFolders(Dictionary request) + { + Dictionary result = new Dictionary(); + UUID principal = UUID.Zero; + UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); + + Dictionary sfolders = GetSystemFolders(principal); + + if (sfolders != null) + foreach (KeyValuePair kvp in sfolders) + result[kvp.Key.ToString()] = EncodeFolder(kvp.Value); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + private Dictionary EncodeFolder(InventoryFolderBase f) { Dictionary ret = new Dictionary(); @@ -623,5 +643,31 @@ namespace OpenSim.Server.Handlers.Asset return item; } + + #region Extra + 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; + } + // Put the root folder there, as type Folder + folders[AssetType.Folder] = root; + return folders; + } + } + m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID); + return new Dictionary(); + } + #endregion + } } -- cgit v1.1