Remove downstreamConn.username

Replace it with downstreamConn.user.Username
This commit is contained in:
Simon Ser 2020-03-28 17:28:28 +01:00
parent b7e442670d
commit 6ff26e6640
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -69,7 +69,6 @@ type downstreamConn struct {
registered bool registered bool
user *user user *user
nick string nick string
username string
rawUsername string rawUsername string
networkName string networkName string
clientName string clientName string
@ -124,7 +123,7 @@ func newDownstreamConn(srv *Server, netConn net.Conn, id uint64) *downstreamConn
func (dc *downstreamConn) prefix() *irc.Prefix { func (dc *downstreamConn) prefix() *irc.Prefix {
return &irc.Prefix{ return &irc.Prefix{
Name: dc.nick, Name: dc.nick,
User: dc.username, User: dc.user.Username,
Host: dc.hostname, Host: dc.hostname,
} }
} }
@ -636,8 +635,7 @@ func (dc *downstreamConn) register() error {
} }
dc.registered = true dc.registered = true
dc.username = dc.user.Username dc.logger.Printf("registration complete for user %q", dc.user.Username)
dc.logger.Printf("registration complete for user %q", dc.username)
return nil return nil
} }
@ -1171,7 +1169,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: irc.RPL_WHOREPLY, Command: irc.RPL_WHOREPLY,
Params: []string{dc.nick, "*", dc.username, dc.hostname, dc.srv.Hostname, dc.nick, "H", "0 " + dc.realname}, Params: []string{dc.nick, "*", dc.user.Username, dc.hostname, dc.srv.Hostname, dc.nick, "H", "0 " + dc.realname},
}) })
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
@ -1222,7 +1220,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: irc.RPL_WHOISUSER, Command: irc.RPL_WHOISUSER,
Params: []string{dc.nick, dc.nick, dc.username, dc.hostname, "*", dc.realname}, Params: []string{dc.nick, dc.nick, dc.user.Username, dc.hostname, "*", dc.realname},
}) })
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),