Disabled autocomplete due to #166.

Also added mutex for user replyTo pointer, since that's being set by
both the host and user.
This commit is contained in:
Andrey Petrov 2016-08-03 12:18:13 -04:00
parent 1662ecd431
commit c4604fde94
2 changed files with 9 additions and 2 deletions

View File

@ -28,9 +28,11 @@ type User struct {
done chan struct{} done chan struct{}
Ignored *common.IdSet Ignored *common.IdSet
replyTo *User // Set when user gets a /msg, for replying.
screen io.WriteCloser screen io.WriteCloser
closeOnce sync.Once closeOnce sync.Once
mu sync.Mutex
replyTo *User // Set when user gets a /msg, for replying.
} }
func NewUser(identity Identifier) *User { func NewUser(identity Identifier) *User {
@ -62,11 +64,15 @@ func (u *User) SetId(id string) {
// ReplyTo returns the last user that messaged this user. // ReplyTo returns the last user that messaged this user.
func (u *User) ReplyTo() *User { func (u *User) ReplyTo() *User {
u.mu.Lock()
defer u.mu.Unlock()
return u.replyTo return u.replyTo
} }
// SetReplyTo sets the last user to message this user. // SetReplyTo sets the last user to message this user.
func (u *User) SetReplyTo(user *User) { func (u *User) SetReplyTo(user *User) {
u.mu.Lock()
defer u.mu.Unlock()
u.replyTo = user u.replyTo = user
} }

View File

@ -120,7 +120,8 @@ func (h *Host) Connect(term *sshd.Terminal) {
// Successfully joined. // Successfully joined.
term.SetPrompt(GetPrompt(user)) term.SetPrompt(GetPrompt(user))
term.AutoCompleteCallback = h.AutoCompleteFunction(user) // FIXME: Re-enable once https://github.com/shazow/ssh-chat/issues/166 is fixed.
//term.AutoCompleteCallback = h.AutoCompleteFunction(user)
user.SetHighlight(user.Name()) user.SetHighlight(user.Name())
// Should the user be op'd on join? // Should the user be op'd on join?