diff --git a/CHANGELOG.md b/CHANGELOG.md index 762afd40..159ae582 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ Initial release of Oragono! * Added ability to parse complex mode change syntax commonly used these days (i.e. `+h-ov dan dan dan`). * Added user mode for clients connected via TLS (`+Z`). * Added ability to register and login to accounts (with passphrase or certfp). -* Added support for IRCv3 capabilities [`account-tag`](http://ircv3.net/specs/extensions/account-tag-3.2.html), [`extended-join`](http://ircv3.net/specs/extensions/extended-join-3.1.html), [`sasl`](http://ircv3.net/specs/extensions/sasl-3.1.html), [`server-time`](http://ircv3.net/specs/extensions/server-time-3.2.html), and [`userhost-in-names`](http://ircv3.net/specs/extensions/userhost-in-names-3.2.html). +* Added support for IRCv3 capabilities [`account-tag`](http://ircv3.net/specs/extensions/account-tag-3.2.html), [`away-notify`](http://ircv3.net/specs/extensions/away-notify-3.1.html), [`extended-join`](http://ircv3.net/specs/extensions/extended-join-3.1.html), [`sasl`](http://ircv3.net/specs/extensions/sasl-3.1.html), [`server-time`](http://ircv3.net/specs/extensions/server-time-3.2.html), and [`userhost-in-names`](http://ircv3.net/specs/extensions/userhost-in-names-3.2.html). ### Changed * Changed channel creator (`O`) privilege to founder/admin/halfops (`qah`) privileges. diff --git a/irc/capability.go b/irc/capability.go index bf6a2595..4e967a2e 100644 --- a/irc/capability.go +++ b/irc/capability.go @@ -15,6 +15,7 @@ type Capability string const ( AccountTag Capability = "account-tag" + AwayNotify Capability = "away-notify" ExtendedJoin Capability = "extended-join" MultiPrefix Capability = "multi-prefix" SASL Capability = "sasl" @@ -25,6 +26,7 @@ const ( var ( SupportedCapabilities = CapabilitySet{ AccountTag: true, + AwayNotify: true, ExtendedJoin: true, MultiPrefix: true, SASL: true, diff --git a/irc/server.go b/irc/server.go index fe54c3b8..266d52a7 100644 --- a/irc/server.go +++ b/irc/server.go @@ -830,6 +830,16 @@ func awayHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool { op: op, }} client.Send(nil, server.nameString, "MODE", client.nickString, client.nickString, modech.String()) + + // dispatch away-notify + for friend := range client.Friends() { + if client.flags[Away] { + friend.SendFromClient(client, nil, client.nickMaskString, "AWAY", client.awayMessage) + } else { + friend.SendFromClient(client, nil, client.nickMaskString, "AWAY") + } + } + return false }