From 4d3b6409897ba27d12f8a1856626cbc07d22a57f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 17 Nov 2021 15:27:34 +0100 Subject: [PATCH] Update downstream caps/nick/realname before sending MOTD The MOTD indicates the end of the registration's message burst, and the server can send arbitrary messages before it. Update the supported capabilities, the nick and the realname before MOTD to make it so client logic that runs on MOTD can work with up-to-date info. --- downstream.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/downstream.go b/downstream.go index 54772df..f57fa7e 100644 --- a/downstream.go +++ b/downstream.go @@ -1187,6 +1187,8 @@ func (dc *downstreamConn) welcome(ctx context.Context) error { dc.isMultiUpstream = true } + dc.updateSupportedCaps() + isupport := []string{ fmt.Sprintf("CHATHISTORY=%v", chatHistoryLimit), "CASEMAPPING=ascii", @@ -1249,6 +1251,9 @@ func (dc *downstreamConn) welcome(ctx context.Context) error { }) } + dc.updateNick() + dc.updateRealname() + if motd := dc.user.srv.Config().MOTD; motd != "" && dc.network == nil { for _, msg := range generateMOTD(dc.srv.prefix(), dc.nick, motd) { dc.SendMessage(msg) @@ -1265,10 +1270,6 @@ func (dc *downstreamConn) welcome(ctx context.Context) error { }) } - dc.updateNick() - dc.updateRealname() - dc.updateSupportedCaps() - if dc.caps["soju.im/bouncer-networks-notify"] { dc.SendBatch("soju.im/bouncer-networks", nil, nil, func(batchRef irc.TagValue) { dc.user.forEachNetwork(func(network *network) {