From b0349caada8ae76800b07053ea64a622e9c48547 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 26 May 2021 11:04:33 +0200 Subject: [PATCH] Broadcast BOUNCER notifications to all downstream connections We weren't sending them to downstreams which weren't bound to a network. --- user.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/user.go b/user.go index 589326c..9a8d854 100644 --- a/user.go +++ b/user.go @@ -522,18 +522,21 @@ func (u *user) run() { uc.forEachDownstream(func(dc *downstreamConn) { dc.updateSupportedCaps() + if !dc.caps["soju.im/bouncer-networks"] { + sendServiceNOTICE(dc, fmt.Sprintf("connected to %s", uc.network.GetName())) + } + + dc.updateNick() + dc.updateRealname() + }) + u.forEachDownstream(func(dc *downstreamConn) { if dc.caps["soju.im/bouncer-networks-notify"] { dc.SendMessage(&irc.Message{ Prefix: dc.srv.prefix(), Command: "BOUNCER", Params: []string{"NETWORK", netIDStr, "status=connected"}, }) - } else if !dc.caps["soju.im/bouncer-networks"] { - sendServiceNOTICE(dc, fmt.Sprintf("connected to %s", uc.network.GetName())) } - - dc.updateNick() - dc.updateRealname() }) uc.network.lastError = nil case eventUpstreamDisconnected: @@ -661,7 +664,8 @@ func (u *user) handleUpstreamDisconnected(uc *upstreamConn) { netIDStr := fmt.Sprintf("%v", uc.network.ID) uc.forEachDownstream(func(dc *downstreamConn) { dc.updateSupportedCaps() - + }) + u.forEachDownstream(func(dc *downstreamConn) { if dc.caps["soju.im/bouncer-networks-notify"] { dc.SendMessage(&irc.Message{ Prefix: dc.srv.prefix(),