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:
parent
79de443496
commit
a78a8f1130
@ -374,13 +374,17 @@ func (client *Client) Friends(Capabilities ...Capability) ClientSet {
|
|||||||
channel.membersMutex.RLock()
|
channel.membersMutex.RLock()
|
||||||
for member := range channel.members {
|
for member := range channel.members {
|
||||||
// make sure they have all the required caps
|
// make sure they have all the required caps
|
||||||
|
hasCaps = true
|
||||||
for _, Cap := range Capabilities {
|
for _, Cap := range Capabilities {
|
||||||
if !member.capabilities[Cap] {
|
if !member.capabilities[Cap] {
|
||||||
continue
|
hasCaps = false
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if hasCaps {
|
||||||
friends.Add(member)
|
friends.Add(member)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
channel.membersMutex.RUnlock()
|
channel.membersMutex.RUnlock()
|
||||||
}
|
}
|
||||||
return friends
|
return friends
|
||||||
|
Loading…
Reference in New Issue
Block a user