downstream: fix WHO membership prefix order without server-specific flags

Gregory noticed that my last-minute edit was wrong [1]. Indeed,
when i == -1, that means that Flags only contains 'H'/'G'/'*' and
nothing else. We need to append the membership prefix in that case.

[1]: https://lists.sr.ht/~emersion/soju-dev/%3C20240630213249.13061-2-greg@gpanders.com%3E#%3CD2DP18U4PP40.DBYWGA8WM2KN@gpanders.com%3E

Fixes: ae203388e1 ("Fix channel membership prefixes in cached WHO replies")
Reported-by: Gregory Anders <greg@gpanders.com>
This commit is contained in:
Simon Ser 2024-07-01 00:14:06 +02:00
parent ae203388e1
commit d5dd194b01

View file

@ -2243,7 +2243,7 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
})
if i == -1 {
info.Flags = prefixes + info.Flags
info.Flags += prefixes
} else {
info.Flags = info.Flags[:i] + prefixes + info.Flags[i:]
}