From 1ae9bfc0746b97f57031f282d4f6721b08c27f0c Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 4 Jan 2010 20:52:44 +0000 Subject: Finish conversion if XInventoryService --- .../Services/InventoryService/XInventoryService.cs | 58 +++++++++++++++++----- 1 file changed, 46 insertions(+), 12 deletions(-) (limited to 'OpenSim/Services/InventoryService') diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 1e7f206..2c79c77 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -183,7 +183,10 @@ namespace OpenSim.Services.InventoryService List folders = new List(); foreach (XInventoryFolder x in allFolders) + { + m_log.DebugFormat("[INVENTORY]: Adding folder {0} to skeleton", x.folderName); folders.Add(ConvertToOpenSim(x)); + } return folders; } @@ -214,35 +217,48 @@ namespace OpenSim.Services.InventoryService public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) { + // This method doesn't receive a valud principal id from the + // connector. So we disregard the principal and look + // by ID. + // + m_log.DebugFormat("[INVENTORY]: Fetch contents for folder {0}", folderID.ToString()); InventoryCollection inventory = new InventoryCollection(); inventory.UserID = principalID; inventory.Folders = new List(); inventory.Items = new List(); XInventoryFolder[] folders = m_Database.GetFolders( - new string[] { "agentID", "parentFolderID"}, - new string[] { principalID.ToString(), UUID.Zero.ToString() }); + new string[] { "parentFolderID"}, + new string[] { folderID.ToString() }); foreach (XInventoryFolder x in folders) + { + m_log.DebugFormat("[INVENTORY]: Adding folder {0} to response", x.folderName); inventory.Folders.Add(ConvertToOpenSim(x)); + } XInventoryItem[] items = m_Database.GetItems( - new string[] { "avatarID", "parentFolderID"}, - new string[] { principalID.ToString(), UUID.Zero.ToString() }); + new string[] { "parentFolderID"}, + new string[] { folderID.ToString() }); foreach (XInventoryItem i in items) + { + m_log.DebugFormat("[INVENTORY]: Adding item {0} to response", i.inventoryName); inventory.Items.Add(ConvertToOpenSim(i)); + } return inventory; } public List GetFolderItems(UUID principalID, UUID folderID) { + // Since we probably don't get a valid principal here, either ... + // List invItems = new List(); XInventoryItem[] items = m_Database.GetItems( - new string[] { "avatarID", "parentFolderID"}, - new string[] { principalID.ToString(), UUID.Zero.ToString() }); + new string[] { "parentFolderID"}, + new string[] { UUID.Zero.ToString() }); foreach (XInventoryItem i in items) invItems.Add(ConvertToOpenSim(i)); @@ -279,6 +295,8 @@ namespace OpenSim.Services.InventoryService // public bool DeleteFolders(UUID principalID, List folderIDs) { + // Ignore principal ID, it's bogus at connector level + // foreach (UUID id in folderIDs) { InventoryFolderBase f = new InventoryFolderBase(); @@ -297,7 +315,10 @@ namespace OpenSim.Services.InventoryService new string[] { folder.ID.ToString() }); foreach (XInventoryFolder x in subFolders) + { PurgeFolder(ConvertToOpenSim(x)); + m_Database.DeleteFolders("folderID", x.folderID.ToString()); + } m_Database.DeleteItems("parentFolderID", folder.ID.ToString()); @@ -316,10 +337,11 @@ namespace OpenSim.Services.InventoryService public bool MoveItems(UUID principalID, List items) { + // Principal is b0rked. *sigh* + // foreach (InventoryItemBase i in items) { - m_Database.MoveItem(principalID.ToString(), i.ID.ToString(), - i.Folder.ToString()); + m_Database.MoveItem(i.ID.ToString(), i.Folder.ToString()); } return true; @@ -327,6 +349,8 @@ namespace OpenSim.Services.InventoryService public bool DeleteItems(UUID principalID, List itemIDs) { + // Just use the ID... *facepalms* + // foreach (UUID id in itemIDs) m_Database.DeleteItems("inventoryID", id.ToString()); @@ -357,14 +381,24 @@ namespace OpenSim.Services.InventoryService return ConvertToOpenSim(folders[0]); } - public List GetActiveGestures(UUID userId) + public List GetActiveGestures(UUID principalID) { - return null; + XInventoryItem[] items = m_Database.GetActiveGestures(principalID); + + if (items.Length == 0) + return null; + + List ret = new List(); + + foreach (XInventoryItem x in items) + ret.Add(ConvertToOpenSim(x)); + + return ret; } - public int GetAssetPermissions(UUID userID, UUID assetID) + public int GetAssetPermissions(UUID principalID, UUID assetID) { - return 0; + return m_Database.GetAssetPermissions(principalID, assetID); } // CM never needed those. Left unimplemented. -- cgit v1.1