|
@@ -28,14 +28,6 @@ func (clients *ClientManager) Initialize() {
|
28
|
28
|
clients.bySkeleton = make(map[string]*Client)
|
29
|
29
|
}
|
30
|
30
|
|
31
|
|
-// Count returns how many clients are in the manager.
|
32
|
|
-func (clients *ClientManager) Count() int {
|
33
|
|
- clients.RLock()
|
34
|
|
- defer clients.RUnlock()
|
35
|
|
- count := len(clients.byNick)
|
36
|
|
- return count
|
37
|
|
-}
|
38
|
|
-
|
39
|
31
|
// Get retrieves a client from the manager, if they exist.
|
40
|
32
|
func (clients *ClientManager) Get(nick string) *Client {
|
41
|
33
|
casefoldedName, err := CasefoldName(nick)
|
|
@@ -262,21 +254,6 @@ func (clients *ClientManager) AllClients() (result []*Client) {
|
262
|
254
|
return
|
263
|
255
|
}
|
264
|
256
|
|
265
|
|
-// AllWithCaps returns all clients with the given capabilities.
|
266
|
|
-func (clients *ClientManager) AllWithCaps(capabs ...caps.Capability) (sessions []*Session) {
|
267
|
|
- clients.RLock()
|
268
|
|
- defer clients.RUnlock()
|
269
|
|
- for _, client := range clients.byNick {
|
270
|
|
- for _, session := range client.Sessions() {
|
271
|
|
- if session.capabilities.HasAll(capabs...) {
|
272
|
|
- sessions = append(sessions, session)
|
273
|
|
- }
|
274
|
|
- }
|
275
|
|
- }
|
276
|
|
-
|
277
|
|
- return
|
278
|
|
-}
|
279
|
|
-
|
280
|
257
|
// AllWithCapsNotify returns all clients with the given capabilities, and that support cap-notify.
|
281
|
258
|
func (clients *ClientManager) AllWithCapsNotify(capabs ...caps.Capability) (sessions []*Session) {
|
282
|
259
|
capabs = append(capabs, caps.CapNotify)
|