diff --git a/chat.go b/chat.go index e58464d..70c9750 100644 --- a/chat.go +++ b/chat.go @@ -117,6 +117,8 @@ func (c *ChatViewController) Send(data []byte) error { } func (c *ChatViewController) printMessages(clear bool, messages ...*protocol.Message) { + log.Printf("[ChatViewController::printMessages] printing %d messages", len(messages)) + c.g.Update(func(*gocui.Gui) error { if clear { if err := c.Clear(); err != nil { diff --git a/protocol/client/chat.go b/protocol/client/chat.go index d84dfd5..7e80ad1 100644 --- a/protocol/client/chat.go +++ b/protocol/client/chat.go @@ -330,6 +330,10 @@ func (c *Chat) handleMessages(messages ...*protocol.Message) { hash := messageHashStr(message) + if _, ok := c.messagesByHash[hash]; ok { + continue + } + c.messagesByHash[hash] = message c.messages = append(c.messages, message)