From 4db839c3b84bed8a775074beb1ae0b526bc05e81 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 23 Apr 2008 17:04:15 +0000 Subject: * Implement proper emptying of trashcan on standalone * On standalone, folders (and their items) should now be persistently deleted on trash emptying, as well as immediate child items * An implementation for grid mode will follow. --- .../Communications/InventoryServiceBase.cs | 45 +++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Communications/InventoryServiceBase.cs') diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index f614e7d..769c530 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -50,7 +50,7 @@ namespace OpenSim.Framework.Communications { if (!String.IsNullOrEmpty(FileName)) { - m_log.Info("[AGENTINVENTORY]: Inventory storage: Attempting to load " + FileName); + m_log.Info("[AGENT INVENTORY]: Inventory storage: Attempting to load " + FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName); foreach (Type pluginType in pluginAssembly.GetTypes()) @@ -161,9 +161,19 @@ namespace OpenSim.Framework.Communications // See IInventoryServices public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); + // See IInventoryServices public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); + + // See IInventoryServices public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder); + + // See IInventoryServices + public abstract void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder); + + // See IInventoryServices public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); + + // See IInventoryServices public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); #endregion @@ -228,6 +238,36 @@ namespace OpenSim.Framework.Communications } } + /// + /// Purge a folder of all items items and subfolders. + /// + /// FIXME: Really nasty in a sense, because we have to query the database to get information we may + /// already know... Needs heavy refactoring. + /// + /// + protected void PurgeFolder(InventoryFolderBase folder) + { + List subFolders = RequestSubFolders(folder.ID); + + foreach (InventoryFolderBase subFolder in subFolders) + { +// m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); + + foreach (KeyValuePair plugin in m_plugins) + { + plugin.Value.deleteInventoryFolder(subFolder.ID); + } + } + + // XXX Temporarily don't delete the items since UserProfileCacheService is still doing this +// List items = RequestFolderItems(folder.ID); +// +// foreach (InventoryItemBase item : items) +// { +// DeleteItem(item); +// } + } + private void AddNewInventorySet(UsersInventory inventory) { foreach (InventoryFolderBase folder in inventory.Folders.Values) @@ -236,6 +276,9 @@ namespace OpenSim.Framework.Communications } } + /// + /// Used to create a new user inventory. + /// private class UsersInventory { public Dictionary Folders = new Dictionary(); -- cgit v1.1