diff options
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Server')
-rw-r--r-- | OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 48 |
1 files changed, 47 insertions, 1 deletions
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 | |||
144 | return HandleGetActiveGestures(request); | 144 | return HandleGetActiveGestures(request); |
145 | case "GETASSETPERMISSIONS": | 145 | case "GETASSETPERMISSIONS": |
146 | return HandleGetAssetPermissions(request); | 146 | return HandleGetAssetPermissions(request); |
147 | case "GETSYSTEMFOLDERS": | ||
148 | return HandleGetSystemFolders(request); | ||
147 | } | 149 | } |
148 | m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); | 150 | m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); |
149 | } | 151 | } |
@@ -197,7 +199,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
197 | 199 | ||
198 | return ms.ToArray(); | 200 | return ms.ToArray(); |
199 | } | 201 | } |
200 | 202 | ||
201 | byte[] HandleCreateUserInventory(Dictionary<string,object> request) | 203 | byte[] HandleCreateUserInventory(Dictionary<string,object> request) |
202 | { | 204 | { |
203 | Dictionary<string,object> result = new Dictionary<string,object>(); | 205 | Dictionary<string,object> result = new Dictionary<string,object>(); |
@@ -540,6 +542,24 @@ namespace OpenSim.Server.Handlers.Asset | |||
540 | return encoding.GetBytes(xmlString); | 542 | return encoding.GetBytes(xmlString); |
541 | } | 543 | } |
542 | 544 | ||
545 | byte[] HandleGetSystemFolders(Dictionary<string, object> request) | ||
546 | { | ||
547 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
548 | UUID principal = UUID.Zero; | ||
549 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
550 | |||
551 | Dictionary<AssetType, InventoryFolderBase> sfolders = GetSystemFolders(principal); | ||
552 | |||
553 | if (sfolders != null) | ||
554 | foreach (KeyValuePair<AssetType, InventoryFolderBase> kvp in sfolders) | ||
555 | result[kvp.Key.ToString()] = EncodeFolder(kvp.Value); | ||
556 | |||
557 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
558 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
559 | UTF8Encoding encoding = new UTF8Encoding(); | ||
560 | return encoding.GetBytes(xmlString); | ||
561 | } | ||
562 | |||
543 | private Dictionary<string, object> EncodeFolder(InventoryFolderBase f) | 563 | private Dictionary<string, object> EncodeFolder(InventoryFolderBase f) |
544 | { | 564 | { |
545 | Dictionary<string, object> ret = new Dictionary<string, object>(); | 565 | Dictionary<string, object> ret = new Dictionary<string, object>(); |
@@ -623,5 +643,31 @@ namespace OpenSim.Server.Handlers.Asset | |||
623 | 643 | ||
624 | return item; | 644 | return item; |
625 | } | 645 | } |
646 | |||
647 | #region Extra | ||
648 | private Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
649 | { | ||
650 | InventoryFolderBase root = m_InventoryService.GetRootFolder(userID); | ||
651 | if (root != null) | ||
652 | { | ||
653 | InventoryCollection content = m_InventoryService.GetFolderContent(userID, root.ID); | ||
654 | if (content != null) | ||
655 | { | ||
656 | Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
657 | foreach (InventoryFolderBase folder in content.Folders) | ||
658 | { | ||
659 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | ||
660 | folders[(AssetType)folder.Type] = folder; | ||
661 | } | ||
662 | // Put the root folder there, as type Folder | ||
663 | folders[AssetType.Folder] = root; | ||
664 | return folders; | ||
665 | } | ||
666 | } | ||
667 | m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID); | ||
668 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
669 | } | ||
670 | #endregion | ||
671 | |||
626 | } | 672 | } |
627 | } | 673 | } |