mirror of
				https://github.com/ergochat/ergo.git
				synced 2025-11-04 07:47:25 +01:00 
			
		
		
		
	Implement echo-message capability
This commit is contained in:
		
							parent
							
								
									b84dbb1a06
								
							
						
					
					
						commit
						d9db688963
					
				@ -13,7 +13,7 @@ New release of Oragono!
 | 
			
		||||
### Added
 | 
			
		||||
* Added `REHASH` command.
 | 
			
		||||
* 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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,7 @@ const (
 | 
			
		||||
	AccountNotify   Capability = "account-notify"
 | 
			
		||||
	AwayNotify      Capability = "away-notify"
 | 
			
		||||
	CapNotify       Capability = "cap-notify"
 | 
			
		||||
	EchoMessage     Capability = "echo-message"
 | 
			
		||||
	ExtendedJoin    Capability = "extended-join"
 | 
			
		||||
	InviteNotify    Capability = "invite-notify"
 | 
			
		||||
	MessageTags     Capability = "draft/message-tags"
 | 
			
		||||
@ -33,6 +34,7 @@ var (
 | 
			
		||||
		AccountNotify: true,
 | 
			
		||||
		AwayNotify:    true,
 | 
			
		||||
		CapNotify:     true,
 | 
			
		||||
		EchoMessage:   true,
 | 
			
		||||
		ExtendedJoin:  true,
 | 
			
		||||
		InviteNotify:  true,
 | 
			
		||||
		MessageTags:   true,
 | 
			
		||||
 | 
			
		||||
@ -314,7 +314,7 @@ func (channel *Channel) PrivMsg(clientOnlyTags *map[string]ircmsg.TagValue, clie
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	for member := range channel.members {
 | 
			
		||||
		if member == client {
 | 
			
		||||
		if member == client && !client.capabilities[EchoMessage] {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		if member.capabilities[MessageTags] {
 | 
			
		||||
 | 
			
		||||
@ -705,6 +705,9 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
 | 
			
		||||
				clientOnlyTags = nil
 | 
			
		||||
			}
 | 
			
		||||
			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] {
 | 
			
		||||
				//TODO(dan): possibly implement cooldown of away notifications to users
 | 
			
		||||
				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
 | 
			
		||||
			}
 | 
			
		||||
			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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user