Don't send network notification when removed

Closes: https://todo.sr.ht/~emersion/soju/123
This commit is contained in:
Simon Ser 2021-09-13 10:33:46 +02:00
parent a4a9b7e934
commit 79b0fe5de5

13
user.go
View File

@ -674,6 +674,19 @@ func (u *user) handleUpstreamDisconnected(uc *upstreamConn) {
uc.forEachDownstream(func(dc *downstreamConn) { uc.forEachDownstream(func(dc *downstreamConn) {
dc.updateSupportedCaps() dc.updateSupportedCaps()
}) })
// If the network has been removed, don't send a state change notification
found := false
for _, net := range u.networks {
if net == uc.network {
found = true
break
}
}
if !found {
return
}
u.forEachDownstream(func(dc *downstreamConn) { u.forEachDownstream(func(dc *downstreamConn) {
if dc.caps["soju.im/bouncer-networks-notify"] { if dc.caps["soju.im/bouncer-networks-notify"] {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{