3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-13 07:29:30 +01:00

client: Only add friends if they actually have the caps we request. Friends() is entirely broken because of this

This commit is contained in:
Daniel Oaks 2017-09-26 08:36:34 +10:00
parent 79de443496
commit a78a8f1130

View File

@ -374,12 +374,16 @@ func (client *Client) Friends(Capabilities ...Capability) ClientSet {
channel.membersMutex.RLock()
for member := range channel.members {
// make sure they have all the required caps
hasCaps = true
for _, Cap := range Capabilities {
if !member.capabilities[Cap] {
continue
hasCaps = false
break
}
}
friends.Add(member)
if hasCaps {
friends.Add(member)
}
}
channel.membersMutex.RUnlock()
}