Wrap events in custom struct to add gomuks-specific fields

This commit is contained in:
Tulir Asokan
2019-06-17 12:27:31 +03:00
parent 754f8e493d
commit fe439f076a
16 changed files with 167 additions and 113 deletions

View File

@ -27,6 +27,7 @@ import (
"github.com/lucasb-eyer/go-colorful"
"golang.org/x/net/html"
"maunium.net/go/gomuks/matrix/event"
"maunium.net/go/mautrix"
"maunium.net/go/tcell"
@ -382,7 +383,7 @@ func (parser *htmlParser) Parse(htmlData string) Entity {
const TabLength = 4
// Parse parses a HTML-formatted Matrix event into a UIMessage.
func Parse(room *rooms.Room, evt *mautrix.Event, senderDisplayname string) Entity {
func Parse(room *rooms.Room, evt *event.Event, senderDisplayname string) Entity {
htmlData := evt.Content.FormattedBody
if evt.Content.Format != mautrix.FormatHTML {
htmlData = strings.Replace(html.EscapeString(evt.Content.Body), "\n", "<br/>", -1)