* More IRCClientView fiddling. Now implements IClientAPI & IClientCore.
parent
ac80b6539f
commit
29bc2962ad
|
@ -1,39 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
|
||||
{
|
||||
class IRCStackModule : IRegionModule
|
||||
{
|
||||
private IRCServer m_server;
|
||||
private Scene m_scene;
|
||||
|
||||
#region Implementation of IRegionModule
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
m_scene = scene;
|
||||
m_server = new IRCServer(IPAddress.Parse("0.0.0.0"),6666, scene);
|
||||
m_server.OnNewIRCClient += m_server_OnNewIRCClient;
|
||||
}
|
||||
|
||||
void m_server_OnNewIRCClient(IRCClientView user)
|
||||
{
|
||||
m_scene.AddNewClient(user);
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { throw new System.NotImplementedException(); }
|
||||
get { return "IRCClientStackModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { throw new System.NotImplementedException(); }
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,20 +2,30 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
{
|
||||
public delegate void OnNewIRCUserDelegate(IRCClientView user);
|
||||
|
||||
/// <summary>
|
||||
/// Adam's completely hacked up not-probably-compliant RFC1459 server class.
|
||||
/// </summary>
|
||||
class IRCServer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public event OnNewIRCUserDelegate OnNewIRCClient;
|
||||
|
||||
private TcpListener m_listener;
|
||||
private Scene m_baseScene;
|
||||
private bool m_running = true;
|
||||
|
||||
public IRCServer(IPAddress listener, int port)
|
||||
public IRCServer(IPAddress listener, int port, Scene baseScene)
|
||||
{
|
||||
m_listener = new TcpListener(listener, port);
|
||||
|
||||
|
@ -23,6 +33,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
|
||||
Thread thread = new Thread(ListenLoop);
|
||||
thread.Start();
|
||||
m_baseScene = baseScene;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
|
@ -41,7 +52,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
|
||||
private void AcceptClient(TcpClient client)
|
||||
{
|
||||
|
||||
IRCClientView cv = new IRCClientView(client, m_baseScene);
|
||||
|
||||
if (OnNewIRCClient != null)
|
||||
OnNewIRCClient(cv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue