Fix auto transmit and server messages

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 23:28:50 -04:00
committed by Brandon McGinty
parent 219acad951
commit 8348a7083d
2 changed files with 43 additions and 11 deletions
+22
View File
@@ -69,6 +69,28 @@ func TestNotificationExpansionIsSinglePassAndNotifyDoesNotBlock(t *testing.T) {
}
}
func TestPublicServerMessageDoesNotPanic(t *testing.T) {
channel := &gumble.Channel{ID: 1, Name: "Current"}
b := &Barnard{
Client: &gumble.Client{Self: &gumble.User{Channel: channel}},
notifyChannel: make(chan []string, 1),
}
b.OnTextMessage(&gumble.TextMessageEvent{
Client: b.Client,
TextMessage: gumble.TextMessage{
Channels: []*gumble.Channel{channel},
Message: "server announcement",
},
})
got := <-b.notifyChannel
want := []string{"msg", "Server", "server announcement"}
if len(got) != len(want) || got[0] != want[0] || got[1] != want[1] || got[2] != want[2] {
t.Fatalf("notification = %#v, want %#v", got, want)
}
}
// Regression: reconnect replaced Stream without destroying the old capture
// and renderer resources. Cleanup must be safe for repeated disconnects.
// Regression: user and channel names in the navigation tree bypassed message