diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-09-05 10:55:48 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-09-05 10:55:48 +0300 |
commit | cfb2cc057c32330be0ca0a68cfbd245cb2b8e31b (patch) | |
tree | f0d02d40d41091fd052582fe1fe701c80decf0d7 /ui/messages/parser/htmlparser.go | |
parent | 68db26bcace31297471641fe95f8882e301f5699 (diff) |
Update to latest gomatrix. Things are broken
Diffstat (limited to 'ui/messages/parser/htmlparser.go')
-rw-r--r-- | ui/messages/parser/htmlparser.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/ui/messages/parser/htmlparser.go b/ui/messages/parser/htmlparser.go index c8b000e..bcde14d 100644 --- a/ui/messages/parser/htmlparser.go +++ b/ui/messages/parser/htmlparser.go @@ -22,6 +22,7 @@ import ( "regexp" "strings" + "github.com/lucasb-eyer/go-colorful" "golang.org/x/net/html" "maunium.net/go/gomatrix" "maunium.net/go/gomuks/matrix/rooms" @@ -29,7 +30,6 @@ import ( "maunium.net/go/gomuks/ui/widget" "maunium.net/go/tcell" "strconv" - "github.com/lucasb-eyer/go-colorful" ) var matrixToURL = regexp.MustCompile("^(?:https?://)?(?:www\\.)?matrix\\.to/#/([#@!].*)") @@ -173,7 +173,7 @@ func (parser *htmlParser) linkToTString(node *html.Node, stripLinebreak bool) ts pillTarget := match[1] if pillTarget[0] == '@' { if member := parser.room.GetMember(pillTarget); member != nil { - return tstring.NewColorTString(member.DisplayName, widget.GetHashColor(member.UserID)) + return tstring.NewColorTString(member.Displayname, widget.GetHashColor(pillTarget)) } } return tstring.NewTString(pillTarget) @@ -271,14 +271,13 @@ func (parser *htmlParser) Parse(htmlData string) tstring.TString { // ParseHTMLMessage parses a HTML-formatted Matrix event into a UIMessage. func ParseHTMLMessage(room *rooms.Room, evt *gomatrix.Event, senderDisplayname string) tstring.TString { - htmlData, _ := evt.Content["formatted_body"].(string) + htmlData := evt.Content.FormattedBody htmlData = strings.Replace(htmlData, "\t", " ", -1) parser := htmlParser{room} str := parser.Parse(htmlData) - msgtype, _ := evt.Content["msgtype"].(string) - if msgtype == "m.emote" { + if evt.Content.MsgType == gomatrix.MsgEmote { str = tstring.Join([]tstring.TString{ tstring.NewTString("* "), tstring.NewColorTString(senderDisplayname, widget.GetHashColor(evt.Sender)), |