Review fix

This commit is contained in:
Daniel Oaks 2019-04-28 15:57:42 +10:00
parent 22ed6bb1f1
commit 267c51bbbf
1 changed files with 2 additions and 1 deletions

View File

@ -209,11 +209,12 @@ func (clients *ClientManager) AllWithCaps(capabs ...caps.Capability) (sessions [
// AllWithCapsNotify returns all clients with the given capabilities, and that support cap-notify. // AllWithCapsNotify returns all clients with the given capabilities, and that support cap-notify.
func (clients *ClientManager) AllWithCapsNotify(capabs ...caps.Capability) (sessions []*Session) { func (clients *ClientManager) AllWithCapsNotify(capabs ...caps.Capability) (sessions []*Session) {
capabs = append(capabs, caps.CapNotify)
clients.RLock() clients.RLock()
defer clients.RUnlock() defer clients.RUnlock()
for _, client := range clients.byNick { for _, client := range clients.byNick {
for _, session := range client.Sessions() { for _, session := range client.Sessions() {
capabs = append(capabs, caps.CapNotify) // cap-notify is implicit in cap version 302 and above
if session.capabilities.HasAll(capabs...) || 302 <= session.capVersion { if session.capabilities.HasAll(capabs...) || 302 <= session.capVersion {
sessions = append(sessions, session) sessions = append(sessions, session)
} }