3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-01 16:39:26 +01:00

Send a whole lot more snomasks

This commit is contained in:
Daniel Oaks 2017-05-28 12:43:09 -06:00
parent ebb9d629d7
commit 53190ef131
5 changed files with 14 additions and 0 deletions

View File

@ -12,7 +12,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/DanielOaks/girc-go/ircfmt"
"github.com/DanielOaks/girc-go/ircmsg" "github.com/DanielOaks/girc-go/ircmsg"
"github.com/DanielOaks/oragono/irc/sno"
"github.com/tidwall/buntdb" "github.com/tidwall/buntdb"
) )
@ -262,6 +264,7 @@ func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage) b
client.Send(nil, server.name, RPL_REGISTRATION_SUCCESS, client.nick, account.Name, "Account created") client.Send(nil, server.name, RPL_REGISTRATION_SUCCESS, client.nick, account.Name, "Account created")
client.Send(nil, server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, account.Name, fmt.Sprintf("You are now logged in as %s", account.Name)) client.Send(nil, server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, account.Name, fmt.Sprintf("You are now logged in as %s", account.Name))
client.Send(nil, server.name, RPL_SASLSUCCESS, client.nick, "Authentication successful") client.Send(nil, server.name, RPL_SASLSUCCESS, client.nick, "Authentication successful")
server.snomasks.Send(sno.LocalAccounts, fmt.Sprintf(ircfmt.Unescape("Account registered $c[grey][$r%s$c[grey]] by $c[grey][$r%s$c[grey]]"), account.Name, client.nickMaskString))
return nil return nil
}) })
if err != nil { if err != nil {

View File

@ -13,7 +13,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/DanielOaks/girc-go/ircfmt"
"github.com/DanielOaks/girc-go/ircmsg" "github.com/DanielOaks/girc-go/ircmsg"
"github.com/DanielOaks/oragono/irc/sno"
"github.com/tidwall/buntdb" "github.com/tidwall/buntdb"
) )
@ -263,6 +265,7 @@ func (client *Client) LoginToAccount(account *ClientAccount) {
account.Clients = append(account.Clients, client) account.Clients = append(account.Clients, client)
client.account = account client.account = account
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]]"), client.nickMaskString, account.Name))
} }
// authExternalHandler parses the SASL EXTERNAL mechanism. // authExternalHandler parses the SASL EXTERNAL mechanism.

View File

@ -8,7 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/DanielOaks/girc-go/ircfmt"
"github.com/DanielOaks/girc-go/ircmsg" "github.com/DanielOaks/girc-go/ircmsg"
"github.com/DanielOaks/oragono/irc/sno"
"github.com/tidwall/buntdb" "github.com/tidwall/buntdb"
) )
@ -101,6 +103,7 @@ func (server *Server) chanservReceivePrivmsg(client *Client, message string) {
client.ChanServNotice(fmt.Sprintf("Channel %s successfully registered", channelName)) client.ChanServNotice(fmt.Sprintf("Channel %s successfully registered", channelName))
server.logger.Info("chanserv", fmt.Sprintf("Client %s registered channel %s", client.nick, channelName)) server.logger.Info("chanserv", fmt.Sprintf("Client %s registered channel %s", client.nick, channelName))
server.snomasks.Send(sno.LocalChannels, fmt.Sprintf(ircfmt.Unescape("Channel registered $c[grey][$r%s$c[grey]] by $c[grey][$r%s$c[grey]]"), channelName, client.nickMaskString))
channelInfo.membersMutex.Lock() channelInfo.membersMutex.Lock()
defer channelInfo.membersMutex.Unlock() defer channelInfo.membersMutex.Unlock()

View File

@ -16,8 +16,10 @@ import (
"sync" "sync"
"time" "time"
"github.com/DanielOaks/girc-go/ircfmt"
"github.com/DanielOaks/girc-go/ircmsg" "github.com/DanielOaks/girc-go/ircmsg"
"github.com/DanielOaks/go-ident" "github.com/DanielOaks/go-ident"
"github.com/DanielOaks/oragono/irc/sno"
) )
const ( const (
@ -435,6 +437,7 @@ func (client *Client) ChangeNickname(nickname string) error {
err := client.server.clients.Replace(client.nick, nickname, client) err := client.server.clients.Replace(client.nick, nickname, client)
if err == nil { if err == nil {
client.server.logger.Debug("nick", fmt.Sprintf("%s changed nickname to %s", client.nick, nickname)) client.server.logger.Debug("nick", fmt.Sprintf("%s changed nickname to %s", client.nick, nickname))
client.server.snomasks.Send(sno.LocalNicks, fmt.Sprintf(ircfmt.Unescape("Nick changed $c[grey][$r%s$c[grey]] to [$r%s$c[grey]]"), client.nick, nickname))
client.server.whoWas.Append(client) client.server.whoWas.Append(client)
client.nick = nickname client.nick = nickname
client.updateNickMask() client.updateNickMask()

View File

@ -1298,6 +1298,8 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
op: Add, op: Add,
}) })
client.Send(nil, server.name, "MODE", client.nick, applied.String()) client.Send(nil, server.name, "MODE", client.nick, applied.String())
server.snomasks.Send(sno.LocalOpers, fmt.Sprintf(ircfmt.Unescape("Client opered up $c[grey][$r%s$c[grey], $r%s$c[grey]]"), client.nickMaskString, client.operName))
return false return false
} }