mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 08:36:11 +02:00
feat: enhance message broadcasting to exclude sender's connection and improve IRC compliance
This commit is contained in:
@@ -4,7 +4,14 @@ namespace EchoHub.Core.Contracts;
|
||||
|
||||
public interface IChatBroadcaster
|
||||
{
|
||||
Task SendMessageToChannelAsync(string channelName, MessageDto message);
|
||||
/// <summary>
|
||||
/// Broadcast a chat message to a channel. <paramref name="excludeConnectionId"/> is the
|
||||
/// connection the message originated from (IRC convention: never echo a message back to
|
||||
/// the connection that sent it — its client already displayed it locally). Other
|
||||
/// connections of the same user (e.g. an IRC session alongside a TUI session) still
|
||||
/// receive the message.
|
||||
/// </summary>
|
||||
Task SendMessageToChannelAsync(string channelName, MessageDto message, string? excludeConnectionId = null);
|
||||
Task SendUserJoinedAsync(string channelName, string username, UserPresenceDto? presence, string? excludeConnectionId = null);
|
||||
Task SendUserLeftAsync(string channelName, string username);
|
||||
Task SendChannelUpdatedAsync(ChannelDto channel, string? channelName = null);
|
||||
|
||||
@@ -13,8 +13,10 @@ public interface IChatService
|
||||
Task<(List<MessageDto> History, string? Error, bool PasswordRequired)> JoinChannelAsync(string connectionId, Guid userId, string username, string channelName, string? password = null);
|
||||
Task LeaveChannelAsync(string connectionId, string username, string channelName);
|
||||
|
||||
// Messaging
|
||||
Task<string?> SendMessageAsync(Guid userId, string username, string channelName, string content);
|
||||
// Messaging. originConnectionId identifies the connection the message came from so
|
||||
// broadcasters can avoid echoing it back to that one connection (IRC convention);
|
||||
// the sender's other sessions still receive it.
|
||||
Task<string?> SendMessageAsync(Guid userId, string username, string channelName, string content, string? originConnectionId = null);
|
||||
Task<List<MessageDto>> GetChannelHistoryAsync(string channelName, int count, int offset = 0);
|
||||
|
||||
// Presence
|
||||
|
||||
Reference in New Issue
Block a user