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
This commit is contained in:
contact 2021-11-17 14:27:34 +00:00
parent 5161f92e29
commit 99b503c800

View File

@ -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) {