Advertise all caps, CAP DEL them on registration
... so that the JOIN/history batch takes into account all capabilities. Without this commit for example, enabling multi-prefix after the batch makes the client send NAMES requests for all channels, which generate needless traffic.
This commit is contained in:
parent
0ddc0de7e5
commit
7bfa4dafef
@ -555,6 +555,14 @@ func (dc *downstreamConn) handleCapCommand(cmd string, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !dc.registered && dc.capVersion >= 302 {
|
||||||
|
// Let downstream show everything it supports, and trim
|
||||||
|
// down the available capabilities when upstreams are
|
||||||
|
// known.
|
||||||
|
for k, v := range needAllDownstreamCaps {
|
||||||
|
dc.supportedCaps[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
caps := make([]string, 0, len(dc.supportedCaps))
|
caps := make([]string, 0, len(dc.supportedCaps))
|
||||||
for k, v := range dc.supportedCaps {
|
for k, v := range dc.supportedCaps {
|
||||||
@ -896,6 +904,7 @@ func (dc *downstreamConn) welcome() error {
|
|||||||
})
|
})
|
||||||
|
|
||||||
dc.updateNick()
|
dc.updateNick()
|
||||||
|
dc.updateSupportedCaps()
|
||||||
|
|
||||||
dc.forEachUpstream(func(uc *upstreamConn) {
|
dc.forEachUpstream(func(uc *upstreamConn) {
|
||||||
for _, ch := range uc.channels {
|
for _, ch := range uc.channels {
|
||||||
|
2
user.go
2
user.go
@ -435,8 +435,6 @@ func (u *user) run() {
|
|||||||
u.forEachUpstream(func(uc *upstreamConn) {
|
u.forEachUpstream(func(uc *upstreamConn) {
|
||||||
uc.updateAway()
|
uc.updateAway()
|
||||||
})
|
})
|
||||||
|
|
||||||
dc.updateSupportedCaps()
|
|
||||||
case eventDownstreamDisconnected:
|
case eventDownstreamDisconnected:
|
||||||
dc := e.dc
|
dc := e.dc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user