3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-14 07:59:31 +01:00

Merge pull request #1414 from slingamn/issue1396_account_snomask

fix #1396
This commit is contained in:
Shivaram Lingamneni 2020-11-29 19:46:12 -08:00 committed by GitHub
commit b4cd62bece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View File

@ -102,6 +102,7 @@ func sendSuccessfulAccountAuth(service *ircService, client *Client, rb *Response
} }
} }
if client.Registered() {
// dispatch account-notify // dispatch account-notify
for friend := range client.Friends(caps.AccountNotify) { for friend := range client.Friends(caps.AccountNotify) {
if friend != rb.session { if friend != rb.session {
@ -111,12 +112,16 @@ func sendSuccessfulAccountAuth(service *ircService, client *Client, rb *Response
if rb.session.capabilities.Has(caps.AccountNotify) { if rb.session.capabilities.Has(caps.AccountNotify) {
rb.Add(nil, details.nickMask, "ACCOUNT", details.accountName) rb.Add(nil, details.nickMask, "ACCOUNT", details.accountName)
} }
client.server.sendLoginSnomask(details.nickMask, details.accountName)
client.server.snomasks.Send(sno.LocalAccounts, fmt.Sprintf(ircfmt.Unescape("Client $c[grey][$r%s$c[grey]] logged into account $c[grey][$r%s$c[grey]]"), details.nickMask, details.accountName)) }
client.server.logger.Info("accounts", "client", details.nick, "logged into account", details.accountName) client.server.logger.Info("accounts", "client", details.nick, "logged into account", details.accountName)
} }
func (server *Server) sendLoginSnomask(nickMask, accountName string) {
server.snomasks.Send(sno.LocalAccounts, fmt.Sprintf(ircfmt.Unescape("Client $c[grey][$r%s$c[grey]] logged into account $c[grey][$r%s$c[grey]]"), nickMask, accountName))
}
// AUTHENTICATE [<mechanism>|<data>|*] // AUTHENTICATE [<mechanism>|<data>|*]
func authenticateHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool { func authenticateHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
session := rb.session session := rb.session

View File

@ -344,6 +344,9 @@ func (server *Server) playRegistrationBurst(session *Session) {
d := c.Details() d := c.Details()
server.logger.Info("connect", fmt.Sprintf("Client connected [%s] [u:%s] [r:%s]", d.nick, d.username, d.realname)) server.logger.Info("connect", fmt.Sprintf("Client connected [%s] [u:%s] [r:%s]", d.nick, d.username, d.realname))
server.snomasks.Send(sno.LocalConnects, fmt.Sprintf("Client connected [%s] [u:%s] [h:%s] [ip:%s] [r:%s]", d.nick, d.username, session.rawHostname, session.IP().String(), d.realname)) server.snomasks.Send(sno.LocalConnects, fmt.Sprintf("Client connected [%s] [u:%s] [h:%s] [ip:%s] [r:%s]", d.nick, d.username, session.rawHostname, session.IP().String(), d.realname))
if d.account != "" {
server.sendLoginSnomask(d.nickMask, d.accountName)
}
// send welcome text // send welcome text
//NOTE(dan): we specifically use the NICK here instead of the nickmask //NOTE(dan): we specifically use the NICK here instead of the nickmask