From db0e24ccc268d0a9c7575d660a9397e53747894b Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 10 Apr 2019 21:06:19 +0300 Subject: Use already parsed events for replies if possible --- ui/messages/imagemessage.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ui/messages/imagemessage.go') diff --git a/ui/messages/imagemessage.go b/ui/messages/imagemessage.go index 9bebc11..01a6500 100644 --- a/ui/messages/imagemessage.go +++ b/ui/messages/imagemessage.go @@ -53,6 +53,19 @@ func NewImageMessage(matrix ifc.MatrixContainer, event *mautrix.Event, displayna } } +func (msg *ImageMessage) Clone() UIMessage { + data := make([]byte, len(msg.data)) + copy(data, msg.data) + return &ImageMessage{ + BaseMessage: msg.BaseMessage.clone(), + Body: msg.Body, + Homeserver: msg.Homeserver, + FileID: msg.FileID, + data: data, + matrix: msg.matrix, + } +} + func (msg *ImageMessage) RegisterMatrix(matrix ifc.MatrixContainer) { msg.matrix = matrix -- cgit v1.2.3