downstream: drop downstreamConn.isMultiUpstream
This is now always false.
This commit is contained in:
parent
1ea3a19403
commit
eba7aa38d2
@ -322,7 +322,6 @@ type downstreamConn struct {
|
|||||||
registered bool
|
registered bool
|
||||||
user *user
|
user *user
|
||||||
network *network // can be nil
|
network *network // can be nil
|
||||||
isMultiUpstream bool
|
|
||||||
clientName string
|
clientName string
|
||||||
|
|
||||||
nick string
|
nick string
|
||||||
@ -388,15 +387,11 @@ func (dc *downstreamConn) prefix() *irc.Prefix {
|
|||||||
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.isMultiUpstream {
|
|
||||||
for _, network := range dc.user.networks {
|
|
||||||
f(network)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dc *downstreamConn) forEachUpstream(f func(*upstreamConn)) {
|
func (dc *downstreamConn) forEachUpstream(f func(*upstreamConn)) {
|
||||||
if dc.network == nil && !dc.isMultiUpstream {
|
if dc.network == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dc.user.forEachUpstream(func(uc *upstreamConn) {
|
dc.user.forEachUpstream(func(uc *upstreamConn) {
|
||||||
@ -473,36 +468,12 @@ func (dc *downstreamConn) unmarshalEntityNetwork(name string) (*network, string,
|
|||||||
if dc.network != nil {
|
if dc.network != nil {
|
||||||
return dc.network, name, nil
|
return dc.network, name, nil
|
||||||
}
|
}
|
||||||
if !dc.isMultiUpstream {
|
|
||||||
return nil, "", ircError{&irc.Message{
|
return nil, "", ircError{&irc.Message{
|
||||||
Command: irc.ERR_NOSUCHCHANNEL,
|
Command: irc.ERR_NOSUCHCHANNEL,
|
||||||
Params: []string{dc.nick, name, "Cannot interact with channels and users on the bouncer connection. Did you mean to use a specific network?"},
|
Params: []string{dc.nick, name, "Cannot interact with channels and users on the bouncer connection. Did you mean to use a specific network?"},
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
var net *network
|
|
||||||
if i := strings.LastIndexByte(name, '/'); i >= 0 {
|
|
||||||
network := name[i+1:]
|
|
||||||
name = name[:i]
|
|
||||||
|
|
||||||
for _, n := range dc.user.networks {
|
|
||||||
if network == n.GetName() {
|
|
||||||
net = n
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if net == nil {
|
|
||||||
return nil, "", ircError{&irc.Message{
|
|
||||||
Command: irc.ERR_NOSUCHCHANNEL,
|
|
||||||
Params: []string{dc.nick, name, "Missing network suffix in name"},
|
|
||||||
}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return net, name, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// unmarshalEntity is the same as unmarshalEntityNetwork, but returns the
|
// unmarshalEntity is the same as unmarshalEntityNetwork, but returns the
|
||||||
// upstream connection and fails if the upstream is disconnected.
|
// upstream connection and fails if the upstream is disconnected.
|
||||||
func (dc *downstreamConn) unmarshalEntity(name string) (*upstreamConn, string, error) {
|
func (dc *downstreamConn) unmarshalEntity(name string) (*upstreamConn, string, error) {
|
||||||
@ -1511,7 +1482,7 @@ func (dc *downstreamConn) welcome(ctx context.Context) 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="+title)
|
isupport = append(isupport, "NETWORK="+title)
|
||||||
}
|
}
|
||||||
if dc.network == nil && !dc.isMultiUpstream {
|
if dc.network == nil {
|
||||||
isupport = append(isupport, "WHOX")
|
isupport = append(isupport, "WHOX")
|
||||||
}
|
}
|
||||||
if dc.caps.IsEnabled("soju.im/webpush") {
|
if dc.caps.IsEnabled("soju.im/webpush") {
|
||||||
@ -1557,7 +1528,7 @@ func (dc *downstreamConn) welcome(ctx context.Context) error {
|
|||||||
Params: []string{dc.nick, "+" + string(uc.modes)},
|
Params: []string{dc.nick, "+" + string(uc.modes)},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if dc.network == nil && !dc.isMultiUpstream && dc.user.Admin {
|
if dc.network == nil && 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,
|
||||||
|
5
user.go
5
user.go
@ -167,10 +167,7 @@ func newNetwork(user *user, record *database.Network, channels []database.Channe
|
|||||||
|
|
||||||
func (net *network) forEachDownstream(f func(*downstreamConn)) {
|
func (net *network) forEachDownstream(f func(*downstreamConn)) {
|
||||||
for _, dc := range net.user.downstreamConns {
|
for _, dc := range net.user.downstreamConns {
|
||||||
if dc.network == nil && !dc.isMultiUpstream {
|
if dc.network != net {
|
||||||
continue
|
|
||||||
}
|
|
||||||
if dc.network != nil && dc.network != net {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
f(dc)
|
f(dc)
|
||||||
|
Loading…
Reference in New Issue
Block a user