aboutsummaryrefslogtreecommitdiff
path: root/ui/messages/parser.go
diff options
context:
space:
mode:
authorSimon Magnin-Feysot <simon.magninfeysot@iguanesolutions.com>2020-04-07 18:06:20 +0200
committerSimon Magnin-Feysot <simon.magninfeysot@iguanesolutions.com>2020-04-07 18:20:06 +0200
commit8b68140dc9e4bc6d51f49a4a38a09e1a0b0ffd67 (patch)
tree6c4c0559986a96cd0807e1fe5d02e2b4b1c1871a /ui/messages/parser.go
parentf0e5e0022f565034393a8d5f0afcbd21470284c3 (diff)
refactor to allow every file message to be downloaded
Diffstat (limited to 'ui/messages/parser.go')
-rw-r--r--ui/messages/parser.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/ui/messages/parser.go b/ui/messages/parser.go
index ce5827a..1c145e5 100644
--- a/ui/messages/parser.go
+++ b/ui/messages/parser.go
@@ -138,15 +138,12 @@ func ParseMessage(matrix ifc.MatrixContainer, room *rooms.Room, evt *event.Event
}
evt.Content.Body = strings.Replace(evt.Content.Body, "\t", " ", -1)
return NewTextMessage(evt, displayname, evt.Content.Body)
- case "m.image":
+ case "m.file", "m.video", "m.audio", "m.image":
data, hs, id, err := matrix.Download(evt.Content.URL)
if err != nil {
debug.Printf("Failed to download %s: %v", evt.Content.URL, err)
}
- return NewImageMessage(matrix, evt, displayname, evt.Content.Body, hs, id, data)
- case "m.video":
- _, hs, id, _ := matrix.Download(evt.Content.URL)
- return NewVideoMessage(matrix, evt, displayname, evt.Content.Body, hs, id)
+ return NewFileMessage(matrix, evt, displayname, evt.Content.Body, hs, id, data)
}
return nil
}