commit b209af1
delthas
·
2026-03-10 18:27:03 +0000 UTC
parent cea6284
Fix nicks with brackets becoming invisible after restart
s.nickCf was computed at RPL_WELCOME (001) using the default casemap
(rfc1459), but ISUPPORT (005) arrives after and may change the casemap
to ascii. For nicks containing brackets (e.g. [mynick]), rfc1459
casemapping converts [ to { and ] to }, while ascii does not. This
caused IsMe() to fail for all subsequent JOINs, so channels were never
added to the buffer list.
Recompute s.nickCf and rekey s.users when the casemap changes in
ISUPPORT.
Fixes: https://todo.sr.ht/~delthas/senpai/231
1 files changed,
+8,
-0
+8,
-0
1@@ -2211,12 +2211,20 @@ func (s *Session) updateFeatures(features []string) {
2 case "BOUNCER_NETID":
3 s.netID = value
4 case "CASEMAPPING":
5+ oldNickCf := s.nickCf
6 switch value {
7 case "ascii":
8 s.casemap = CasemapASCII
9 default:
10 s.casemap = CasemapRFC1459
11 }
12+ s.nickCf = s.casemap(s.nick)
13+ if oldNickCf != s.nickCf {
14+ if u, ok := s.users[oldNickCf]; ok {
15+ delete(s.users, oldNickCf)
16+ s.users[s.nickCf] = u
17+ }
18+ }
19 case "CHANMODES":
20 // We only care about the first four params
21 types := strings.SplitN(value, ",", 5)