mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-13 07:37:17 +03:00
sshchat: Fix empty messages borking rendering
This commit is contained in:
parent
5ff61f0a0f
commit
b8fb704c8f
16
host.go
16
host.go
@ -146,6 +146,14 @@ func (h *Host) Connect(term *sshd.Terminal) {
|
||||
break
|
||||
}
|
||||
|
||||
// Gross hack to override line echo in golang.org/x/crypto/ssh/terminal
|
||||
// It needs to live before we render any responses.
|
||||
term.Write([]byte{
|
||||
27, '[', 'A', // Up
|
||||
27, '[', '2', 'K', // Clear line
|
||||
})
|
||||
// May the gods have mercy on our souls.
|
||||
|
||||
err = ratelimit.Count(1)
|
||||
if err != nil {
|
||||
user.Send(message.NewSystemMsg("Message rejected: Rate limiting is in effect.", user))
|
||||
@ -162,14 +170,6 @@ func (h *Host) Connect(term *sshd.Terminal) {
|
||||
|
||||
m := message.ParseInput(line, user)
|
||||
|
||||
// Gross hack to override line echo in golang.org/x/crypto/ssh/terminal
|
||||
// It needs to live before we render the resulting message.
|
||||
term.Write([]byte{
|
||||
27, '[', 'A', // Up
|
||||
27, '[', '2', 'K', // Clear line
|
||||
})
|
||||
// May the gods have mercy on our souls.
|
||||
|
||||
if m, ok := m.(*message.CommandMsg); ok {
|
||||
// Other messages render themselves by the room, commands we'll
|
||||
// have to re-echo ourselves manually.
|
||||
|
Loading…
x
Reference in New Issue
Block a user