aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs40
1 files changed, 28 insertions, 12 deletions
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;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Text; 31using System.Text;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
@@ -36,21 +37,27 @@ using OpenSim.Region.Framework.Scenes;
36 37
37namespace OpenSim.Region.CoreModules.Agent.IPBan 38namespace OpenSim.Region.CoreModules.Agent.IPBan
38{ 39{
39 public class IPBanModule : IRegionModule 40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
41 public class IPBanModule : ISharedRegionModule
40 { 42 {
41 #region Implementation of IRegionModule 43 #region Implementation of ISharedRegionModule
42 44
43 private List<string> m_bans = new List<string>(); 45 private List<string> m_bans = new List<string>();
46 private Dictionary<Scene, SceneBanner> SceneBanners = new Dictionary<Scene, SceneBanner>();
44 47
45 public void Initialise(Scene scene, IConfigSource source) 48 public void Initialise(IConfigSource source)
46 { 49 {
47 new SceneBanner(scene, m_bans); 50 }
51
52 public void AddRegion(Scene scene)
53 {
54 SceneBanners.Add(scene, new SceneBanner(scene, m_bans));
48 55
49 lock (m_bans) 56 lock (m_bans)
50 { 57 {
51 foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans) 58 foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans)
52 { 59 {
53 if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) 60 if (!String.IsNullOrEmpty(ban.BannedHostIPMask))
54 m_bans.Add(ban.BannedHostIPMask); 61 m_bans.Add(ban.BannedHostIPMask);
55 if (!String.IsNullOrEmpty(ban.BannedHostNameMask)) 62 if (!String.IsNullOrEmpty(ban.BannedHostNameMask))
56 m_bans.Add(ban.BannedHostNameMask); 63 m_bans.Add(ban.BannedHostNameMask);
@@ -58,7 +65,12 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
58 } 65 }
59 } 66 }
60 67
61 public void PostInitialise() 68 public Type ReplaceableInterface
69 {
70 get { return null; }
71 }
72
73 public void RegionLoaded(Scene scene)
62 { 74 {
63 if (File.Exists("bans.txt")) 75 if (File.Exists("bans.txt"))
64 { 76 {
@@ -70,19 +82,23 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
70 } 82 }
71 } 83 }
72 84
73 public void Close() 85 public void RemoveRegion(Scene scene)
74 { 86 {
75 87 if(SceneBanners.ContainsKey(scene))
88 SceneBanners.Remove(scene);
76 } 89 }
77 90
78 public string Name 91 public void PostInitialise()
92 {
93 }
94
95 public void Close()
79 { 96 {
80 get { return "IPBanModule"; }
81 } 97 }
82 98
83 public bool IsSharedModule 99 public string Name
84 { 100 {
85 get { return true; } 101 get { return "IPBanModule"; }
86 } 102 }
87 103
88 #endregion 104 #endregion