From 6d061d9f398adfa193f25c43604b517ad0d756a2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jan 2010 22:00:19 +0000 Subject: Complete the XInventoryConnector. Flesh out the skeleton for the XInventoryInConnector --- .../Connectors/Inventory/XInventoryConnector.cs | 50 +++++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index aac1a83..40acd6d 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -149,12 +149,58 @@ namespace OpenSim.Services.Connectors public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) { - return null; + Dictionary ret = MakeRequest("GETFOLDERCONTENT", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "FOLDER", folderID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + + InventoryCollection inventory = new InventoryCollection(); + inventory.Folders = new List(); + inventory.Items = new List(); + inventory.UserID = principalID; + + Dictionary folders = + (Dictionary)ret["FOLDERS"]; + Dictionary items = + (Dictionary)ret["ITEMS"]; + + foreach (Object o in folders.Values) + inventory.Folders.Add(BuildFolder((Dictionary)o)); + foreach (Object o in items.Values) + inventory.Items.Add(BuildItem((Dictionary)o)); + + return inventory; } public List GetFolderItems(UUID principalID, UUID folderID) { - return null; + Dictionary ret = MakeRequest("GETFOLDERCONTENT", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "FOLDER", folderID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + + List items = new List(); + + foreach (Object o in ret.Values) + items.Add(BuildItem((Dictionary)o)); + + return items; } public bool AddFolder(InventoryFolderBase folder) -- cgit v1.1