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> whitelist; //This is the list of admin users.
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
public List<String> 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<String,String> loginDefaults = conf.ReadSection("Login");
Dictionary<String,String> 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<String>();
foreach (String channel in conf.ReadSectionLines("Rooms")) {
@ -268,7 +269,7 @@ namespace AniNIX.TheRaven {
/// Read from the connection, and for each message act appropriately.
/// </summary>
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

View File

@ -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;
}
}
}

View File

@ -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