diff options
Update svn properties.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index b8f5afa..612ac48 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | |||
@@ -1,61 +1,61 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Net; | 3 | using System.Net; |
4 | using System.Net.Sockets; | 4 | using System.Net.Sockets; |
5 | using System.Reflection; | 5 | using System.Reflection; |
6 | using System.Text; | 6 | using System.Text; |
7 | using System.Threading; | 7 | using System.Threading; |
8 | using log4net; | 8 | using log4net; |
9 | using OpenSim.Region.Framework.Scenes; | 9 | using OpenSim.Region.Framework.Scenes; |
10 | 10 | ||
11 | namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | 11 | namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server |
12 | { | 12 | { |
13 | public delegate void OnNewIRCUserDelegate(IRCClientView user); | 13 | public delegate void OnNewIRCUserDelegate(IRCClientView user); |
14 | 14 | ||
15 | /// <summary> | 15 | /// <summary> |
16 | /// Adam's completely hacked up not-probably-compliant RFC1459 server class. | 16 | /// Adam's completely hacked up not-probably-compliant RFC1459 server class. |
17 | /// </summary> | 17 | /// </summary> |
18 | class IRCServer | 18 | class IRCServer |
19 | { | 19 | { |
20 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 20 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
21 | 21 | ||
22 | public event OnNewIRCUserDelegate OnNewIRCClient; | 22 | public event OnNewIRCUserDelegate OnNewIRCClient; |
23 | 23 | ||
24 | private readonly TcpListener m_listener; | 24 | private readonly TcpListener m_listener; |
25 | private readonly Scene m_baseScene; | 25 | private readonly Scene m_baseScene; |
26 | private bool m_running = true; | 26 | private bool m_running = true; |
27 | 27 | ||
28 | public IRCServer(IPAddress listener, int port, Scene baseScene) | 28 | public IRCServer(IPAddress listener, int port, Scene baseScene) |
29 | { | 29 | { |
30 | m_listener = new TcpListener(listener, port); | 30 | m_listener = new TcpListener(listener, port); |
31 | 31 | ||
32 | m_listener.Start(50); | 32 | m_listener.Start(50); |
33 | 33 | ||
34 | Thread thread = new Thread(ListenLoop); | 34 | Thread thread = new Thread(ListenLoop); |
35 | thread.Start(); | 35 | thread.Start(); |
36 | m_baseScene = baseScene; | 36 | m_baseScene = baseScene; |
37 | } | 37 | } |
38 | 38 | ||
39 | public void Stop() | 39 | public void Stop() |
40 | { | 40 | { |
41 | m_running = false; | 41 | m_running = false; |
42 | m_listener.Stop(); | 42 | m_listener.Stop(); |
43 | } | 43 | } |
44 | 44 | ||
45 | private void ListenLoop() | 45 | private void ListenLoop() |
46 | { | 46 | { |
47 | while(m_running) | 47 | while(m_running) |
48 | { | 48 | { |
49 | AcceptClient(m_listener.AcceptTcpClient()); | 49 | AcceptClient(m_listener.AcceptTcpClient()); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | private void AcceptClient(TcpClient client) | 53 | private void AcceptClient(TcpClient client) |
54 | { | 54 | { |
55 | IRCClientView cv = new IRCClientView(client, m_baseScene); | 55 | IRCClientView cv = new IRCClientView(client, m_baseScene); |
56 | 56 | ||
57 | if (OnNewIRCClient != null) | 57 | if (OnNewIRCClient != null) |
58 | OnNewIRCClient(cv); | 58 | OnNewIRCClient(cv); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | } | 61 | } |