3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-26 05:49:25 +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,13 +374,17 @@ 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
}
}
if hasCaps {
friends.Add(member)
}
}
channel.membersMutex.RUnlock()
}
return friends