IRC protocol implementation for Orion IRC Server
$ dotnet add package Orion.Irc.Core
IRC protocol implementation for the Orion IRC Server project.
IRC is not dead, long live IRC!
Orion.Irc.Core provides a comprehensive implementation of the IRC protocol for building IRC servers and clients. This library handles parsing, formatting, and validating IRC messages according to RFC standards, offering a clean object-oriented approach to working with the protocol.
dotnet add package Orion.Irc.Core
Or using the Package Manager Console:
Install-Package Orion.Irc.Core
Orion.Irc.Core implements numerous IRC commands including:
using Orion.Irc.Core.Interfaces.Commands;
using Orion.Irc.Core.Interfaces.Parser;
using Orion.Irc.Core.Services;
// Create a parser
IIrcCommandParser parser = new IrcCommandParser(loggerFactory.CreateLogger<IrcCommandParser>());
// Register command handlers
parser.RegisterCommand<JoinCommand>();
parser.RegisterCommand<NickCommand>();
parser.RegisterCommand<UserCommand>();
// Parse a message
string message = ":nick!user@host JOIN #channel";
IIrcCommand command = await parser.ParseAsync(message);
// Cast to specific command type
if (command is JoinCommand joinCommand)
{
Console.WriteLine($"User {joinCommand.Source} joined {joinCommand.Channels[0].ChannelName}");
}using Orion.Irc.Core.Commands;
using Orion.Irc.Core.Data.Channels;
// Create a JOIN command
var joinCommand = new JoinCommand
{
Channels = new List<JoinChannelData>
{
new JoinChannelData("#orion"),
new JoinChannelData("#testing", "password")
}
};
// Serialize to string
string message = joinCommand.Write();
// Result: "JOIN #orion,#testing password"
// Create a KICK command
var kickCommand = KickCommand.Create("server.name", "#channel", "baduser", "Violated rules");
// Serialize
string kickMessage = kickCommand.Write();
// Result: ":server.name KICK #channel baduser :Violated rules"using Orion.Irc.Core.Commands.Replies;
// Create a welcome message (RPL_WELCOME - 001)
var welcome = RplWelcome.Create(
"irc.server.name",
"nickname",
"Welcome to the Orion IRC Network, nickname!user@host"
);
// Serialize
string welcomeMessage = welcome.Write();
// Result: ":irc.server.name 001 nickname :Welcome to the Orion IRC Network, nickname!user@host"Orion.Irc.Core is designed with a clean, modular architecture:
This project is licensed under the MIT License - see the LICENSE file for details.