chat: Use user.ID() instead of user.Name()

This commit is contained in:
Andrey Petrov 2020-06-24 13:53:14 -04:00
parent 36843252b4
commit cb0bdc8e0e
2 changed files with 3 additions and 3 deletions

View File

@ -206,7 +206,7 @@ func (u *User) writeMsg(m Message) error {
r := u.render(m)
_, err := u.screen.Write([]byte(r))
if err != nil {
logger.Printf("Write failed to %s, closing: %s", u.Name(), err)
logger.Printf("Write failed to %s, closing: %s", u.ID(), err)
u.Close()
}
return err
@ -227,7 +227,7 @@ func (u *User) Send(m Message) error {
return ErrUserClosed
case u.msg <- m:
case <-time.After(messageTimeout):
logger.Printf("Message buffer full, closing: %s", u.Name())
logger.Printf("Message buffer full, closing: %s", u.ID())
u.Close()
return ErrUserClosed
}

View File

@ -239,7 +239,7 @@ func (r *Room) NamesPrefix(prefix string) []string {
// Pull out names
names := make([]string, 0, len(items))
for _, user := range users {
names = append(names, user.Name())
names = append(names, user.ID())
}
return names
}