forked from External/ergo
Add support for extended-monitor
See: https://github.com/ircv3/ircv3-specifications/pull/466
This commit is contained in:
parent
ad61f9f213
commit
7fde04ea94
5 changed files with 36 additions and 5 deletions
|
|
@ -6,6 +6,8 @@ package irc
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/ergochat/ergo/irc/caps"
|
||||
|
||||
"github.com/ergochat/irc-go/ircmsg"
|
||||
)
|
||||
|
||||
|
|
@ -23,6 +25,17 @@ func (mm *MonitorManager) Initialize() {
|
|||
mm.watchedby = make(map[string]map[*Session]empty)
|
||||
}
|
||||
|
||||
// AddMonitors adds clients using extended-monitor monitoring `client`'s nick to the passed user set.
|
||||
func (manager *MonitorManager) AddMonitors(users map[*Session]empty, cfnick string, capabs ...caps.Capability) {
|
||||
manager.RLock()
|
||||
defer manager.RUnlock()
|
||||
for session := range manager.watchedby[cfnick] {
|
||||
if session.capabilities.Has(caps.ExtendedMonitor) && session.capabilities.HasAll(capabs...) {
|
||||
users[session] = empty{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AlertAbout alerts everyone monitoring `client`'s nick that `client` is now {on,off}line.
|
||||
func (manager *MonitorManager) AlertAbout(nick, cfnick string, online bool) {
|
||||
var watchers []*Session
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue