From d997fc7b765d425bd34adf5bc839b80fd9fad37c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 4 May 2010 20:57:31 +0200 Subject: Add events to the estate interface to let interested modules know of changes to estate settings --- .../World/Estate/EstateManagementModule.cs | 36 ++++++++++++++++++++++ .../Region/Framework/Interfaces/IEstateModule.cs | 5 +++ 2 files changed, 41 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 77068b0..92e9eed 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -48,6 +48,9 @@ namespace OpenSim.Region.CoreModules.World.Estate private EstateTerrainXferHandler TerrainUploader; + public event ChangeDelegate OnRegionInfoChange; + public event ChangeDelegate OnEstateInfoChange; + #region Packet Data Responders private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) @@ -137,6 +140,7 @@ namespace OpenSim.Region.CoreModules.World.Estate m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false; m_scene.RegionInfo.RegionSettings.Save(); + TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); } @@ -162,6 +166,7 @@ namespace OpenSim.Region.CoreModules.World.Estate break; } m_scene.RegionInfo.RegionSettings.Save(); + TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); } @@ -187,6 +192,7 @@ namespace OpenSim.Region.CoreModules.World.Estate break; } m_scene.RegionInfo.RegionSettings.Save(); + TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); } @@ -219,6 +225,7 @@ namespace OpenSim.Region.CoreModules.World.Estate sendRegionInfoPacketToAll(); m_scene.RegionInfo.RegionSettings.Save(); + TriggerRegionInfoChange(); } private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) @@ -230,6 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_scene.RegionInfo.RegionSettings.Covenant = estateCovenantID; m_scene.RegionInfo.RegionSettings.Save(); + TriggerRegionInfoChange(); } private void handleEstateAccessDeltaRequest(IClientAPI remote_client, UUID invoice, int estateAccessType, UUID user) @@ -245,6 +253,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_scene.RegionInfo.EstateSettings.AddEstateUser(user); m_scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); } else @@ -259,6 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user); m_scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); } @@ -273,6 +283,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); m_scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); } else @@ -286,6 +297,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); m_scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); } @@ -323,6 +335,7 @@ namespace OpenSim.Region.CoreModules.World.Estate m_scene.RegionInfo.EstateSettings.AddBan(item); m_scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); ScenePresence s = m_scene.GetScenePresence(user); if (s != null) @@ -370,6 +383,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); m_scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); } else { @@ -389,6 +403,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_scene.RegionInfo.EstateSettings.AddEstateManager(user); m_scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); } else @@ -402,6 +417,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); m_scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); } @@ -449,6 +465,7 @@ namespace OpenSim.Region.CoreModules.World.Estate m_scene.RegionInfo.RegionSettings.Save(); + TriggerRegionInfoChange(); m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); } @@ -860,6 +877,7 @@ namespace OpenSim.Region.CoreModules.World.Estate m_scene.RegionInfo.EstateSettings.DenyMinors = false; m_scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); m_scene.TriggerEstateSunUpdate(); @@ -927,6 +945,7 @@ namespace OpenSim.Region.CoreModules.World.Estate break; } m_scene.RegionInfo.RegionSettings.Save(); + TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); } @@ -972,6 +991,7 @@ namespace OpenSim.Region.CoreModules.World.Estate break; } m_scene.RegionInfo.RegionSettings.Save(); + TriggerRegionInfoChange(); sendRegionHandshakeToAll(); } } @@ -1141,5 +1161,21 @@ namespace OpenSim.Region.CoreModules.World.Estate return false; } + + protected void TriggerRegionInfoChange() + { + ChangeDelegate change = OnRegionInfoChange; + + if (change != null) + change(); + } + + protected void TriggerEstateInfoChange() + { + ChangeDelegate change = OnEstateInfoChange; + + if (change != null) + change(); + } } } diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 890fa31..b2135d2 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -29,8 +29,13 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { + public delegate void ChangeDelegate(); + public interface IEstateModule : IRegionModule { + event ChangeDelegate OnRegionInfoChange; + event ChangeDelegate OnEstateInfoChange; + uint GetRegionFlags(); bool IsManager(UUID avatarID); -- cgit v1.1