From 851b72570a561a24f39dc72684e354144ed79f00 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Tue, 11 Nov 2008 15:18:16 +0000 Subject: [PATCH] Mantis#2604. Thank you kindly, Diva for a patch that: This patch changes a couple of methods in Scene.Inventory to virtual, so they can be overridden in subclasses. DeleteToInventory now returns the UUID of the newly created asset, so that further actions on it can be pursued in subclasses. This will make my life easier for making inventory accessible in the hypergrid. --- .../Region/Environment/Scenes/Scene.Inventory.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index ff4abc7bc5..35618dbcec 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -158,7 +158,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) + public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) { CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); if (userInfo != null) @@ -405,7 +405,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// ID of the sender of the item /// - public void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) + public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) { // Retrieve the item from the sender CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId); @@ -1607,6 +1607,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// Delete a scene object from a scene and place in the given avatar's inventory. + /// Returns the UUID of the newly created asset. /// /// /// @@ -1614,10 +1615,12 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void DeleteToInventory(int destination, UUID folderID, + public virtual UUID DeleteToInventory(int destination, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient, bool permissionToDelete) { + UUID assetID = UUID.Zero; + string sceneObjectXml = objectGroup.ToXmlString(); CachedUserInfo userInfo; @@ -1661,7 +1664,7 @@ namespace OpenSim.Region.Environment.Scenes { CommsManager.UserProfileCacheService.RequestInventoryForUser(objectGroup.RootPart.OwnerID); m_log.WarnFormat("[SCENE] Can't find root folder for user, requesting inventory"); - return; + return assetID; } } } @@ -1672,6 +1675,7 @@ namespace OpenSim.Region.Environment.Scenes (sbyte)AssetType.Object, Utils.StringToBytes(sceneObjectXml)); AssetCache.AddAsset(asset); + assetID = asset.FullID; InventoryItemBase item = new InventoryItemBase(); item.Creator = objectGroup.RootPart.CreatorID; @@ -1736,6 +1740,8 @@ namespace OpenSim.Region.Environment.Scenes // Finally remove the item, for reals this time. if (permissionToDelete) DeleteSceneObject(objectGroup, false); + + return assetID; } public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, UUID assetID, UUID agentID)