mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 08:36:11 +02:00
feat: enhance profile editing with avatar support and UI adjustments
- Added AvatarPath to ProfileEditResult for user profile updates. - Updated ProfileEditDialog to include avatar selection with a browse button. - Increased dialog height to accommodate new avatar input fields. - Implemented avatar file path handling in the profile edit dialog. feat: introduce moderation features and user roles - Added ServerRole enum to define user roles (Member, Mod, Admin, Owner). - Extended User model to include role, mute, and ban status. - Created ModerationController for user role assignment, kicking, banning, and muting. - Implemented methods in IChatBroadcaster and SignalRBroadcaster for user moderation actions. - Updated database schema with new columns for user roles and moderation states. fix: ensure muted users cannot send messages - Added mute status checks in ChatService to prevent message sending for muted users. - Updated user presence and status handling to reflect role changes and moderation actions. chore: update constants for ASCII art rendering - Introduced AsciiArtHeightHalfBlock constant for improved ASCII art rendering.
This commit is contained in:
@@ -62,6 +62,41 @@ public class IrcBroadcaster : IChatBroadcaster
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task SendUserKickedAsync(string channelName, string username, string? reason)
|
||||
{
|
||||
var reasonText = reason is not null ? $" :{reason}" : "";
|
||||
foreach (var conn in _gateway.GetConnectionsInChannel(channelName))
|
||||
{
|
||||
await conn.SendAsync($":{_gateway.Options.ServerName} KICK #{channelName} {username}{reasonText}");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SendUserBannedAsync(string username, string? reason)
|
||||
{
|
||||
var reasonText = reason ?? "You have been banned.";
|
||||
foreach (var conn in _gateway.GetAllConnections())
|
||||
{
|
||||
if (conn.Nickname == username)
|
||||
await conn.SendAsync($":{_gateway.Options.ServerName} NOTICE {username} :You have been banned: {reasonText}");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SendMessageDeletedAsync(string channelName, Guid messageId)
|
||||
{
|
||||
foreach (var conn in _gateway.GetConnectionsInChannel(channelName))
|
||||
{
|
||||
await conn.SendAsync($":{_gateway.Options.ServerName} NOTICE {conn.Nickname ?? "*"} :Message {messageId} was deleted in #{channelName}");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SendChannelNukedAsync(string channelName)
|
||||
{
|
||||
foreach (var conn in _gateway.GetConnectionsInChannel(channelName))
|
||||
{
|
||||
await conn.SendAsync($":{_gateway.Options.ServerName} NOTICE {conn.Nickname ?? "*"} :All messages in #{channelName} have been cleared");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SendErrorAsync(string connectionId, string message)
|
||||
{
|
||||
if (!connectionId.StartsWith("irc-")) return;
|
||||
|
||||
@@ -37,6 +37,11 @@ public sealed class IrcGatewayService : BackgroundService
|
||||
.Where(c => c.IsAuthenticated && c.JoinedChannels.Contains(channelName));
|
||||
}
|
||||
|
||||
public IEnumerable<IrcClientConnection> GetAllConnections()
|
||||
{
|
||||
return _connections.Values.Where(c => c.IsAuthenticated);
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
await Task.Yield();
|
||||
|
||||
Reference in New Issue
Block a user