Broadcast BOUNCER notifications to all downstream connections

We weren't sending them to downstreams which weren't bound to a
network.

git-svn-id: file:///srv/svn/repo/suika/trunk@543 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
contact 2021-05-26 09:04:33 +00:00
parent 30c6e9e954
commit b3d039ec5b

16
user.go
View File

@ -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(),