Update mautrix-go
This commit is contained in:
parent
6b29d90fb4
commit
3658e60d89
2
go.mod
2
go.mod
@ -19,7 +19,7 @@ require (
|
|||||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2
|
golang.org/x/net v0.0.0-20200202094626-16171245cfb2
|
||||||
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
|
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
|
||||||
gopkg.in/yaml.v2 v2.2.8
|
gopkg.in/yaml.v2 v2.2.8
|
||||||
maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229230354-be576ef8fcb1
|
maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229232321-dfc638ec809a
|
||||||
maunium.net/go/mauview v0.0.0-20200220222850-39f1414676d9
|
maunium.net/go/mauview v0.0.0-20200220222850-39f1414676d9
|
||||||
maunium.net/go/tcell v1.1.2-0.20200218183045-87c4a25c5b09
|
maunium.net/go/tcell v1.1.2-0.20200218183045-87c4a25c5b09
|
||||||
)
|
)
|
||||||
|
2
go.sum
2
go.sum
@ -90,6 +90,8 @@ maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229222711-57beb97fdccb h1:b9cMiQ85H
|
|||||||
maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229222711-57beb97fdccb/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4=
|
maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229222711-57beb97fdccb/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4=
|
||||||
maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229230354-be576ef8fcb1 h1:2XQfQNWeNhhEXrb2HgOpTi26o7qq17lQCwSl6wDz2WM=
|
maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229230354-be576ef8fcb1 h1:2XQfQNWeNhhEXrb2HgOpTi26o7qq17lQCwSl6wDz2WM=
|
||||||
maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229230354-be576ef8fcb1/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4=
|
maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229230354-be576ef8fcb1/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4=
|
||||||
|
maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229232321-dfc638ec809a h1:/n9qM9C2c3YUz4S8K2apTxpm2xdZ+7cxGsFi9GJdSfc=
|
||||||
|
maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229232321-dfc638ec809a/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4=
|
||||||
maunium.net/go/mauview v0.0.0-20200218183549-88ecb1321176 h1:KoTm7ASEzFIZ1SvPWuWYzpkeA+wiR1fuUu4l7TCHcE0=
|
maunium.net/go/mauview v0.0.0-20200218183549-88ecb1321176 h1:KoTm7ASEzFIZ1SvPWuWYzpkeA+wiR1fuUu4l7TCHcE0=
|
||||||
maunium.net/go/mauview v0.0.0-20200218183549-88ecb1321176/go.mod h1:jwg3Ow7akzsCX3q38pZAfmEC5gGN8gXwMyyjy/yZVMg=
|
maunium.net/go/mauview v0.0.0-20200218183549-88ecb1321176/go.mod h1:jwg3Ow7akzsCX3q38pZAfmEC5gGN8gXwMyyjy/yZVMg=
|
||||||
maunium.net/go/mauview v0.0.0-20200218231215-04d01c601d5b h1:Bfov5IkJQpkqDexiFioHIZpx4XL7AILDA1GwLVdqtBw=
|
maunium.net/go/mauview v0.0.0-20200218231215-04d01c601d5b h1:Bfov5IkJQpkqDexiFioHIZpx4XL7AILDA1GwLVdqtBw=
|
||||||
|
@ -729,17 +729,10 @@ func (c *Container) MarkRead(roomID, eventID string) {
|
|||||||
_, _ = c.client.MakeRequest("POST", urlPath, struct{}{}, nil)
|
_, _ = 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 {
|
func (c *Container) PrepareMarkdownMessage(roomID string, msgtype mautrix.MessageType, text string, rel *ifc.Relation) *event.Event {
|
||||||
content := format.RenderMarkdown(text)
|
content := format.RenderMarkdown(text)
|
||||||
content.MsgType = msgtype
|
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 {
|
if rel != nil && rel.Type == mautrix.RelReplace {
|
||||||
contentCopy := content
|
contentCopy := content
|
||||||
content.NewContent = &contentCopy
|
content.NewContent = &contentCopy
|
||||||
|
Loading…
Reference in New Issue
Block a user