mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-14 11:58:09 -07:00
accounts: Support account-notify capability
This commit is contained in:
+13
-4
@@ -220,8 +220,7 @@ func authPlainHandler(server *Server, client *Client, mechanism string, value []
|
||||
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.Send(nil, server.name, RPL_SASLSUCCESS, client.nick, "SASL authentication successful")
|
||||
client.successfulSaslAuth()
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -268,7 +267,17 @@ func authExternalHandler(server *Server, client *Client, mechanism string, value
|
||||
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.Send(nil, server.name, RPL_SASLSUCCESS, client.nick, "SASL authentication successful")
|
||||
client.successfulSaslAuth()
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user