feat: Implement IRC Gateway Service and related functionality

- Add IrcGatewayService to handle IRC connections and commands.
- Create IrcMessage class for parsing IRC protocol lines.
- Implement IrcMessageFormatter for formatting messages as IRC lines.
- Define IrcNumericReply constants for IRC numeric replies.
- Add IrcOptions class for configuration settings related to IRC.
- Create IrcServiceExtensions for adding IRC services to the application.
- Refactor ChannelsController to use IChatService for broadcasting messages and channel updates.
- Update ChatHub to utilize IChatService for user connection and message handling.
- Introduce ChatService to manage chat-related operations and interactions.
- Implement SignalRBroadcaster for broadcasting messages to SignalR clients.
- Update PresenceTracker to retrieve usernames for connections.
- Modify appsettings.example.json to include IRC configuration options.
- Update solution file to include the new IRC project.
This commit is contained in:
HueByte
2026-02-19 11:31:20 +01:00
parent da7c16d5d0
commit cb6b9d1e55
21 changed files with 1706 additions and 215 deletions
@@ -0,0 +1,26 @@
using EchoHub.Core.Contracts;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace EchoHub.Server.Irc;
public static class IrcServiceExtensions
{
public static WebApplicationBuilder AddIrcGateway(this WebApplicationBuilder builder)
{
builder.Services.Configure<IrcOptions>(
builder.Configuration.GetSection(IrcOptions.SectionName));
if (builder.Configuration.GetValue<bool>("Irc:Enabled"))
{
builder.Services.AddSingleton<IrcGatewayService>();
builder.Services.AddSingleton<IChatBroadcaster>(sp =>
new IrcBroadcaster(sp.GetRequiredService<IrcGatewayService>()));
builder.Services.AddHostedService(sp =>
sp.GetRequiredService<IrcGatewayService>());
}
return builder;
}
}