mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-26 13:59:44 +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,12 +374,16 @@ 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
friends.Add(member)
|
if hasCaps {
|
||||||
|
friends.Add(member)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
channel.membersMutex.RUnlock()
|
channel.membersMutex.RUnlock()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user