mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
accounts: Support account-notify capability
This commit is contained in:
parent
0eebd6273c
commit
4fa094cea2
@ -12,6 +12,7 @@ Improved compatibility, more features, etc.
|
|||||||
### Security
|
### Security
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
* Support for IRCv3 capability [`account-notify`](http://ircv3.net/specs/extensions/account-notify-3.1.html)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Casemapping changed from custom unicode mapping to preliminary [rfc7700](https://github.com/ircv3/ircv3-specifications/pull/272) mapping.
|
* Casemapping changed from custom unicode mapping to preliminary [rfc7700](https://github.com/ircv3/ircv3-specifications/pull/272) mapping.
|
||||||
|
@ -220,8 +220,7 @@ func authPlainHandler(server *Server, client *Client, mechanism string, value []
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
client.Send(nil, server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, client.account.Name, fmt.Sprintf("You are now logged in as %s", client.account.Name))
|
client.successfulSaslAuth()
|
||||||
client.Send(nil, server.name, RPL_SASLSUCCESS, client.nick, "SASL authentication successful")
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +267,17 @@ func authExternalHandler(server *Server, client *Client, mechanism string, value
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
client.Send(nil, server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, client.account.Name, fmt.Sprintf("You are now logged in as %s", client.account.Name))
|
client.successfulSaslAuth()
|
||||||
client.Send(nil, server.name, RPL_SASLSUCCESS, client.nick, "SASL authentication successful")
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// successfulSaslAuth means that a SASL auth attempt completed successfully, and is used to dispatch messages.
|
||||||
|
func (c *Client) successfulSaslAuth() {
|
||||||
|
c.Send(nil, c.server.name, RPL_LOGGEDIN, c.nick, c.nickMaskString, c.account.Name, fmt.Sprintf("You are now logged in as %s", c.account.Name))
|
||||||
|
c.Send(nil, c.server.name, RPL_SASLSUCCESS, c.nick, "SASL authentication successful")
|
||||||
|
|
||||||
|
// dispatch account-notify
|
||||||
|
for friend := range c.Friends(AccountNotify) {
|
||||||
|
friend.Send(nil, c.nickMaskString, "ACCOUNT", c.account.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -15,6 +15,7 @@ type Capability string
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AccountTag Capability = "account-tag"
|
AccountTag Capability = "account-tag"
|
||||||
|
AccountNotify Capability = "account-notify"
|
||||||
AwayNotify Capability = "away-notify"
|
AwayNotify Capability = "away-notify"
|
||||||
ExtendedJoin Capability = "extended-join"
|
ExtendedJoin Capability = "extended-join"
|
||||||
MultiPrefix Capability = "multi-prefix"
|
MultiPrefix Capability = "multi-prefix"
|
||||||
@ -26,6 +27,7 @@ const (
|
|||||||
var (
|
var (
|
||||||
SupportedCapabilities = CapabilitySet{
|
SupportedCapabilities = CapabilitySet{
|
||||||
AccountTag: true,
|
AccountTag: true,
|
||||||
|
AccountNotify: true,
|
||||||
AwayNotify: true,
|
AwayNotify: true,
|
||||||
ExtendedJoin: true,
|
ExtendedJoin: true,
|
||||||
MultiPrefix: true,
|
MultiPrefix: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user