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/Cache/InventoryFolderImpl.cs | 8 +++---
.../Cache/UserProfileCacheService.cs | 29 ++++++++++++++++++----
2 files changed, 27 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Framework/Communications/Cache')
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
index daf9ab5..7812499 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
@@ -79,14 +79,12 @@ namespace OpenSim.Framework.Communications.Cache
///
/// Delete all the folders and items in this folder.
- ///
- /// TODO: This method is not used yet, but will be shortly
///
- public void DeleteAllContents()
+ public void Purge()
{
foreach (InventoryFolderImpl folder in SubFolders.Values)
{
- folder.DeleteAllContents();
+ folder.Purge();
}
SubFolders.Clear();
@@ -206,7 +204,7 @@ namespace OpenSim.Framework.Communications.Cache
}
///
- /// Return the list of folders in this folder
+ /// Return the list of immediate child folders in this folder.
///
public List RequestListOfFolders()
{
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index e3f6815..61ec483 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -496,6 +496,11 @@ namespace OpenSim.Framework.Communications.Cache
return new List();
}
+ ///
+ /// This should delete all the items and folders in the given directory.
+ ///
+ ///
+ ///
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
{
// m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}",
@@ -506,14 +511,28 @@ namespace OpenSim.Framework.Communications.Cache
{
if (userProfile.HasInventory)
{
- InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID);
- if (subFolder != null)
- {
- List items = subFolder.RequestListOfItems();
+ InventoryFolderImpl purgedFolder = userProfile.RootFolder.HasSubFolder(folderID);
+ if (purgedFolder != null)
+ {
+ // XXX Nasty - have to create a new object to hold details we already have
+ InventoryFolderBase purgedBaseFolder = new InventoryFolderBase();
+ purgedBaseFolder.Owner = purgedFolder.Owner;
+ purgedBaseFolder.ID = purgedFolder.ID;
+ purgedBaseFolder.Name = purgedFolder.Name;
+ purgedBaseFolder.ParentID = purgedFolder.ParentID;
+ purgedBaseFolder.Type = purgedFolder.Type;
+ purgedBaseFolder.Version = purgedFolder.Version;
+
+ m_commsManager.InventoryService.PurgeInventoryFolder(remoteClient.AgentId, purgedBaseFolder);
+
+ // XXX Remains temporarily so that we still delete items in the grid case.
+ List items = purgedFolder.RequestListOfItems();
foreach (InventoryItemBase item in items)
{
userProfile.DeleteItem(remoteClient.AgentId, item);
- }
+ }
+
+ purgedFolder.Purge();
}
}
else
--
cgit v1.1