From d30d68657eb0ec3cc5b34290c3460da38cc038c3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 7 Jun 2012 23:51:04 +0100 Subject: [PATCH] Record the fact that child agents can have asset transactions. Also change code to grab the agent asset transaction module once. --- .../AssetTransactionModule.cs | 15 +++++----- .../InventoryAccess/InventoryAccessModule.cs | 2 +- .../Framework/Scenes/Scene.Inventory.cs | 29 ++++++++----------- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++---- 4 files changed, 26 insertions(+), 32 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index 95e3aeceb1..031f7726f2 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs @@ -42,8 +42,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction public class AssetTransactionModule : INonSharedRegionModule, IAgentAssetTransactions { -// private static readonly ILog m_log = LogManager.GetLogger( -// MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_Scene; private bool m_dumpAssetsToFile = false; @@ -203,15 +202,15 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction /// and comes through this method. /// /// + /// /// /// - public void HandleTaskItemUpdateFromTransaction(IClientAPI remoteClient, - SceneObjectPart part, UUID transactionID, - TaskInventoryItem item) + public void HandleTaskItemUpdateFromTransaction( + IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item) { -// m_log.DebugFormat( -// "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}", -// item.Name); + m_log.DebugFormat( + "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}", + item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 29b35c893b..2e7f1663d0 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -216,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } else { - IAgentAssetTransactions agentTransactions = m_Scene.RequestModuleInterface(); + IAgentAssetTransactions agentTransactions = m_Scene.AgentTransactionsModule; if (agentTransactions != null) { agentTransactions.HandleItemCreationFromTransaction( diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 1fc0d0062a..89bfaf62a2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -397,10 +397,9 @@ namespace OpenSim.Region.Framework.Scenes } else { - IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); - if (agentTransactions != null) + if (AgentTransactionsModule != null) { - agentTransactions.HandleItemUpdateFromTransaction(remoteClient, transactionID, item); + AgentTransactionsModule.HandleItemUpdateFromTransaction(remoteClient, transactionID, item); } } } @@ -1489,21 +1488,17 @@ namespace OpenSim.Region.Framework.Scenes // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update) // will not pass in a transaction ID in the update message. - if (transactionID != UUID.Zero) + if (transactionID != UUID.Zero && AgentTransactionsModule != null) { - IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); - if (agentTransactions != null) - { - agentTransactions.HandleTaskItemUpdateFromTransaction( - remoteClient, part, transactionID, currentItem); - - if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) - remoteClient.SendAgentAlertMessage("Notecard saved", false); - else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) - remoteClient.SendAgentAlertMessage("Script saved", false); - else - remoteClient.SendAgentAlertMessage("Item saved", false); - } + AgentTransactionsModule.HandleTaskItemUpdateFromTransaction( + remoteClient, part, transactionID, currentItem); + + if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) + remoteClient.SendAgentAlertMessage("Notecard saved", false); + else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) + remoteClient.SendAgentAlertMessage("Script saved", false); + else + remoteClient.SendAgentAlertMessage("Item saved", false); } // Base ALWAYS has move diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 49d5f47ec9..7148d75446 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -497,6 +497,7 @@ namespace OpenSim.Region.Framework.Scenes public IAttachmentsModule AttachmentsModule { get; set; } public IEntityTransferModule EntityTransferModule { get; private set; } + public IAgentAssetTransactions AgentTransactionsModule { get; private set; } public IAvatarFactoryModule AvatarFactory { @@ -1219,6 +1220,7 @@ namespace OpenSim.Region.Framework.Scenes m_capsModule = RequestModuleInterface(); EntityTransferModule = RequestModuleInterface(); m_groupsModule = RequestModuleInterface(); + AgentTransactionsModule = RequestModuleInterface(); } #endregion @@ -3277,12 +3279,10 @@ namespace OpenSim.Region.Framework.Scenes catch (NullReferenceException) { } }); } - - IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); - if (agentTransactions != null) - { - agentTransactions.RemoveAgentAssetTransactions(agentID); - } + + // It's possible for child agents to have transactions if changes are being made cross-border. + if (AgentTransactionsModule != null) + AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); } finally {