mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-07 07:36:01 +02:00
feat: enhance message broadcasting to exclude sender's connection and improve IRC compliance
This commit is contained in:
@@ -14,7 +14,7 @@ public class IrcBroadcaster : IChatBroadcaster
|
||||
_encryption = encryption;
|
||||
}
|
||||
|
||||
public async Task SendMessageToChannelAsync(string channelName, MessageDto message)
|
||||
public async Task SendMessageToChannelAsync(string channelName, MessageDto message, string? excludeConnectionId = null)
|
||||
{
|
||||
// Decrypt transport-encrypted content for IRC clients (they can't handle
|
||||
// app-layer encryption). E2E room ciphertext ($RC1$) passes through untouched.
|
||||
@@ -23,8 +23,11 @@ public class IrcBroadcaster : IChatBroadcaster
|
||||
|
||||
foreach (var conn in _gateway.GetConnectionsInChannel(channelName))
|
||||
{
|
||||
// IRC convention: don't echo sender's own message
|
||||
if (conn.Nickname == message.SenderUsername)
|
||||
// IRC convention: don't echo a message back to the connection that sent it
|
||||
// (its client already displayed it locally). Match by connection id, not
|
||||
// nickname — the same account may also be online via the TUI or a second
|
||||
// IRC client, and those sessions must still receive the message.
|
||||
if (conn.ConnectionId == excludeConnectionId)
|
||||
continue;
|
||||
|
||||
foreach (var line in lines)
|
||||
|
||||
Reference in New Issue
Block a user