From c5af39239f7f2a1725d9c08bea80522de8835e0f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 19 Aug 2009 00:13:51 -0700 Subject: A better purge of trash folder. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 25 ++++++++++------- .../Inventory/Transfer/InventoryTransferModule.cs | 4 ++- .../Inventory/BaseInventoryConnector.cs | 2 +- .../Inventory/HGInventoryBroker.cs | 18 ++++++++----- .../Inventory/LocalInventoryServiceConnector.cs | 4 +-- .../Inventory/RemoteInventoryServiceConnector.cs | 10 ++++--- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 31 +++++++++++++++++----- .../Framework/Scenes/Scene.PacketHandlers.cs | 2 +- 8 files changed, 63 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 16ce9e0..e2fb659 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -7053,14 +7053,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (OnRemoveInventoryItem != null) { handlerRemoveInventoryItem = null; + List uuids = new List(); foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData) { - handlerRemoveInventoryItem = OnRemoveInventoryItem; - if (handlerRemoveInventoryItem != null) - { - handlerRemoveInventoryItem(this, datablock.ItemID); - } + uuids.Add(datablock.ItemID); } + handlerRemoveInventoryItem = OnRemoveInventoryItem; + if (handlerRemoveInventoryItem != null) + { + handlerRemoveInventoryItem(this, uuids); + } + } break; case PacketType.RemoveInventoryFolder: @@ -7116,13 +7119,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (OnRemoveInventoryItem != null) { handlerRemoveInventoryItem = null; + List uuids = new List(); foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData) { - handlerRemoveInventoryItem = OnRemoveInventoryItem; - if (handlerRemoveInventoryItem != null) - { - handlerRemoveInventoryItem(this, datablock.ItemID); - } + uuids.Add(datablock.ItemID); + } + handlerRemoveInventoryItem = OnRemoveInventoryItem; + if (handlerRemoveInventoryItem != null) + { + handlerRemoveInventoryItem(this, uuids); } } break; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 3a65336..5afbf68 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -267,7 +267,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer item.Folder = trashFolder.ID; // Diva comment: can't we just update this item??? - invService.DeleteItem(item); + List uuids = new List(); + uuids.Add(item.ID); + invService.DeleteItems(item.Owner, uuids); scene.AddInventoryItem(client, item); } else diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs index ef5ffe1..d1ae3e4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs @@ -186,7 +186,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the item was successfully deleted - public abstract bool DeleteItem(InventoryItemBase item); + public abstract bool DeleteItems(UUID ownerID, List itemIDs); public abstract InventoryItemBase GetItem(InventoryItemBase item); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 3649097..6a1f2d5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -393,18 +393,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public override bool DeleteItem(InventoryItemBase item) + public override bool DeleteItems(UUID ownerID, List itemIDs) { - if (item == null) + m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); + + if (itemIDs == null) return false; + if (itemIDs.Count == 0) + return true; - if (IsLocalGridUser(item.Owner)) - return m_GridService.DeleteItem(item); + if (IsLocalGridUser(ownerID)) + return m_GridService.DeleteItems(ownerID, itemIDs); else { - UUID sessionID = GetSessionID(item.Owner); - string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); - return m_HGService.DeleteItem(uri, item, sessionID); + UUID sessionID = GetSessionID(ownerID); + string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString(); + return m_HGService.DeleteItems(uri, itemIDs, sessionID); } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 2fbc5fe..b2640af 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -294,9 +294,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the item was successfully deleted - public override bool DeleteItem(InventoryItemBase item) + public override bool DeleteItems(UUID ownerID, List itemIDs) { - return m_InventoryService.DeleteItem(item); + return m_InventoryService.DeleteItems(ownerID, itemIDs); } public override InventoryItemBase GetItem(InventoryItemBase item) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index 522f680..012f0e3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -273,13 +273,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); } - public override bool DeleteItem(InventoryItemBase item) + public override bool DeleteItems(UUID ownerID, List itemIDs) { - if (item == null) + if (itemIDs == null) return false; + if (itemIDs.Count == 0) + return true; - UUID sessionID = GetSessionID(item.Owner); - return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); + UUID sessionID = GetSessionID(ownerID); + return m_RemoteConnector.DeleteItems(ownerID.ToString(), itemIDs, sessionID); } public override InventoryItemBase GetItem(InventoryItemBase item) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 48c7f4e..5e2eb73 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -477,7 +477,11 @@ namespace OpenSim.Region.Framework.Scenes if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) - InventoryService.DeleteItem(new InventoryItemBase(itemId)); + { + List items = new List(); + items.Add(itemId); + InventoryService.DeleteItems(senderId, items); + } } return itemCopy; @@ -652,7 +656,9 @@ namespace OpenSim.Region.Framework.Scenes item.Folder = folderID; // Diva comment: can't we just update? - InventoryService.DeleteItem(item); + List uuids = new List(); + uuids.Add(item.ID); + InventoryService.DeleteItems(item.Owner, uuids); AddInventoryItem(remoteClient, item); } @@ -799,9 +805,10 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - private void RemoveInventoryItem(IClientAPI remoteClient, UUID itemID) + private void RemoveInventoryItem(IClientAPI remoteClient, List itemIDs) { - InventoryService.DeleteItem(new InventoryItemBase(itemID)); + //m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId); + InventoryService.DeleteItems(remoteClient.AgentId, itemIDs); } /// @@ -1248,7 +1255,11 @@ namespace OpenSim.Region.Framework.Scenes if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) - RemoveInventoryItem(remoteClient, itemID); + { + List uuids = new List(); + uuids.Add(itemID); + RemoveInventoryItem(remoteClient, uuids); + } } } else @@ -2144,7 +2155,11 @@ namespace OpenSim.Region.Framework.Scenes // copy ones will be lost, so avoid it // if (!attachment) - InventoryService.DeleteItem(item); + { + List uuids = new List(); + uuids.Add(item.ID); + InventoryService.DeleteItems(item.Owner, uuids); + } } } @@ -2404,7 +2419,9 @@ namespace OpenSim.Region.Framework.Scenes } part.ParentGroup.DetachToGround(); - InventoryService.DeleteItem(new InventoryItemBase(inventoryID)); + List uuids = new List(); + uuids.Add(inventoryID); + InventoryService.DeleteItems(remoteClient.AgentId, uuids); remoteClient.SendRemoveInventoryItem(inventoryID); } SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 1bbca49..a2414e5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -560,7 +560,7 @@ namespace OpenSim.Region.Framework.Scenes public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) { - InventoryFolderBase folder = new InventoryFolderBase(folderID); + InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId); if (InventoryService.PurgeFolder(folder)) m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); -- cgit v1.1