aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Agent
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Agent')
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs54
1 files changed, 35 insertions, 19 deletions
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 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Net; 29using System.Net;
29using System.Reflection; 30using System.Reflection;
30using log4net; 31using log4net;
@@ -33,49 +34,51 @@ using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server; 35using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server;
35 36
37using Mono.Addins;
38
36namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView 39namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
37{ 40{
38 public class IRCStackModule : IRegionModule 41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "IRCStackModule")]
42 public class IRCStackModule : INonSharedRegionModule
39 { 43 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 45
42 private IRCServer m_server; 46 private IRCServer m_server;
47 private int m_Port;
43// private Scene m_scene; 48// private Scene m_scene;
49 private bool m_Enabled;
44 50
45 #region Implementation of IRegionModule 51 #region Implementation of INonSharedRegionModule
46 52
47 public void Initialise(Scene scene, IConfigSource source) 53 public void Initialise(IConfigSource source)
48 { 54 {
49 if (null != source.Configs["IRCd"] && 55 if (null != source.Configs["IRCd"] &&
50 source.Configs["IRCd"].GetBoolean("Enabled",false)) 56 source.Configs["IRCd"].GetBoolean("Enabled", false))
51 { 57 {
52 int portNo = source.Configs["IRCd"].GetInt("Port",6666); 58 m_Enabled = true;
53// m_scene = scene; 59 m_Port = source.Configs["IRCd"].GetInt("Port", 6666);
54 m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene);
55 m_server.OnNewIRCClient += m_server_OnNewIRCClient;
56 } 60 }
57 } 61 }
58 62
59 void m_server_OnNewIRCClient(IRCClientView user) 63 public void AddRegion(Scene scene)
60 { 64 {
61 user.OnIRCReady += user_OnIRCReady; 65 if (!m_Enabled)
66 return;
67
68 m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), m_Port, scene);
69 m_server.OnNewIRCClient += m_server_OnNewIRCClient;
62 } 70 }
63 71
64 void user_OnIRCReady(IRCClientView cv) 72 public void RegionLoaded(Scene scene)
65 { 73 {
66 m_log.Info("[IRCd] Adding user...");
67 cv.Start();
68 m_log.Info("[IRCd] Added user to Scene");
69 } 74 }
70 75
71 public void PostInitialise() 76 public void RemoveRegion(Scene scene)
72 { 77 {
73
74 } 78 }
75 79
76 public void Close() 80 public void Close()
77 { 81 {
78
79 } 82 }
80 83
81 public string Name 84 public string Name
@@ -83,11 +86,24 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
83 get { return "IRCClientStackModule"; } 86 get { return "IRCClientStackModule"; }
84 } 87 }
85 88
86 public bool IsSharedModule 89 public Type ReplaceableInterface
87 { 90 {
88 get { return false; } 91 get { return null; }
89 } 92 }
90 93
91 #endregion 94 #endregion
95
96 void m_server_OnNewIRCClient(IRCClientView user)
97 {
98 user.OnIRCReady += user_OnIRCReady;
99 }
100
101 void user_OnIRCReady(IRCClientView cv)
102 {
103 m_log.Info("[IRCd] Adding user...");
104 cv.Start();
105 m_log.Info("[IRCd] Added user to Scene");
106 }
107
92 } 108 }
93} 109}