forked from MirrorHub/mautrix-whatsapp
Update whatsmeow and try to future-proof incoming reactions
This commit is contained in:
parent
4b0302d745
commit
5143f32707
3 changed files with 16 additions and 5 deletions
2
go.mod
2
go.mod
|
@ -11,7 +11,7 @@ require (
|
||||||
github.com/prometheus/client_golang v1.14.0
|
github.com/prometheus/client_golang v1.14.0
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||||
github.com/tidwall/gjson v1.14.3
|
github.com/tidwall/gjson v1.14.3
|
||||||
go.mau.fi/whatsmeow v0.0.0-20221122081206-059049466d44
|
go.mau.fi/whatsmeow v0.0.0-20221126173344-e660988acdbc
|
||||||
golang.org/x/image v0.1.0
|
golang.org/x/image v0.1.0
|
||||||
golang.org/x/net v0.2.0
|
golang.org/x/net v0.2.0
|
||||||
google.golang.org/protobuf v1.28.1
|
google.golang.org/protobuf v1.28.1
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -66,8 +66,8 @@ 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.3/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
go.mau.fi/libsignal v0.0.0-20221015105917-d970e7c3c9cf h1:mzPxXBgDPHKDHMVV1tIWh7lwCiRpzCsXC0gNRX+K07c=
|
go.mau.fi/libsignal v0.0.0-20221015105917-d970e7c3c9cf h1:mzPxXBgDPHKDHMVV1tIWh7lwCiRpzCsXC0gNRX+K07c=
|
||||||
go.mau.fi/libsignal v0.0.0-20221015105917-d970e7c3c9cf/go.mod h1:XCjaU93vl71YNRPn059jMrK0xRDwVO5gKbxoPxow9mQ=
|
go.mau.fi/libsignal v0.0.0-20221015105917-d970e7c3c9cf/go.mod h1:XCjaU93vl71YNRPn059jMrK0xRDwVO5gKbxoPxow9mQ=
|
||||||
go.mau.fi/whatsmeow v0.0.0-20221122081206-059049466d44 h1:2VmJLzAZh/yQIt0hmbwBeciHQpC1tyfX9l1gOUGhhTI=
|
go.mau.fi/whatsmeow v0.0.0-20221126173344-e660988acdbc h1:uZCZs8Ju83OmM1A1+VhpZMXpvVAg5BEQNP0KBXALJBI=
|
||||||
go.mau.fi/whatsmeow v0.0.0-20221122081206-059049466d44/go.mod h1:2yweL8nczvtlIxkrvCb0y8xiO13rveX9lJPambwYV/E=
|
go.mau.fi/whatsmeow v0.0.0-20221126173344-e660988acdbc/go.mod h1:2yweL8nczvtlIxkrvCb0y8xiO13rveX9lJPambwYV/E=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
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.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.2.0 h1:BRXPfhNivWL5Yq0BGQ39a2sW6t44aODpfxkWjYdzewE=
|
golang.org/x/crypto v0.2.0 h1:BRXPfhNivWL5Yq0BGQ39a2sW6t44aODpfxkWjYdzewE=
|
||||||
|
|
13
portal.go
13
portal.go
|
@ -417,6 +417,8 @@ func getMessageType(waMsg *waProto.Message) string {
|
||||||
return "group invite"
|
return "group invite"
|
||||||
case waMsg.ReactionMessage != nil:
|
case waMsg.ReactionMessage != nil:
|
||||||
return "reaction"
|
return "reaction"
|
||||||
|
case waMsg.EncReactionMessage != nil:
|
||||||
|
return "encrypted reaction"
|
||||||
case waMsg.PollCreationMessage != nil:
|
case waMsg.PollCreationMessage != nil:
|
||||||
return "poll create"
|
return "poll create"
|
||||||
case waMsg.PollUpdateMessage != nil:
|
case waMsg.PollUpdateMessage != nil:
|
||||||
|
@ -806,8 +808,17 @@ func (portal *Portal) handleMessage(source *User, evt *events.Message) {
|
||||||
if len(eventID) != 0 {
|
if len(eventID) != 0 {
|
||||||
portal.finishHandling(existingMsg, &evt.Info, eventID, dbMsgType, converted.Error)
|
portal.finishHandling(existingMsg, &evt.Info, eventID, dbMsgType, converted.Error)
|
||||||
}
|
}
|
||||||
} else if msgType == "reaction" {
|
} else if msgType == "reaction" || msgType == "encrypted reaction" {
|
||||||
|
if evt.Message.GetEncReactionMessage() != nil {
|
||||||
|
decryptedReaction, err := source.Client.DecryptReaction(evt)
|
||||||
|
if err != nil {
|
||||||
|
portal.log.Errorfln("Failed to decrypt reaction from %s to %s: %v", evt.Info.Sender, evt.Message.GetEncReactionMessage().GetTargetMessageKey().GetId(), err)
|
||||||
|
} else {
|
||||||
|
portal.HandleMessageReaction(intent, source, &evt.Info, decryptedReaction, existingMsg)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
portal.HandleMessageReaction(intent, source, &evt.Info, evt.Message.GetReactionMessage(), existingMsg)
|
portal.HandleMessageReaction(intent, source, &evt.Info, evt.Message.GetReactionMessage(), existingMsg)
|
||||||
|
}
|
||||||
} else if msgType == "revoke" {
|
} else if msgType == "revoke" {
|
||||||
portal.HandleMessageRevoke(source, &evt.Info, evt.Message.GetProtocolMessage().GetKey())
|
portal.HandleMessageRevoke(source, &evt.Info, evt.Message.GetProtocolMessage().GetKey())
|
||||||
if existingMsg != nil {
|
if existingMsg != nil {
|
||||||
|
|
Loading…
Reference in a new issue