diff --git a/irc/client_lookup_set.go b/irc/client_lookup_set.go index 8a585ffd..6bdf74d2 100644 --- a/irc/client_lookup_set.go +++ b/irc/client_lookup_set.go @@ -207,6 +207,22 @@ func (clients *ClientManager) AllWithCaps(capabs ...caps.Capability) (sessions [ return } +// AllWithCapsNotify returns all clients with the given capabilities, and that support cap-notify. +func (clients *ClientManager) AllWithCapsNotify(capabs ...caps.Capability) (sessions []*Session) { + clients.RLock() + defer clients.RUnlock() + for _, client := range clients.byNick { + for _, session := range client.Sessions() { + capabs = append(capabs, caps.CapNotify) + if session.capabilities.HasAll(capabs...) || 302 <= session.capVersion { + sessions = append(sessions, session) + } + } + } + + return +} + // FindAll returns all clients that match the given userhost mask. func (clients *ClientManager) FindAll(userhost string) (set ClientSet) { set = make(ClientSet) diff --git a/irc/server.go b/irc/server.go index e4d2aadb..27f8952e 100644 --- a/irc/server.go +++ b/irc/server.go @@ -744,7 +744,7 @@ func (server *Server) applyConfig(config *Config, initial bool) (err error) { removedCaps.Union(updatedCaps) if !addedCaps.Empty() || !removedCaps.Empty() { - capBurstSessions = server.clients.AllWithCaps(caps.CapNotify) + capBurstSessions = server.clients.AllWithCapsNotify() added[caps.Cap301] = addedCaps.String(caps.Cap301, CapValues) added[caps.Cap302] = addedCaps.String(caps.Cap302, CapValues)