Add downstreamConn.updateCasemapping()

We weren't correctly updating nickCM.
This commit is contained in:
Simon Ser 2023-03-01 12:55:10 +01:00
parent 568de1d5d2
commit 637b989a47
2 changed files with 13 additions and 1 deletions

View File

@ -1195,6 +1195,16 @@ func (dc *downstreamConn) updateAccount() {
dc.account = account dc.account = account
} }
func (dc *downstreamConn) updateCasemapping() {
cm := casemapASCII
if dc.network != nil {
cm = dc.network.casemap
}
dc.nickCM = cm(dc.nick)
dc.monitored.SetCasemapping(cm)
}
func sanityCheckServer(ctx context.Context, addr string) error { func sanityCheckServer(ctx context.Context, addr string) error {
ctx, cancel := context.WithTimeout(ctx, 15*time.Second) ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
defer cancel() defer cancel()
@ -1511,6 +1521,7 @@ func (dc *downstreamConn) welcome(ctx context.Context) error {
dc.updateHost() dc.updateHost()
dc.updateRealname() dc.updateRealname()
dc.updateAccount() dc.updateAccount()
dc.updateCasemapping()
if motd := dc.user.srv.Config().MOTD; motd != "" && dc.network == nil { if motd := dc.user.srv.Config().MOTD; motd != "" && dc.network == nil {
for _, msg := range xirc.GenerateMOTD(dc.srv.prefix(), dc.nick, motd) { for _, msg := range xirc.GenerateMOTD(dc.srv.prefix(), dc.nick, motd) {

View File

@ -401,7 +401,7 @@ func (net *network) updateCasemapping(newCasemap casemapping) {
uc.monitored.SetCasemapping(newCasemap) uc.monitored.SetCasemapping(newCasemap)
} }
net.forEachDownstream(func(dc *downstreamConn) { net.forEachDownstream(func(dc *downstreamConn) {
dc.monitored.SetCasemapping(newCasemap) dc.updateCasemapping()
}) })
} }
@ -632,6 +632,7 @@ func (u *user) run() {
dc.updateHost() dc.updateHost()
dc.updateRealname() dc.updateRealname()
dc.updateAccount() dc.updateAccount()
dc.updateCasemapping()
}) })
u.notifyBouncerNetworkState(uc.network.ID, irc.Tags{ u.notifyBouncerNetworkState(uc.network.ID, irc.Tags{
"state": "connected", "state": "connected",