TheRaven/IRCServerMessage.csharp

66 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

Converting to Git. Bazaar log was: ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Thu 2016-06-02 23:21:56 -0500 message: Updating to include dedicated raven user. Adding RavenExecute.Command() static function to handle OS integration. Updating RavenCommand to use Djinni package for mailing. ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Wed 2016-04-20 16:59:51 -0500 message: Updated Makefile to include OS dependencies Updated ircservermessage to fix dropped sections of searches from things like "r.image :blar:" Added new tinyURL feature -- WARNING: this requires that the OS has a script api-keys in the path that will return an API key for the TinyURL service ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Mon 2016-03-28 14:40:00 -0500 message: MailerCount is now added to limit the number of pages sent to admins. ------------------------------------------------------------ revno: 3 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Fri 2016-01-15 14:36:54 -0600 message: Removing an unneeded file -- requests are tracked in keep.google.com now Makefile had a run rule added to run the bot in the foreground with the verbose flag. This prevents the user from accidentally compiling and installing TheRaven with higher verbosity and filling system logs. Ravencommand was modified to check for user modes r (registerd on UnrealIRCd) or G (registered on InspIRCd) before running whitelist commands. connection.csharp had functions added to check for users being authenticated (IRC response code 330 in a WHOIS request) and do get modes ------------------------------------------------------------ revno: 2 committer: root <root@aninix.net> branch nick: TheRaven timestamp: Mon 2015-12-14 14:58:02 -0600 message: Updated commenting Removed requests file in favor of keep.google.com Updated ircservermessage.csharp et. al. for better verbosity options Edited connection.csharp to not need a Raven instance and instead take host and port Updated private globals to standard Moved Verbosity enum to not be inside ReportMessage class ------------------------------------------------------------ revno: 1 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Thu 2015-12-10 21:58:41 -0600 message: Adding all my files.
2016-08-04 11:08:14 -05:00
using System;
using System.Text.RegularExpressions;
Converting to Git. Bazaar log was: ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Thu 2016-06-02 23:21:56 -0500 message: Updating to include dedicated raven user. Adding RavenExecute.Command() static function to handle OS integration. Updating RavenCommand to use Djinni package for mailing. ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Wed 2016-04-20 16:59:51 -0500 message: Updated Makefile to include OS dependencies Updated ircservermessage to fix dropped sections of searches from things like "r.image :blar:" Added new tinyURL feature -- WARNING: this requires that the OS has a script api-keys in the path that will return an API key for the TinyURL service ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Mon 2016-03-28 14:40:00 -0500 message: MailerCount is now added to limit the number of pages sent to admins. ------------------------------------------------------------ revno: 3 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Fri 2016-01-15 14:36:54 -0600 message: Removing an unneeded file -- requests are tracked in keep.google.com now Makefile had a run rule added to run the bot in the foreground with the verbose flag. This prevents the user from accidentally compiling and installing TheRaven with higher verbosity and filling system logs. Ravencommand was modified to check for user modes r (registerd on UnrealIRCd) or G (registered on InspIRCd) before running whitelist commands. connection.csharp had functions added to check for users being authenticated (IRC response code 330 in a WHOIS request) and do get modes ------------------------------------------------------------ revno: 2 committer: root <root@aninix.net> branch nick: TheRaven timestamp: Mon 2015-12-14 14:58:02 -0600 message: Updated commenting Removed requests file in favor of keep.google.com Updated ircservermessage.csharp et. al. for better verbosity options Edited connection.csharp to not need a Raven instance and instead take host and port Updated private globals to standard Moved Verbosity enum to not be inside ReportMessage class ------------------------------------------------------------ revno: 1 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Thu 2015-12-10 21:58:41 -0600 message: Adding all my files.
2016-08-04 11:08:14 -05:00
using System.Collections.Generic;
using AniNIX.Shared;
Converting to Git. Bazaar log was: ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Thu 2016-06-02 23:21:56 -0500 message: Updating to include dedicated raven user. Adding RavenExecute.Command() static function to handle OS integration. Updating RavenCommand to use Djinni package for mailing. ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Wed 2016-04-20 16:59:51 -0500 message: Updated Makefile to include OS dependencies Updated ircservermessage to fix dropped sections of searches from things like "r.image :blar:" Added new tinyURL feature -- WARNING: this requires that the OS has a script api-keys in the path that will return an API key for the TinyURL service ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Mon 2016-03-28 14:40:00 -0500 message: MailerCount is now added to limit the number of pages sent to admins. ------------------------------------------------------------ revno: 3 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Fri 2016-01-15 14:36:54 -0600 message: Removing an unneeded file -- requests are tracked in keep.google.com now Makefile had a run rule added to run the bot in the foreground with the verbose flag. This prevents the user from accidentally compiling and installing TheRaven with higher verbosity and filling system logs. Ravencommand was modified to check for user modes r (registerd on UnrealIRCd) or G (registered on InspIRCd) before running whitelist commands. connection.csharp had functions added to check for users being authenticated (IRC response code 330 in a WHOIS request) and do get modes ------------------------------------------------------------ revno: 2 committer: root <root@aninix.net> branch nick: TheRaven timestamp: Mon 2015-12-14 14:58:02 -0600 message: Updated commenting Removed requests file in favor of keep.google.com Updated ircservermessage.csharp et. al. for better verbosity options Edited connection.csharp to not need a Raven instance and instead take host and port Updated private globals to standard Moved Verbosity enum to not be inside ReportMessage class ------------------------------------------------------------ revno: 1 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Thu 2015-12-10 21:58:41 -0600 message: Adding all my files.
2016-08-04 11:08:14 -05:00
namespace AniNIX.TheRaven {
//IRC messages are a primitive data type for us to use.
public class IRCServerMessage : IRCMessage {
public string user { get; protected set; }
public string server { get; protected set; }
public string msgCode { get; protected set; }
public string target { get; protected set; }
public string message { get; protected set; }
// Adding whitelist for default Discord-Bridge config
private string _discordRegex = "\\<.+\\>\\s+";
Converting to Git. Bazaar log was: ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Thu 2016-06-02 23:21:56 -0500 message: Updating to include dedicated raven user. Adding RavenExecute.Command() static function to handle OS integration. Updating RavenCommand to use Djinni package for mailing. ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Wed 2016-04-20 16:59:51 -0500 message: Updated Makefile to include OS dependencies Updated ircservermessage to fix dropped sections of searches from things like "r.image :blar:" Added new tinyURL feature -- WARNING: this requires that the OS has a script api-keys in the path that will return an API key for the TinyURL service ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Mon 2016-03-28 14:40:00 -0500 message: MailerCount is now added to limit the number of pages sent to admins. ------------------------------------------------------------ revno: 3 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Fri 2016-01-15 14:36:54 -0600 message: Removing an unneeded file -- requests are tracked in keep.google.com now Makefile had a run rule added to run the bot in the foreground with the verbose flag. This prevents the user from accidentally compiling and installing TheRaven with higher verbosity and filling system logs. Ravencommand was modified to check for user modes r (registerd on UnrealIRCd) or G (registered on InspIRCd) before running whitelist commands. connection.csharp had functions added to check for users being authenticated (IRC response code 330 in a WHOIS request) and do get modes ------------------------------------------------------------ revno: 2 committer: root <root@aninix.net> branch nick: TheRaven timestamp: Mon 2015-12-14 14:58:02 -0600 message: Updated commenting Removed requests file in favor of keep.google.com Updated ircservermessage.csharp et. al. for better verbosity options Edited connection.csharp to not need a Raven instance and instead take host and port Updated private globals to standard Moved Verbosity enum to not be inside ReportMessage class ------------------------------------------------------------ revno: 1 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Thu 2015-12-10 21:58:41 -0600 message: Adding all my files.
2016-08-04 11:08:14 -05:00
public IRCServerMessage(String serverString) {
incomingIRCString = serverString.Trim();
try {
String[] byColon = incomingIRCString.Split(':');
user = byColon[0];
String[] bySpace = byColon[1].Split(' ');
List<String> messageL = new List<String>(byColon);
messageL.RemoveAt(0);
messageL.RemoveAt(0);
message = String.Join(":",messageL.ToArray());
message = Regex.Replace(message,_discordRegex,"");
Converting to Git. Bazaar log was: ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Thu 2016-06-02 23:21:56 -0500 message: Updating to include dedicated raven user. Adding RavenExecute.Command() static function to handle OS integration. Updating RavenCommand to use Djinni package for mailing. ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Wed 2016-04-20 16:59:51 -0500 message: Updated Makefile to include OS dependencies Updated ircservermessage to fix dropped sections of searches from things like "r.image :blar:" Added new tinyURL feature -- WARNING: this requires that the OS has a script api-keys in the path that will return an API key for the TinyURL service ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Mon 2016-03-28 14:40:00 -0500 message: MailerCount is now added to limit the number of pages sent to admins. ------------------------------------------------------------ revno: 3 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Fri 2016-01-15 14:36:54 -0600 message: Removing an unneeded file -- requests are tracked in keep.google.com now Makefile had a run rule added to run the bot in the foreground with the verbose flag. This prevents the user from accidentally compiling and installing TheRaven with higher verbosity and filling system logs. Ravencommand was modified to check for user modes r (registerd on UnrealIRCd) or G (registered on InspIRCd) before running whitelist commands. connection.csharp had functions added to check for users being authenticated (IRC response code 330 in a WHOIS request) and do get modes ------------------------------------------------------------ revno: 2 committer: root <root@aninix.net> branch nick: TheRaven timestamp: Mon 2015-12-14 14:58:02 -0600 message: Updated commenting Removed requests file in favor of keep.google.com Updated ircservermessage.csharp et. al. for better verbosity options Edited connection.csharp to not need a Raven instance and instead take host and port Updated private globals to standard Moved Verbosity enum to not be inside ReportMessage class ------------------------------------------------------------ revno: 1 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Thu 2015-12-10 21:58:41 -0600 message: Adding all my files.
2016-08-04 11:08:14 -05:00
if (bySpace[0].Contains("!")) {
String[] byExclamation = bySpace[0].Split('!');
user = byExclamation[0];
server = byExclamation[1];
} else {
user = null;
server = bySpace[0];
}
msgCode = bySpace[1];
target = bySpace[2];
} catch (IndexOutOfRangeException e) {
ReportMessage.Log(Verbosity.Error,String.Format("!!! Can't translate string:\n{0}",serverString,e.ToString()));
user = null;
server = null;
msgCode = null;
target = null;
message = null;
}
}
// There is no outgoing string.
public new string GetOutgoingIRCString() {
return null;
}
public override string ToString() {
if (ReportMessage.verbosity == Verbosity.Explicit) {
Converting to Git. Bazaar log was: ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Thu 2016-06-02 23:21:56 -0500 message: Updating to include dedicated raven user. Adding RavenExecute.Command() static function to handle OS integration. Updating RavenCommand to use Djinni package for mailing. ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Wed 2016-04-20 16:59:51 -0500 message: Updated Makefile to include OS dependencies Updated ircservermessage to fix dropped sections of searches from things like "r.image :blar:" Added new tinyURL feature -- WARNING: this requires that the OS has a script api-keys in the path that will return an API key for the TinyURL service ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: TheRaven timestamp: Mon 2016-03-28 14:40:00 -0500 message: MailerCount is now added to limit the number of pages sent to admins. ------------------------------------------------------------ revno: 3 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Fri 2016-01-15 14:36:54 -0600 message: Removing an unneeded file -- requests are tracked in keep.google.com now Makefile had a run rule added to run the bot in the foreground with the verbose flag. This prevents the user from accidentally compiling and installing TheRaven with higher verbosity and filling system logs. Ravencommand was modified to check for user modes r (registerd on UnrealIRCd) or G (registered on InspIRCd) before running whitelist commands. connection.csharp had functions added to check for users being authenticated (IRC response code 330 in a WHOIS request) and do get modes ------------------------------------------------------------ revno: 2 committer: root <root@aninix.net> branch nick: TheRaven timestamp: Mon 2015-12-14 14:58:02 -0600 message: Updated commenting Removed requests file in favor of keep.google.com Updated ircservermessage.csharp et. al. for better verbosity options Edited connection.csharp to not need a Raven instance and instead take host and port Updated private globals to standard Moved Verbosity enum to not be inside ReportMessage class ------------------------------------------------------------ revno: 1 committer: ircd <ircd@aninix.net> branch nick: TheRaven timestamp: Thu 2015-12-10 21:58:41 -0600 message: Adding all my files.
2016-08-04 11:08:14 -05:00
return String.Format(">>> {0}\nUser: {1}\nServer: {2}\nmsgCode: {3}\nTarget: {4}\nMessage: {5}\n",incomingIRCString,user,server,msgCode,target,message);
} else {
return String.Format(">>> {0}",incomingIRCString);
}
}
}
}