r.ip #7

Open
DarkFeather wants to merge 10 commits from r.ip into main
3 changed files with 18 additions and 10 deletions
Showing only changes of commit 24825cced3 - Show all commits

View File

@ -26,7 +26,7 @@ namespace AniNIX.TheRaven {
public List<String> channels; //This is the list of channels to join public List<String> channels; //This is the list of channels to join
public List<String> whitelist; //This is the list of admin users. public List<String> whitelist; //This is the list of admin users.
public List<String> blacklist; // This is the list of blocked people. public List<String> blacklist; // This is the list of blocked people.
public String helpText = "Available commands are r.d <dice test>, r.heartbeat, r.magic8, r.math <math problem>, r.msg <memo for admin>, r.raven, r.searches, r.tinyurl <url>, r.wikidiff \"one\" \"other\", and r.uptime"; public String helpText = "Available commands are r.d <dice test>, r.magic8, r.math <math problem>, r.msg <memo for admin>, r.raven, r.searches, r.tinyurl <url>, 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 // This is the text to send when people ask for help -- this is configurable to allow for skinning
public List<String> searches; //These are the searches public List<String> searches; //These are the searches
public String searchesIndex; //This is the helptext for 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"); ReportMessage.Log(Verbosity.Verbose,"Reading login info");
try { try {
Dictionary<String,String> loginDefaults = conf.ReadSection("Login"); Dictionary<String,String> loginDefaults = conf.ReadSection("Login");
Dictionary<String,String> apiDefaults = conf.ReadSection("API");
this.Host = loginDefaults["host"]; this.Host = loginDefaults["host"];
this.Port = Int32.Parse(loginDefaults["port"]); this.Port = Int32.Parse(loginDefaults["port"]);
this.Nick = loginDefaults["username"]; this.Nick = loginDefaults["username"];
this._nickServPass = loginDefaults["password"]; this._nickServPass = loginDefaults["password"];
this._netListener = new RavenNetListener(loginDefaults["password"]); this._netListener = new RavenNetListener(apiDefaults["password"],Int32.Parse(apiDefaults["port"]));
channels=new List<String>(); channels=new List<String>();
foreach (String channel in conf.ReadSectionLines("Rooms")) { foreach (String channel in conf.ReadSectionLines("Rooms")) {
@ -268,7 +269,7 @@ namespace AniNIX.TheRaven {
/// Read from the connection, and for each message act appropriately. /// Read from the connection, and for each message act appropriately.
/// </summary> /// </summary>
public void LoopOnTraffic() { 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. // Start a network listener to allow relaying traffic via ncat into IRCd.
this._netListener.NetListener(this._connection); this._netListener.NetListener(this._connection);
// Loop on main connect to ircd // Loop on main connect to ircd

View File

@ -13,6 +13,7 @@ namespace AniNIX.TheRaven {
public class RavenNetListener { public class RavenNetListener {
private String _key; private String _key;
private int _port;
private Connection _ircdConnection; private Connection _ircdConnection;
private void _RavenSend(Connection ircdConnection, String channel, String message) { private void _RavenSend(Connection ircdConnection, String channel, String message) {
@ -26,9 +27,9 @@ namespace AniNIX.TheRaven {
while (true) { while (true) {
try try
{ {
// Open a new listener on localhost port 9501 // Open a new listener on port
IPAddress ipAddress = IPAddress.Parse("127.0.0.1"); IPAddress ipAddress = IPAddress.Parse("0.0.0.0");
TcpListener listener = new TcpListener(ipAddress, 9501); TcpListener listener = new TcpListener(ipAddress, this._port );
listener.Start(); listener.Start();
// Accept all connections // Accept all connections
while (true) while (true)
@ -40,6 +41,7 @@ namespace AniNIX.TheRaven {
string received = ""; string received = "";
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
received += Convert.ToChar(data[i]); received += Convert.ToChar(data[i]);
ReportMessage.Log(Verbosity.Verbose,String.Format("RavenNetListener received: [{0}]",received));
String[] bySpace = received.Split(' '); String[] bySpace = received.Split(' ');
// If the key matches, ... // If the key matches, ...
if (this._key.Equals(bySpace[0])) { if (this._key.Equals(bySpace[0])) {
@ -73,8 +75,9 @@ namespace AniNIX.TheRaven {
ReportMessage.Log(Verbosity.Verbose,"Started."); ReportMessage.Log(Verbosity.Verbose,"Started.");
} }
public RavenNetListener(String key) { public RavenNetListener(String key, int port) {
this._key = key; this._key = key;
this._port = port;
} }
} }
} }

View File

@ -1,18 +1,22 @@
[ Login ] [ Login ]
host=localhost host=localhost
port=6667 port=6667
username=TheRaven username=TheRavenTest
password=password password=password
[ API ]
port=9902
password=sample
[ Whitelist ] [ Whitelist ]
Admin DarkFeather
[ Blacklist ] [ Blacklist ]
[ Notifications ] [ Notifications ]
[ Rooms ] [ Rooms ]
TheRaven test123
[ Searches ] [ Searches ]
r.google|http://google.com/search?q=|+|Google r.google|http://google.com/search?q=|+|Google