3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

Implement echo-message capability

This commit is contained in:
Daniel Oaks 2016-10-22 22:29:01 +10:00
parent b84dbb1a06
commit d9db688963
4 changed files with 10 additions and 2 deletions

View File

@ -13,7 +13,7 @@ New release of Oragono!
### Added ### Added
* Added `REHASH` command. * Added `REHASH` command.
* Added ability to enable and disable SASL. * Added ability to enable and disable SASL.
* Added support for IRCv3 capability [`cap-notify`](http://ircv3.net/specs/extensions/cap-notify-3.2.html). * Added support for IRCv3 capabilities [`cap-notify`](http://ircv3.net/specs/extensions/cap-notify-3.2.html) and [`echo-message`](http://ircv3.net/specs/extensions/echo-message-3.2.html).
### Changed ### Changed

View File

@ -18,6 +18,7 @@ const (
AccountNotify Capability = "account-notify" AccountNotify Capability = "account-notify"
AwayNotify Capability = "away-notify" AwayNotify Capability = "away-notify"
CapNotify Capability = "cap-notify" CapNotify Capability = "cap-notify"
EchoMessage Capability = "echo-message"
ExtendedJoin Capability = "extended-join" ExtendedJoin Capability = "extended-join"
InviteNotify Capability = "invite-notify" InviteNotify Capability = "invite-notify"
MessageTags Capability = "draft/message-tags" MessageTags Capability = "draft/message-tags"
@ -33,6 +34,7 @@ var (
AccountNotify: true, AccountNotify: true,
AwayNotify: true, AwayNotify: true,
CapNotify: true, CapNotify: true,
EchoMessage: true,
ExtendedJoin: true, ExtendedJoin: true,
InviteNotify: true, InviteNotify: true,
MessageTags: true, MessageTags: true,

View File

@ -314,7 +314,7 @@ func (channel *Channel) PrivMsg(clientOnlyTags *map[string]ircmsg.TagValue, clie
return return
} }
for member := range channel.members { for member := range channel.members {
if member == client { if member == client && !client.capabilities[EchoMessage] {
continue continue
} }
if member.capabilities[MessageTags] { if member.capabilities[MessageTags] {

View File

@ -705,6 +705,9 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
clientOnlyTags = nil clientOnlyTags = nil
} }
user.SendFromClient(client, clientOnlyTags, client.nickMaskString, "PRIVMSG", user.nick, message) user.SendFromClient(client, clientOnlyTags, client.nickMaskString, "PRIVMSG", user.nick, message)
if client.capabilities[EchoMessage] {
client.SendFromClient(client, clientOnlyTags, client.nickMaskString, "PRIVMSG", user.nick, message)
}
if user.flags[Away] { if user.flags[Away] {
//TODO(dan): possibly implement cooldown of away notifications to users //TODO(dan): possibly implement cooldown of away notifications to users
client.Send(nil, server.name, RPL_AWAY, user.nick, user.awayMessage) client.Send(nil, server.name, RPL_AWAY, user.nick, user.awayMessage)
@ -1132,6 +1135,9 @@ func noticeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
clientOnlyTags = nil clientOnlyTags = nil
} }
user.SendFromClient(client, clientOnlyTags, client.nickMaskString, "NOTICE", user.nick, message) user.SendFromClient(client, clientOnlyTags, client.nickMaskString, "NOTICE", user.nick, message)
if client.capabilities[EchoMessage] {
client.SendFromClient(client, clientOnlyTags, client.nickMaskString, "NOTICE", user.nick, message)
}
} }
} }
return false return false