Add downstreamConn.isMultiUpstream
This commit is contained in:
parent
73295e4fa7
commit
ff44ea314e
@ -307,16 +307,20 @@ func (dc *downstreamConn) prefix() *irc.Prefix {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (dc *downstreamConn) isMultiUpstream() bool {
|
||||||
|
return dc.network == nil && !dc.caps["soju.im/bouncer-networks"]
|
||||||
|
}
|
||||||
|
|
||||||
func (dc *downstreamConn) forEachNetwork(f func(*network)) {
|
func (dc *downstreamConn) forEachNetwork(f func(*network)) {
|
||||||
if dc.network != nil {
|
if dc.network != nil {
|
||||||
f(dc.network)
|
f(dc.network)
|
||||||
} else if !dc.caps["soju.im/bouncer-networks"] {
|
} else if dc.isMultiUpstream() {
|
||||||
dc.user.forEachNetwork(f)
|
dc.user.forEachNetwork(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dc *downstreamConn) forEachUpstream(f func(*upstreamConn)) {
|
func (dc *downstreamConn) forEachUpstream(f func(*upstreamConn)) {
|
||||||
if dc.network == nil && dc.caps["soju.im/bouncer-networks"] {
|
if dc.network == nil && !dc.isMultiUpstream() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dc.user.forEachUpstream(func(uc *upstreamConn) {
|
dc.user.forEachUpstream(func(uc *upstreamConn) {
|
||||||
@ -1181,7 +1185,7 @@ func (dc *downstreamConn) welcome() error {
|
|||||||
if title := dc.srv.Config().Title; dc.network == nil && title != "" {
|
if title := dc.srv.Config().Title; dc.network == nil && title != "" {
|
||||||
isupport = append(isupport, "NETWORK="+encodeISUPPORT(title))
|
isupport = append(isupport, "NETWORK="+encodeISUPPORT(title))
|
||||||
}
|
}
|
||||||
if dc.network == nil && dc.caps["soju.im/bouncer-networks"] {
|
if dc.network == nil && !dc.isMultiUpstream() {
|
||||||
isupport = append(isupport, "WHOX")
|
isupport = append(isupport, "WHOX")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1224,7 +1228,7 @@ func (dc *downstreamConn) welcome() error {
|
|||||||
Params: []string{dc.nick, "+" + string(uc.modes)},
|
Params: []string{dc.nick, "+" + string(uc.modes)},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if dc.network == nil && dc.caps["soju.im/bouncer-networks"] && dc.user.Admin {
|
if dc.network == nil && !dc.isMultiUpstream() && dc.user.Admin {
|
||||||
dc.SendMessage(&irc.Message{
|
dc.SendMessage(&irc.Message{
|
||||||
Prefix: dc.srv.prefix(),
|
Prefix: dc.srv.prefix(),
|
||||||
Command: irc.RPL_UMODEIS,
|
Command: irc.RPL_UMODEIS,
|
||||||
|
2
user.go
2
user.go
@ -152,7 +152,7 @@ func newNetwork(user *user, record *Network, channels []Channel) *network {
|
|||||||
|
|
||||||
func (net *network) forEachDownstream(f func(*downstreamConn)) {
|
func (net *network) forEachDownstream(f func(*downstreamConn)) {
|
||||||
net.user.forEachDownstream(func(dc *downstreamConn) {
|
net.user.forEachDownstream(func(dc *downstreamConn) {
|
||||||
if dc.network == nil && dc.caps["soju.im/bouncer-networks"] {
|
if dc.network == nil && !dc.isMultiUpstream() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if dc.network != nil && dc.network != net {
|
if dc.network != nil && dc.network != net {
|
||||||
|
Loading…
Reference in New Issue
Block a user