Adding RavenNetListener to support network raw API

This commit is contained in:
DarkFeather 2018-10-16 17:41:39 -05:00
parent 11da27e0c4
commit 5ec606e3b6
3 changed files with 10 additions and 4 deletions

View File

@ -10,7 +10,7 @@ clean:
test: compile test: compile
script -c "mono ./raven.mono -c raven-test.conf -v" ${pkgdir}/tmp/raven-test.log script -c "mono ./raven.mono -c raven-test.conf -v" ${pkgdir}/tmp/raven-test.log
install: compile /usr/sbin/pwgen install: compile
mkdir -p ${pkgdir}/opt mkdir -p ${pkgdir}/opt
cp raven.mono ${pkgdir}/opt/raven.mono cp raven.mono ${pkgdir}/opt/raven.mono
if [ ! -d ${CONFDIR} ]; then mkdir -p ${CONFDIR}; cp sample-confs/* ${CONFDIR}; fi if [ ! -d ${CONFDIR} ]; then mkdir -p ${CONFDIR}; cp sample-confs/* ${CONFDIR}; fi

View File

@ -8,8 +8,8 @@ arch=("x86_64")
url="https://aninix.net/foundation/TheRaven" url="https://aninix.net/foundation/TheRaven"
license=('custom') license=('custom')
groups=() groups=()
depends=('mono>=5.0.0' 'curl' 'grep' 'bash>=4.4' 'git>=2.13' 'pushbullet-cli' 'lynx' 'wget') depends=('mono>=5.0.0' 'curl' 'grep' 'bash>=4.4' 'git>=2.13' 'pushbullet-cli' 'lynx' 'wget' 'nmap>=7.70')
makedepends=('make>=4.2') makedepends=('make>=4.2' 'pwgen')
checkdepends=() checkdepends=()
optdepends=() optdepends=()
provides=('theraven') provides=('theraven')

View File

@ -39,6 +39,8 @@ namespace AniNIX.TheRaven {
public Dictionary<String,int> MailerCount = new Dictionary<String,int>(); // Messages may only be sent up to a maximum to the admins. public Dictionary<String,int> MailerCount = new Dictionary<String,int>(); // Messages may only be sent up to a maximum to the admins.
private RavenNetListener _netListener;
/// <summary> /// <summary>
/// Show the settings used by this Raven. /// Show the settings used by this Raven.
/// </summary> /// </summary>
@ -77,6 +79,7 @@ namespace AniNIX.TheRaven {
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"]);
channels=new List<String>(); channels=new List<String>();
foreach (String channel in conf.ReadSectionLines("Rooms")) { foreach (String channel in conf.ReadSectionLines("Rooms")) {
@ -160,7 +163,7 @@ namespace AniNIX.TheRaven {
//TODO Add helptext //TODO Add helptext
break; break;
case "-c": case "-c":
if (i < args.Length-1) _configFile = String.Format("/usr/local/etc/TheRaven/{0}",args[++i]); if (i < args.Length-1) _configFile = args[++i];
break; break;
case "--version": case "--version":
ReportMessage.Log(Verbosity.Always,"AniNIX::TheRaven version 0.2"); ReportMessage.Log(Verbosity.Always,"AniNIX::TheRaven version 0.2");
@ -249,6 +252,9 @@ namespace AniNIX.TheRaven {
/// </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 trafffic 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
while (true) { while (true) {
IRCServerMessage response = _connection.Read(); IRCServerMessage response = _connection.Read();
if (response != null && response.message != null && response.message.Length > 3 && response.message.Substring(0,2).Equals("r.")) { if (response != null && response.message != null && response.message.Length > 3 && response.message.Substring(0,2).Equals("r.")) {