From abef034d1b4f3553384b43b33da2b6993d6437b6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 16:10:47 -0800 Subject: One more module converted: IRCStackModule. --- .../InternetRelayClientView/IRCStackModule.cs | 54 ++++++++++++++-------- 1 file changed, 35 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs index cfe1278..406b715 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Net; using System.Reflection; using log4net; @@ -33,49 +34,51 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server; +using Mono.Addins; + namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView { - public class IRCStackModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "IRCStackModule")] + public class IRCStackModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IRCServer m_server; + private int m_Port; // private Scene m_scene; + private bool m_Enabled; - #region Implementation of IRegionModule + #region Implementation of INonSharedRegionModule - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { if (null != source.Configs["IRCd"] && - source.Configs["IRCd"].GetBoolean("Enabled",false)) + source.Configs["IRCd"].GetBoolean("Enabled", false)) { - int portNo = source.Configs["IRCd"].GetInt("Port",6666); -// m_scene = scene; - m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene); - m_server.OnNewIRCClient += m_server_OnNewIRCClient; + m_Enabled = true; + m_Port = source.Configs["IRCd"].GetInt("Port", 6666); } } - void m_server_OnNewIRCClient(IRCClientView user) + public void AddRegion(Scene scene) { - user.OnIRCReady += user_OnIRCReady; + if (!m_Enabled) + return; + + m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), m_Port, scene); + m_server.OnNewIRCClient += m_server_OnNewIRCClient; } - void user_OnIRCReady(IRCClientView cv) + public void RegionLoaded(Scene scene) { - m_log.Info("[IRCd] Adding user..."); - cv.Start(); - m_log.Info("[IRCd] Added user to Scene"); } - public void PostInitialise() + public void RemoveRegion(Scene scene) { - } public void Close() { - } public string Name @@ -83,11 +86,24 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView get { return "IRCClientStackModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return false; } + get { return null; } } #endregion + + void m_server_OnNewIRCClient(IRCClientView user) + { + user.OnIRCReady += user_OnIRCReady; + } + + void user_OnIRCReady(IRCClientView cv) + { + m_log.Info("[IRCd] Adding user..."); + cv.Start(); + m_log.Info("[IRCd] Added user to Scene"); + } + } } -- cgit v1.1