If bob is monitoring alice, bob should get METADATA lines for alice
even if bob doesn't have extended-monitor. The four caps that explicitly
require extended-monitor are: away-notify, chghost, setname, account-notify.
This commit is contained in:
Shivaram Lingamneni 2025-12-15 21:57:42 -05:00
parent d5fb189a55
commit 258af017d4
3 changed files with 5 additions and 5 deletions

View file

@ -1121,7 +1121,7 @@ func (client *Client) SetOper(oper *Oper) {
func (client *Client) sendChghost(oldNickMask string, vhost string) { func (client *Client) sendChghost(oldNickMask string, vhost string) {
details := client.Details() details := client.Details()
isBot := client.HasMode(modes.Bot) isBot := client.HasMode(modes.Bot)
for fClient := range client.FriendsMonitors(caps.ChgHost) { for fClient := range client.FriendsMonitors(caps.ExtendedMonitor, caps.ChgHost) {
fClient.sendFromClientInternal(false, time.Time{}, "", oldNickMask, details.accountName, isBot, nil, "CHGHOST", details.username, vhost) fClient.sendFromClientInternal(false, time.Time{}, "", oldNickMask, details.accountName, isBot, nil, "CHGHOST", details.username, vhost)
} }
} }

View file

@ -114,7 +114,7 @@ func sendSuccessfulAccountAuth(service *ircService, client *Client, rb *Response
if client.Registered() { if client.Registered() {
// dispatch account-notify // dispatch account-notify
for friend := range client.FriendsMonitors(caps.AccountNotify) { for friend := range client.FriendsMonitors(caps.ExtendedMonitor, caps.AccountNotify) {
if friend != rb.session { if friend != rb.session {
friend.Send(nil, details.nickMask, "ACCOUNT", details.accountName) friend.Send(nil, details.nickMask, "ACCOUNT", details.accountName)
} }
@ -531,7 +531,7 @@ func dispatchAwayNotify(client *Client, awayMessage string) {
// dispatch away-notify // dispatch away-notify
details := client.Details() details := client.Details()
isBot := client.HasMode(modes.Bot) isBot := client.HasMode(modes.Bot)
for session := range client.FriendsMonitors(caps.AwayNotify) { for session := range client.FriendsMonitors(caps.ExtendedMonitor, caps.AwayNotify) {
if awayMessage != "" { if awayMessage != "" {
session.sendFromClientInternal(false, time.Time{}, "", details.nickMask, details.accountName, isBot, nil, "AWAY", awayMessage) session.sendFromClientInternal(false, time.Time{}, "", details.nickMask, details.accountName, isBot, nil, "AWAY", awayMessage)
} else { } else {
@ -3650,7 +3650,7 @@ func setnameHandler(server *Server, client *Client, msg ircmsg.Message, rb *Resp
// alert friends // alert friends
now := time.Now().UTC() now := time.Now().UTC()
friends := client.FriendsMonitors(caps.SetName) friends := client.FriendsMonitors(caps.ExtendedMonitor, caps.SetName)
delete(friends, rb.session) delete(friends, rb.session)
isBot := client.HasMode(modes.Bot) isBot := client.HasMode(modes.Bot)
for session := range friends { for session := range friends {

View file

@ -31,7 +31,7 @@ func (manager *MonitorManager) AddMonitors(users utils.HashSet[*Session], cfnick
manager.RLock() manager.RLock()
defer manager.RUnlock() defer manager.RUnlock()
for session := range manager.watchedby[cfnick] { for session := range manager.watchedby[cfnick] {
if session.capabilities.Has(caps.ExtendedMonitor) && session.capabilities.HasAll(capabs...) { if session.capabilities.HasAll(capabs...) {
users.Add(session) users.Add(session)
} }
} }