From 2c81e18fc33c12b3adcd4559b88d385779c7be6f Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 18 Feb 2008 03:25:14 +0000 Subject: Thank you very much Ahzzmandius for adding the support to purge the avatars inventory "Trash" folder using the bizarre tortoiseSVN method of diff/patch. --- .../Region/Environment/Scenes/Scene.Inventory.cs | 45 ++++++++++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 2 + 2 files changed, 47 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 2212216..13fa009 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -476,6 +476,51 @@ namespace OpenSim.Region.Environment.Scenes } } + private void RemoveInventoryItem(IClientAPI remoteClient, LLUUID itemID) + { + CachedUserInfo userInfo + = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); + if (userInfo == null) + { + m_log.Error("[AGENTINVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); + return; + } + + // is going through the root folder really the best way? + // this triggers a tree walk to find and remove the item. 8-( + // since this only happens in Trash (in theory) shouldn't we grab + // the trash folder directly instead of RootFolder? + if (userInfo.RootFolder != null) + { + InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); + if (item != null) + { + userInfo.DeleteItem(remoteClient.AgentId, item); + } + } + } + + private void RemoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID) + { + CachedUserInfo userInfo + = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); + if (userInfo == null) + { + m_log.Error("[AGENTINVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); + return; + } + + if (userInfo.RootFolder != null) + { + InventoryItemBase folder = userInfo.RootFolder.HasItem(folderID); + if (folder != null) + { + // doesn't work just yet, commented out. WIll fix in next patch. + // userInfo.DeleteItem(remoteClient.AgentId, folder); + } + } + } + private SceneObjectGroup GetGroupByPrim(uint localID) { List EntitieList = GetEntities(); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d3b051f..7af3f5b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1397,6 +1397,8 @@ namespace OpenSim.Region.Environment.Scenes client.OnUpdateInventoryItem += UpdateInventoryItemAsset; client.OnCopyInventoryItem += CopyInventoryItem; client.OnMoveInventoryItem += MoveInventoryItem; + client.OnRemoveInventoryItem += RemoveInventoryItem; + client.OnRemoveInventoryFolder += RemoveInventoryFolder; // client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest; // client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer; client.OnRezScript += RezScript; -- cgit v1.1