From b03eeeb9f6331ed36c61f55aef847ce3b2db7ba4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 22 Aug 2009 10:24:26 -0700 Subject: * Fixes mantis http://opensimulator.org/mantis/view.php?id=4044. Turns out folders were never being removed from trash when they were singled out for purging in trash. They were being removed when Trash was purged as a whole. That behavior is now fixed for the new InventoryService set. * Removed left-overs from AssetInventoryServer. --- .../Inventory/HGInventoryServiceConnector.cs | 13 ++++++++++++ .../Inventory/ISessionAuthInventoryService.cs | 5 +++++ .../Inventory/InventoryServiceConnector.cs | 23 ++++++++++++++++++++-- .../QuickAndDirtyInventoryServiceConnector.cs | 6 ++++++ OpenSim/Services/Interfaces/IInventoryService.cs | 8 ++++++++ .../Services/InventoryService/InventoryService.cs | 16 +++++++++++++-- 6 files changed, 67 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs index 45e921a..1004fb9 100644 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs @@ -201,6 +201,19 @@ namespace OpenSim.Services.Connectors.Inventory return false; } + public bool DeleteFolders(string id, List folders, UUID sessionID) + { + string url = string.Empty; + string userID = string.Empty; + + if (StringToUrlAndUserID(id, out url, out userID)) + { + ISessionAuthInventoryService connector = GetConnector(url); + return connector.DeleteFolders(userID, folders, sessionID); + } + return false; + } + public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) { string url = string.Empty; diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs index c89c9b7..da8c7e2 100644 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs @@ -89,6 +89,11 @@ namespace OpenSim.Services.Connectors bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id); /// + /// Delete a list of inventory folders (from trash) + /// + bool DeleteFolders(string userID, List folders, UUID session_id); + + /// /// Purge an inventory folder of all its items and subfolders. /// /// diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index 7c35bde..423ca75 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -308,6 +308,25 @@ namespace OpenSim.Services.Connectors return false; } + public bool DeleteFolders(string userID, List folderIDs, UUID sessionID) + { + try + { + List guids = new List(); + foreach (UUID u in folderIDs) + guids.Add(u.Guid); + return SynchronousRestSessionObjectPoster, bool>.BeginPostObject( + "POST", m_ServerURI + "/DeleteFolders/", guids, sessionID.ToString(), userID); + } + catch (Exception e) + { + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory folders operation failed, {0} {1}", + e.Source, e.Message); + } + + return false; + } + public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID) { try @@ -481,12 +500,12 @@ namespace OpenSim.Services.Connectors return null; } - public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase item, UUID sessionID) + public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID) { try { return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/QueryFolder/", item, sessionID.ToString(), item.Owner.ToString()); + "POST", m_ServerURI + "/QueryFolder/", folder, sessionID.ToString(), userID); } catch (Exception e) { diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs index cd283ff..a7aa138 100644 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs @@ -136,6 +136,12 @@ namespace OpenSim.Services.Connectors return false; } + public bool DeleteFolders(UUID ownerID, List folderIDs) + { + return false; + } + + public bool PurgeFolder(InventoryFolderBase folder) { return false; diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index ebdb09a..c775090 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs @@ -122,6 +122,14 @@ namespace OpenSim.Services.Interfaces bool MoveFolder(InventoryFolderBase folder); /// + /// Delete an item from the user's inventory + /// + /// + /// true if the item was successfully deleted + //bool DeleteItem(InventoryItemBase item); + bool DeleteFolders(UUID userID, List folderIDs); + + /// /// Purge an inventory folder of all its items and subfolders. /// /// diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 45bbd37..0cf4af1 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs @@ -425,15 +425,27 @@ namespace OpenSim.Services.InventoryService return null; } - public virtual InventoryFolderBase GetFolder(InventoryFolderBase item) + public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) { - InventoryFolderBase result = m_Database.getInventoryFolder(item.ID); + m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder {0}", folder.ID); + InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID); if (result != null) return result; return null; } + public virtual bool DeleteFolders(UUID ownerID, List folderIDs) + { + foreach (UUID id in folderIDs) + { + InventoryFolderBase folder = new InventoryFolderBase(id, ownerID); + PurgeFolder(folder); + m_Database.deleteInventoryFolder(id); + } + return true; + } + /// /// Purge a folder of all items items and subfolders. /// -- cgit v1.1