From 99b503c8008c27178b816df3afb7e68149134285 Mon Sep 17 00:00:00 2001 From: contact Date: Wed, 17 Nov 2021 14:27:34 +0000 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. git-svn-id: file:///srv/svn/repo/suika/trunk@706 f0ae65fe-ee39-954e-97ec-027ff2717ef4 --- 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) {