From c03e39d38cb2907aef8ba3b817dfab9e7f6cc1c7 Mon Sep 17 00:00:00 2001 From: sneak Date: Tue, 3 Nov 2026 07:07:50 +0000 Subject: [PATCH] Add the # to RPL_ENDOFWHO for an unknown channel over HTTP (closes #249) WHO over the HTTP API adds a missing # to the channel name, but the unknown-channel path sent RPL_ENDOFWHO with the name as sent. A client keyed on the channel name saw two spellings. Both paths now send the name with the #. Model: opus-5-5 --- internal/handlers/api.go | 2 +- internal/handlers/api_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/internal/handlers/api.go b/internal/handlers/api.go index 0924d7a..3ad7068 100644 --- a/internal/handlers/api.go +++ b/internal/handlers/api.go @@ -3238,7 +3238,7 @@ func (hdlr *Handlers) handleWho( // 315 RPL_ENDOFWHO (empty result) hdlr.enqueueNumeric( ctx, clientID, irc.RplEndOfWho, nick, - []string{target}, + []string{channel}, "End of /WHO list", ) hdlr.broker.Notify(sessionID) diff --git a/internal/handlers/api_test.go b/internal/handlers/api_test.go index 728f8c9..7ed1aac 100644 --- a/internal/handlers/api_test.go +++ b/internal/handlers/api_test.go @@ -4039,6 +4039,31 @@ func assertWhoReplyUsername( ) } +func TestWhoUnknownChannelEndReplyAddsHash(t *testing.T) { + t.Parallel() + + tserver := newTestServer(t) + + token := tserver.createSession("whoasker") + + _, lastID := tserver.pollMessages(token, 0) + + msgs, _ := sendAndPoll(tserver, token, lastID, map[string]any{ + commandKey: irc.CmdWho, + toKey: "nosuch", + }) + + endOfWho := findNumericWithParams(msgs, "315") + if endOfWho == nil { + t.Fatalf("expected RPL_ENDOFWHO (315), got %v", msgs) + } + + params := getNumericParams(endOfWho) + if !slices.Equal(params, []string{"#nosuch"}) { + t.Fatalf("expected params [#nosuch], got %v", params) + } +} + func TestSessionUsernameDefault(t *testing.T) { t.Parallel()