Update mautrix-go

This commit is contained in:
Tulir Asokan
2020-03-01 01:24:27 +02:00
parent 6b29d90fb4
commit 3658e60d89
3 changed files with 3 additions and 8 deletions

View File

@ -729,17 +729,10 @@ func (c *Container) MarkRead(roomID, eventID string) {
_, _ = c.client.MakeRequest("POST", urlPath, struct{}{}, nil)
}
var mentionRegex = regexp.MustCompile("\\[(.+?)]\\(https://matrix.to/#/@.+?:.+?\\)")
var roomRegex = regexp.MustCompile("\\[.+?]\\(https://matrix.to/#/(#.+?:[^/]+?)\\)")
func (c *Container) PrepareMarkdownMessage(roomID string, msgtype mautrix.MessageType, text string, rel *ifc.Relation) *event.Event {
content := format.RenderMarkdown(text)
content.MsgType = msgtype
// Remove markdown link stuff from plaintext mentions and room links
content.Body = mentionRegex.ReplaceAllString(content.Body, "$1")
content.Body = roomRegex.ReplaceAllString(content.Body, "$1")
if rel != nil && rel.Type == mautrix.RelReplace {
contentCopy := content
content.NewContent = &contentCopy