mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
AWAY: Only dispatch AWAY when cap-notify is used
This commit is contained in:
parent
e807f3ca04
commit
0eebd6273c
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -862,7 +862,7 @@ func awayHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
||||
client.Send(nil, server.name, "MODE", client.nick, client.nick, modech.String())
|
||||
|
||||
// dispatch away-notify
|
||||
for friend := range client.Friends() {
|
||||
for friend := range client.Friends(AwayNotify) {
|
||||
if client.flags[Away] {
|
||||
friend.SendFromClient(client, nil, client.nickMaskString, "AWAY", client.awayMessage)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user