From 5fda81e6bbb80cbe904e69638f5f405aca78f111 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 30 Apr 2010 11:39:02 -0700 Subject: * XInventory fairly tested, including for HG. Almost ready to switch. * Removed a few buglets and added better exception handling. --- .../Connectors/Inventory/XInventoryConnector.cs | 119 ++++++++++----------- 1 file changed, 54 insertions(+), 65 deletions(-) (limited to 'OpenSim/Services/Connectors/Inventory') diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index 52294da..e25e7eb 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -158,30 +158,31 @@ namespace OpenSim.Services.Connectors public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) { - 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"]; - try { + Dictionary ret = MakeRequest("GETFOLDERCONTENT", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "FOLDER", folderID.ToString() } + }); + + if (ret == null) + return null; + if (ret.Count == 0) + return null; + + + 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) // getting the values directly, we don't care about the keys folder_i inventory.Folders.Add(BuildFolder((Dictionary)o)); foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i @@ -189,7 +190,7 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping content list: {0}", e.Message); + m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolderContent: {0}", e.Message); } return inventory; @@ -408,32 +409,50 @@ namespace OpenSim.Services.Connectors public InventoryItemBase GetItem(InventoryItemBase item) { - Dictionary ret = MakeRequest("GETITEM", - new Dictionary { + try + { + Dictionary ret = MakeRequest("GETITEM", + new Dictionary { { "ID", item.ID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) - return null; + if (ret == null) + return null; + if (ret.Count == 0) + return null; + + return BuildItem((Dictionary)ret["item"]); + } + catch (Exception e) + { + m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetItem: {0}", e.Message); + } - return BuildItem((Dictionary)ret["item"]); + return null; } public InventoryFolderBase GetFolder(InventoryFolderBase folder) { - Dictionary ret = MakeRequest("GETFOLDER", - new Dictionary { + try + { + Dictionary ret = MakeRequest("GETFOLDER", + new Dictionary { { "ID", folder.ID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) - return null; + if (ret == null) + return null; + if (ret.Count == 0) + return null; - return BuildFolder((Dictionary)ret["folder"]); + return BuildFolder((Dictionary)ret["folder"]); + } + catch (Exception e) + { + m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolder: {0}", e.Message); + } + + return null; } public List GetActiveGestures(UUID principalID) @@ -468,36 +487,6 @@ namespace OpenSim.Services.Connectors return int.Parse(ret["RESULT"].ToString()); } - public Dictionary GetSystemFolders(UUID userID) - { - Dictionary ret = MakeRequest("GETSYSTEMFOLDERS", - new Dictionary { - { "PRINCIPAL", userID.ToString() }, - }); - - if (ret == null) - return new Dictionary(); - - Dictionary sfolders = new Dictionary(); - - try - { - Dictionary folders = (Dictionary)ret["FOLDERS"]; - - foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i - { - InventoryFolderBase folder = BuildFolder((Dictionary)o); - sfolders.Add((AssetType)folder.Type, folder); - } - - } - catch (Exception e) - { - m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: exception {0}", e.Message); - } - - return sfolders; - } // These are either obsolete or unused // -- cgit v1.1