AWAY: Only dispatch AWAY when cap-notify is used

This commit is contained in:
Daniel Oaks 2016-10-13 18:08:08 +10:00
parent e807f3ca04
commit 0eebd6273c
2 changed files with 8 additions and 2 deletions

View file

@ -255,11 +255,17 @@ func (c *Client) Id() string {
}
// Friends refers to clients that share a channel with this client.
func (client *Client) Friends() ClientSet {
func (client *Client) Friends(Capabilities ...Capability) ClientSet {
friends := make(ClientSet)
friends.Add(client)
for channel := range client.channels {
for member := range channel.members {
// make sure they have all the required caps
for _, Cap := range Capabilities {
if !member.capabilities[Cap] {
continue
}
}
friends.Add(member)
}
}