From fd23f270c6914b7aa628f96daa9608745d3a20b3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 21:01:10 +0100 Subject: refactor: remove Scene.SetRootAgentScene() in favour of existing event with same name --- .../Avatar/Inventory/Transfer/InventoryTransferModule.cs | 15 ++++++++------- .../Framework/Interfaces/IInventoryTransferModule.cs | 3 +-- OpenSim/Region/Framework/Scenes/Scene.cs | 11 ----------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 2f1e9dd..8b77a5f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -82,6 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClientClosed += ClientLoggedOut; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; + scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; } public void RegionLoaded(Scene scene) @@ -98,9 +99,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer scene.EventManager.OnNewClient -= OnNewClient; scene.EventManager.OnClientClosed -= ClientLoggedOut; scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; + scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; } } - } public void RemoveRegion(Scene scene) @@ -108,6 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer scene.EventManager.OnNewClient -= OnNewClient; scene.EventManager.OnClientClosed -= ClientLoggedOut; scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; + scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; m_Scenelist.Remove(scene); } @@ -136,6 +138,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer // Inventory giving is conducted via instant message client.OnInstantMessage += OnInstantMessage; } + + protected void OnSetRootAgentScene(UUID id, Scene scene) + { + m_AgentRegions[id] = scene; + } private Scene FindClientScene(UUID agentId) { @@ -160,7 +167,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer if (scene == null) // Something seriously wrong here. return; - if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) { //m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0])); @@ -346,11 +352,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer } } - public void SetRootAgentScene(UUID agentID, Scene scene) - { - m_AgentRegions[agentID] = scene; - } - public bool NeedSceneCacheClear(UUID agentID, Scene scene) { if (!m_AgentRegions.ContainsKey(agentID)) diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs index 2390ff4..1e92fde 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs @@ -35,7 +35,6 @@ namespace OpenSim.Region.Framework.Interfaces /// public interface IInventoryTransferModule { - void SetRootAgentScene(UUID agentID, Scene scene); bool NeedSceneCacheClear(UUID agentID, Scene scene); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4d5c1e7..631046a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4487,17 +4487,6 @@ namespace OpenSim.Region.Framework.Scenes client.SendLayerData(patchX, patchY, Heightmap.GetFloatsSerialised()); } - public void SetRootAgentScene(UUID agentID) - { - IInventoryTransferModule inv = RequestModuleInterface(); - if (inv == null) - return; - - inv.SetRootAgentScene(agentID, this); - - EventManager.TriggerSetRootAgentScene(agentID, this); - } - public bool NeedSceneCacheClear(UUID agentID) { IInventoryTransferModule inv = RequestModuleInterface(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 14d7d6a..08c6e27 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -821,7 +821,7 @@ namespace OpenSim.Region.Framework.Scenes m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; - m_scene.SetRootAgentScene(m_uuid); + m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); // Moved this from SendInitialData to ensure that m_appearance is initialized // before the inventory is processed in MakeRootAgent. This fixes a race condition -- cgit v1.1