diff --git a/Raven.csharp b/Raven.csharp index 44d79b5..a9828e8 100644 --- a/Raven.csharp +++ b/Raven.csharp @@ -26,7 +26,7 @@ namespace AniNIX.TheRaven { public List channels; //This is the list of channels to join public List whitelist; //This is the list of admin users. public List blacklist; // This is the list of blocked people. - public String helpText = "Available commands are r.d , r.heartbeat, r.magic8, r.math , r.msg , r.raven, r.searches, r.tinyurl , r.wikidiff \"one\" \"other\", and r.uptime"; + public String helpText = "Available commands are r.d , r.magic8, r.math , r.msg , r.raven, r.searches, r.tinyurl , r.wikidiff \"one\" \"other\", and r.uptime"; // This is the text to send when people ask for help -- this is configurable to allow for skinning public List searches; //These are the searches public String searchesIndex; //This is the helptext for the searches @@ -75,11 +75,12 @@ namespace AniNIX.TheRaven { ReportMessage.Log(Verbosity.Verbose,"Reading login info"); try { Dictionary loginDefaults = conf.ReadSection("Login"); + Dictionary apiDefaults = conf.ReadSection("API"); this.Host = loginDefaults["host"]; this.Port = Int32.Parse(loginDefaults["port"]); this.Nick = loginDefaults["username"]; this._nickServPass = loginDefaults["password"]; - this._netListener = new RavenNetListener(loginDefaults["password"]); + this._netListener = new RavenNetListener(apiDefaults["password"],Int32.Parse(apiDefaults["port"])); channels=new List(); foreach (String channel in conf.ReadSectionLines("Rooms")) { @@ -268,7 +269,7 @@ namespace AniNIX.TheRaven { /// Read from the connection, and for each message act appropriately. /// public void LoopOnTraffic() { - ReportMessage.Log(Verbosity.Verbose,"Looping on trafffic now! We're useful!"); + ReportMessage.Log(Verbosity.Verbose,"Looping on traffic now! We're useful!"); // Start a network listener to allow relaying traffic via ncat into IRCd. this._netListener.NetListener(this._connection); // Loop on main connect to ircd diff --git a/RavenNetListener.csharp b/RavenNetListener.csharp index 5456407..cd68995 100644 --- a/RavenNetListener.csharp +++ b/RavenNetListener.csharp @@ -13,6 +13,7 @@ namespace AniNIX.TheRaven { public class RavenNetListener { private String _key; + private int _port; private Connection _ircdConnection; private void _RavenSend(Connection ircdConnection, String channel, String message) { @@ -26,9 +27,9 @@ namespace AniNIX.TheRaven { while (true) { try { - // Open a new listener on localhost port 9501 - IPAddress ipAddress = IPAddress.Parse("127.0.0.1"); - TcpListener listener = new TcpListener(ipAddress, 9501); + // Open a new listener on port + IPAddress ipAddress = IPAddress.Parse("0.0.0.0"); + TcpListener listener = new TcpListener(ipAddress, this._port ); listener.Start(); // Accept all connections while (true) @@ -40,6 +41,7 @@ namespace AniNIX.TheRaven { string received = ""; for (int i = 0; i < size; i++) received += Convert.ToChar(data[i]); + ReportMessage.Log(Verbosity.Verbose,String.Format("RavenNetListener received: [{0}]",received)); String[] bySpace = received.Split(' '); // If the key matches, ... if (this._key.Equals(bySpace[0])) { @@ -73,8 +75,9 @@ namespace AniNIX.TheRaven { ReportMessage.Log(Verbosity.Verbose,"Started."); } - public RavenNetListener(String key) { + public RavenNetListener(String key, int port) { this._key = key; + this._port = port; } } } diff --git a/sample-confs/sample.conf b/sample-confs/sample.conf index ea919b6..598d361 100644 --- a/sample-confs/sample.conf +++ b/sample-confs/sample.conf @@ -1,18 +1,22 @@ [ Login ] host=localhost port=6667 -username=TheRaven +username=TheRavenTest password=password +[ API ] +port=9902 +password=sample + [ Whitelist ] -Admin +DarkFeather [ Blacklist ] [ Notifications ] [ Rooms ] -TheRaven +test123 [ Searches ] r.google|http://google.com/search?q=|+|Google