One more module converted: IRCStackModule.
parent
ba2318bd61
commit
abef034d1b
|
@ -25,6 +25,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
@ -33,29 +34,65 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server;
|
using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server;
|
||||||
|
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
|
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 static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private IRCServer m_server;
|
private IRCServer m_server;
|
||||||
|
private int m_Port;
|
||||||
// private Scene m_scene;
|
// 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"] &&
|
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_Enabled = true;
|
||||||
// m_scene = scene;
|
m_Port = source.Configs["IRCd"].GetInt("Port", 6666);
|
||||||
m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), m_Port, scene);
|
||||||
m_server.OnNewIRCClient += m_server_OnNewIRCClient;
|
m_server.OnNewIRCClient += m_server_OnNewIRCClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "IRCClientStackModule"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type ReplaceableInterface
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
void m_server_OnNewIRCClient(IRCClientView user)
|
void m_server_OnNewIRCClient(IRCClientView user)
|
||||||
{
|
{
|
||||||
user.OnIRCReady += user_OnIRCReady;
|
user.OnIRCReady += user_OnIRCReady;
|
||||||
|
@ -68,26 +105,5 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
|
||||||
m_log.Info("[IRCd] Added user to Scene");
|
m_log.Info("[IRCd] Added user to Scene");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get { return "IRCClientStackModule"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue