3
0
mirror of https://github.com/ergochat/ergo.git synced 2025-12-27 21:38:01 +01:00
If bob is monitoring alice, bob should get METADATA lines for alice
even if bob doesn't have extended-monitor.

This implementation also removes the check for extended-monitor
when sending account-notify, away-notify, chghost, setname
(which are explicitly mentioned in the extended-monitor spec)
on the grounds that nothing bad will happen if clients who support
the cap receive notifications for users they're not explicitly tracking.
This commit is contained in:
Shivaram Lingamneni 2025-12-22 03:25:27 -05:00 committed by GitHub
parent 3e9fa38f6b
commit 3c4c5dde4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,10 +28,14 @@ func (mm *MonitorManager) Initialize() {
// AddMonitors adds clients using extended-monitor monitoring `client`'s nick to the passed user set.
func (manager *MonitorManager) AddMonitors(users utils.HashSet[*Session], cfnick string, capabs ...caps.Capability) {
// technically, we should check extended-monitor here, but it's not really necessary
// since clients will ignore AWAY, ACCOUNT, CHGHOST, and SETNAME for users
// they're not tracking
manager.RLock()
defer manager.RUnlock()
for session := range manager.watchedby[cfnick] {
if session.capabilities.Has(caps.ExtendedMonitor) && session.capabilities.HasAll(capabs...) {
if session.capabilities.HasAll(capabs...) {
users.Add(session)
}
}