diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bbb13e..6a4f72a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# unreleased + +* Updated portal room power levels to always allow poll votes. +* Fixed disappearing message timing being implemented incorrectly. +* Fixed server rejecting messages not being handled as an error. + # v0.8.1 (2023-01-16) * Added support for sending polls from Matrix to WhatsApp. diff --git a/formatting.go b/formatting.go index 3a0d870..3adb86e 100644 --- a/formatting.go +++ b/formatting.go @@ -56,15 +56,15 @@ func NewFormatter(bridge *WABridge) *Formatter { Newline: "\n", PillConverter: func(displayname, mxid, eventID string, ctx format.Context) string { - _, disableMentions := ctx[disableMentionsContextKey] + _, disableMentions := ctx.ReturnData[disableMentionsContextKey] if mxid[0] == '@' && !disableMentions { puppet := bridge.GetPuppetByMXID(id.UserID(mxid)) if puppet != nil { - jids, ok := ctx[mentionedJIDsContextKey].([]string) + jids, ok := ctx.ReturnData[mentionedJIDsContextKey].([]string) if !ok { - ctx[mentionedJIDsContextKey] = []string{puppet.JID.String()} + ctx.ReturnData[mentionedJIDsContextKey] = []string{puppet.JID.String()} } else { - ctx[mentionedJIDsContextKey] = append(jids, puppet.JID.String()) + ctx.ReturnData[mentionedJIDsContextKey] = append(jids, puppet.JID.String()) } return "@" + puppet.JID.User } @@ -148,14 +148,14 @@ func (formatter *Formatter) ParseWhatsApp(roomID id.RoomID, content *event.Messa } func (formatter *Formatter) ParseMatrix(html string) (string, []string) { - ctx := make(format.Context) + ctx := format.NewContext() result := formatter.matrixHTMLParser.Parse(html, ctx) - mentionedJIDs, _ := ctx[mentionedJIDsContextKey].([]string) + mentionedJIDs, _ := ctx.ReturnData[mentionedJIDsContextKey].([]string) return result, mentionedJIDs } func (formatter *Formatter) ParseMatrixWithoutMentions(html string) string { - ctx := make(format.Context) - ctx[disableMentionsContextKey] = true + ctx := format.NewContext() + ctx.ReturnData[disableMentionsContextKey] = true return formatter.matrixHTMLParser.Parse(html, ctx) } diff --git a/go.mod b/go.mod index 6c5f4f4..f8d6583 100644 --- a/go.mod +++ b/go.mod @@ -11,12 +11,12 @@ require ( github.com/prometheus/client_golang v1.14.0 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/tidwall/gjson v1.14.4 - go.mau.fi/whatsmeow v0.0.0-20230128195103-dcbc8dd31a22 + go.mau.fi/whatsmeow v0.0.0-20230204181151-b1f00ea99464 golang.org/x/image v0.3.0 golang.org/x/net v0.5.0 google.golang.org/protobuf v1.28.1 maunium.net/go/maulogger/v2 v2.3.2 - maunium.net/go/mautrix v0.13.0 + maunium.net/go/mautrix v0.13.1-0.20230204140716-485b4f376dc6 ) require ( @@ -30,11 +30,11 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - github.com/rs/zerolog v1.28.0 // indirect + github.com/rs/zerolog v1.29.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect github.com/tidwall/sjson v1.2.5 // indirect - github.com/yuin/goldmark v1.5.3 // indirect + github.com/yuin/goldmark v1.5.4 // indirect go.mau.fi/libsignal v0.1.0 // indirect golang.org/x/crypto v0.5.0 // indirect golang.org/x/sys v0.4.0 // indirect diff --git a/go.sum b/go.sum index 9feb2f7..28617eb 100644 --- a/go.sum +++ b/go.sum @@ -47,8 +47,8 @@ github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJ github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= -github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= +github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w= +github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= @@ -62,12 +62,12 @@ github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhso github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.5.3 h1:3HUJmBFbQW9fhQOzMgseU134xfi6hU+mjWywx5Ty+/M= -github.com/yuin/goldmark v1.5.3/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yuin/goldmark v1.5.4 h1:2uY/xC0roWy8IBEGLgB1ywIoEJFGmRrX21YQcvGZzjU= +github.com/yuin/goldmark v1.5.4/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mau.fi/libsignal v0.1.0 h1:vAKI/nJ5tMhdzke4cTK1fb0idJzz1JuEIpmjprueC+c= go.mau.fi/libsignal v0.1.0/go.mod h1:R8ovrTezxtUNzCQE5PH30StOQWWeBskBsWE55vMfY9I= -go.mau.fi/whatsmeow v0.0.0-20230128195103-dcbc8dd31a22 h1:za/zmM0hcfEKTRcLtr2zcUFE4VpUw8CndXNeV+v676c= -go.mau.fi/whatsmeow v0.0.0-20230128195103-dcbc8dd31a22/go.mod h1:TrdC8N6SnPFxWo5FiMnDIDFuVyfOLzy5dWDaUPNjcHY= +go.mau.fi/whatsmeow v0.0.0-20230204181151-b1f00ea99464 h1:YsOjRyoipukUqaDHt4pQRi9JazNgCTCl40+2mpLYSm8= +go.mau.fi/whatsmeow v0.0.0-20230204181151-b1f00ea99464/go.mod h1:FYaCKtMD7yDQ7zpTSW28o24GODR75wVZ5OKHUfQySbA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= @@ -122,5 +122,5 @@ maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M= maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA= maunium.net/go/maulogger/v2 v2.3.2 h1:1XmIYmMd3PoQfp9J+PaHhpt80zpfmMqaShzUTC7FwY0= maunium.net/go/maulogger/v2 v2.3.2/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A= -maunium.net/go/mautrix v0.13.0 h1:CRdpMFc1kDSNnCZMcqahR9/pkDy/vgRbd+fHnSCl6Yg= -maunium.net/go/mautrix v0.13.0/go.mod h1:gYMQPsZ9lQpyKlVp+DGwOuc9LIcE/c8GZW2CvKHISgM= +maunium.net/go/mautrix v0.13.1-0.20230204140716-485b4f376dc6 h1:mSq0HwzhpM5XOk+YRgOsEx62AVG6N/lonmz/3iBwf+A= +maunium.net/go/mautrix v0.13.1-0.20230204140716-485b4f376dc6/go.mod h1:3u2Fz3JY/eXVLOzxn2ODVL4rzCIjkkt0jlygEx4Qnaw=