From ec3c31e61e5e540f822891110df9bc978655bbaf Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 22 Jan 2010 18:09:33 -0600 Subject: Updates all IRegionModules to the new style region modules. Signed-off-by: Melanie --- .../Region/CoreModules/Agent/IPBan/IPBanModule.cs | 40 +++++++++++++++------- 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/CoreModules/Agent/IPBan') diff --git a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs index bfe2a71..f7f2eff 100644 --- a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs +++ b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Text; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -36,21 +37,27 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Agent.IPBan { - public class IPBanModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class IPBanModule : ISharedRegionModule { - #region Implementation of IRegionModule + #region Implementation of ISharedRegionModule private List m_bans = new List(); + private Dictionary SceneBanners = new Dictionary(); - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { - new SceneBanner(scene, m_bans); + } + + public void AddRegion(Scene scene) + { + SceneBanners.Add(scene, new SceneBanner(scene, m_bans)); lock (m_bans) { foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans) { - if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) + if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) m_bans.Add(ban.BannedHostIPMask); if (!String.IsNullOrEmpty(ban.BannedHostNameMask)) m_bans.Add(ban.BannedHostNameMask); @@ -58,7 +65,12 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan } } - public void PostInitialise() + public Type ReplaceableInterface + { + get { return null; } + } + + public void RegionLoaded(Scene scene) { if (File.Exists("bans.txt")) { @@ -70,19 +82,23 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan } } - public void Close() + public void RemoveRegion(Scene scene) { - + if(SceneBanners.ContainsKey(scene)) + SceneBanners.Remove(scene); } - public string Name + public void PostInitialise() + { + } + + public void Close() { - get { return "IPBanModule"; } } - public bool IsSharedModule + public string Name { - get { return true; } + get { return "IPBanModule"; } } #endregion -- cgit v1.1