mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 11:59:40 +01:00
accounts: Add account-tag capability
This commit is contained in:
parent
c2aa31001a
commit
754b74c21c
@ -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 [`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), [`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.
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
type Capability string
|
||||
|
||||
const (
|
||||
AccountTag Capability = "account-tag"
|
||||
ExtendedJoin Capability = "extended-join"
|
||||
MultiPrefix Capability = "multi-prefix"
|
||||
SASL Capability = "sasl"
|
||||
@ -23,6 +24,7 @@ const (
|
||||
|
||||
var (
|
||||
SupportedCapabilities = CapabilitySet{
|
||||
AccountTag: true,
|
||||
ExtendedJoin: true,
|
||||
MultiPrefix: true,
|
||||
SASL: true,
|
||||
|
@ -304,8 +304,7 @@ func (channel *Channel) PrivMsg(client *Client, message string) {
|
||||
if member == client {
|
||||
continue
|
||||
}
|
||||
//TODO(dan): use nickmask instead of nickString here lel
|
||||
member.Send(nil, client.nickMaskString, "PRIVMSG", channel.nameString, message)
|
||||
member.SendFromClient(client, nil, client.nickMaskString, "PRIVMSG", channel.nameString, message)
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,7 +451,7 @@ func (channel *Channel) Notice(client *Client, message string) {
|
||||
if member == client {
|
||||
continue
|
||||
}
|
||||
member.Send(nil, client.nickMaskString, "NOTICE", channel.nameString, message)
|
||||
member.SendFromClient(client, nil, client.nickMaskString, "NOTICE", channel.nameString, message)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,6 +349,21 @@ func (client *Client) destroy() {
|
||||
}
|
||||
}
|
||||
|
||||
// SendFromClient sends an IRC line coming from a specific client.
|
||||
// Adds account-tag to the line as well.
|
||||
func (client *Client) SendFromClient(from *Client, tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) error {
|
||||
// attach account-tag
|
||||
if client.capabilities[AccountTag] && from.account != &NoAccount {
|
||||
if tags == nil {
|
||||
tags = ircmsg.MakeTags("account", from.account.Name)
|
||||
} else {
|
||||
(*tags)["account"] = ircmsg.MakeTagValue(from.account.Name)
|
||||
}
|
||||
}
|
||||
|
||||
return client.Send(tags, prefix, command, params...)
|
||||
}
|
||||
|
||||
// Send sends an IRC line to the client.
|
||||
func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) error {
|
||||
// attach server-time
|
||||
|
Loading…
Reference in New Issue
Block a user