From 82e534a0291c2a2c54ad95991d7b8ed6b6524839 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 4 Nov 2010 19:07:43 +0100 Subject: [PATCH 1/2] Fix avatar to avatar inventory gives across servers --- .../Transfer/InventoryTransferModule.cs | 58 ++++++++++++++++--- 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 6badc744a8..e9e7c25640 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -175,8 +175,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer if (im.binaryBucket.Length < 17) // Invalid return; - UUID receipientID = new UUID(im.toAgentID); - ScenePresence user = scene.GetScenePresence(receipientID); + UUID recipientID = new UUID(im.toAgentID); + ScenePresence user = scene.GetScenePresence(recipientID); UUID copyID; // First byte is the asset type @@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer folderID, new UUID(im.toAgentID)); InventoryFolderBase folderCopy - = scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero); + = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); if (folderCopy == null) { @@ -419,22 +419,64 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer /// /// /// - private void OnGridInstantMessage(GridInstantMessage msg) + private void OnGridInstantMessage(GridInstantMessage im) { // Check if this is ours to handle // - Scene scene = FindClientScene(new UUID(msg.toAgentID)); + Scene scene = FindClientScene(new UUID(im.toAgentID)); if (scene == null) return; // Find agent to deliver to // - ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID)); + ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); + if (user == null) + return; - // Just forward to local handling - OnInstantMessage(user.ControllingClient, msg); + // This requires a little bit of processing because we have to make the + // new item visible in the recipient's inventory here + // + if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) + { + if (im.binaryBucket.Length < 17) // Invalid + return; + + UUID recipientID = new UUID(im.toAgentID); + // First byte is the asset type + AssetType assetType = (AssetType)im.binaryBucket[0]; + + if (AssetType.Folder == assetType) + { + UUID folderID = new UUID(im.binaryBucket, 1); + + InventoryFolderBase given = + new InventoryFolderBase(folderID, recipientID); + InventoryFolderBase folder = + scene.InventoryService.GetFolder(given); + + if (folder != null) + user.ControllingClient.SendBulkUpdateInventory(folder); + } + else + { + UUID itemID = new UUID(im.binaryBucket, 1); + + InventoryItemBase given = + new InventoryItemBase(itemID, recipientID); + InventoryItemBase item = + scene.InventoryService.GetItem(given); + + if (item != null) + { + user.ControllingClient.SendBulkUpdateInventory(item); + } + } + } + + // Just forward to the client + user.ControllingClient.SendInstantMessage(im); } } } From 893915ce0b88348bc7e2053e8942f76ad7ef830b Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 4 Nov 2010 21:09:59 +0100 Subject: [PATCH 2/2] Fix child prims returning after being unlinked and deleted where the root is not deleted --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index b016065825..a4621331d8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1760,6 +1760,11 @@ namespace OpenSim.Region.Framework.Scenes // foreach (SceneObjectGroup g in affectedGroups) { + // Child prims that have been unlinked and deleted will + // return unless the root is deleted. This will remove them + // from the database. They will be rewritten immediately, + // minus the rows for the unlinked child prims. + m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); g.TriggerScriptChangedEvent(Changed.LINK); g.HasGroupChanged = true; // Persist g.areUpdatesSuspended = false;