From 3f9d38538e4d7f238eb901aced60de7e6673a92e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 27 Apr 2010 11:01:56 -0700 Subject: XInventory connector/handler showing signs of life. Tested, but needs more testing. --- .../Handlers/Inventory/XInventoryInConnector.cs | 69 +++++++++++++++++----- 1 file changed, 54 insertions(+), 15 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 7164520..c95b4d4 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -228,9 +228,17 @@ namespace OpenSim.Server.Handlers.Asset List folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); + Dictionary sfolders = new Dictionary(); if (folders != null) + { + int i = 0; foreach (InventoryFolderBase f in folders) - result[f.ID.ToString()] = EncodeFolder(f); + { + sfolders["folder_" + i.ToString()] = EncodeFolder(f); + i++; + } + } + result["FOLDERS"] = sfolders; string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); @@ -246,7 +254,7 @@ namespace OpenSim.Server.Handlers.Asset UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); InventoryFolderBase rfolder = m_InventoryService.GetRootFolder(principal); if (rfolder != null) - result[rfolder.ID.ToString()] = EncodeFolder(rfolder); + result["folder"] = EncodeFolder(rfolder); string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); @@ -263,7 +271,7 @@ namespace OpenSim.Server.Handlers.Asset Int32.TryParse(request["TYPE"].ToString(), out type); InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type); if (folder != null) - result[folder.ID.ToString()] = EncodeFolder(folder); + result["folder"] = EncodeFolder(folder); string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); @@ -283,13 +291,21 @@ namespace OpenSim.Server.Handlers.Asset if (icoll != null) { Dictionary folders = new Dictionary(); + int i = 0; foreach (InventoryFolderBase f in icoll.Folders) - folders[f.ID.ToString()] = EncodeFolder(f); + { + folders["folder_" + i.ToString()] = EncodeFolder(f); + i++; + } result["FOLDERS"] = folders; + i = 0; Dictionary items = new Dictionary(); - foreach (InventoryItemBase i in icoll.Items) - items[i.ID.ToString()] = EncodeItem(i); + foreach (InventoryItemBase it in icoll.Items) + { + items["item_" + i.ToString()] = EncodeItem(it); + i++; + } result["ITEMS"] = items; } @@ -308,9 +324,18 @@ namespace OpenSim.Server.Handlers.Asset UUID.TryParse(request["FOLDER"].ToString(), out folderID); List items = m_InventoryService.GetFolderItems(principal, folderID); + Dictionary sitems = new Dictionary(); + if (items != null) + { + int i = 0; foreach (InventoryItemBase item in items) - result[item.ID.ToString()] = EncodeItem(item); + { + sitems["item_" + i.ToString()] = EncodeItem(item); + i++; + } + } + result["ITEMS"] = sitems; string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); @@ -483,7 +508,7 @@ namespace OpenSim.Server.Handlers.Asset InventoryItemBase item = new InventoryItemBase(id); item = m_InventoryService.GetItem(item); if (item != null) - result[item.ID.ToString()] = EncodeItem(item); + result["item"] = EncodeItem(item); string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); @@ -500,7 +525,7 @@ namespace OpenSim.Server.Handlers.Asset InventoryFolderBase folder = new InventoryFolderBase(id); folder = m_InventoryService.GetFolder(folder); if (folder != null) - result[folder.ID.ToString()] = EncodeFolder(folder); + result["folder"] = EncodeFolder(folder); string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); @@ -515,9 +540,17 @@ namespace OpenSim.Server.Handlers.Asset UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); List gestures = m_InventoryService.GetActiveGestures(principal); + Dictionary items = new Dictionary(); if (gestures != null) + { + int i = 0; foreach (InventoryItemBase item in gestures) - result[item.ID.ToString()] = EncodeItem(item); + { + items["item_" + i.ToString()] = EncodeItem(item); + i++; + } + } + result["ITEMS"] = items; string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); @@ -549,10 +582,16 @@ namespace OpenSim.Server.Handlers.Asset UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); Dictionary sfolders = GetSystemFolders(principal); + m_log.DebugFormat("[XXX]: SystemFolders got {0} folders", sfolders.Count); - if (sfolders != null) - foreach (KeyValuePair kvp in sfolders) - result[kvp.Key.ToString()] = EncodeFolder(kvp.Value); + Dictionary folders = new Dictionary(); + int i = 0; + foreach (KeyValuePair kvp in sfolders) + { + folders["folder_" + i.ToString()] = EncodeFolder(kvp.Value); + i++; + } + result["FOLDERS"] = folders; string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); @@ -589,7 +628,7 @@ namespace OpenSim.Server.Handlers.Asset ret["Flags"] = item.Flags.ToString(); ret["Folder"] = item.Folder.ToString(); ret["GroupID"] = item.GroupID.ToString(); - ret["GroupedOwned"] = item.GroupOwned.ToString(); + ret["GroupOwned"] = item.GroupOwned.ToString(); ret["GroupPermissions"] = item.GroupPermissions.ToString(); ret["ID"] = item.ID.ToString(); ret["InvType"] = item.InvType.ToString(); @@ -664,7 +703,7 @@ namespace OpenSim.Server.Handlers.Asset return folders; } } - m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID); + m_log.WarnFormat("[XINVENTORY SERVICE]: System folders for {0} not found", userID); return new Dictionary(); } #endregion -- cgit v1.1