From 16277a8702125034635b237a24083944a1ebecde Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 1 Jan 2023 13:30:09 +0200 Subject: [PATCH] Update whatsmeow --- go.mod | 4 ++-- go.sum | 8 ++++---- portal.go | 8 ++++---- user.go | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 0479534..480afae 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ 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-20221221211611-6a0e825b4049 + go.mau.fi/whatsmeow v0.0.0-20230101112920-9b93048f5e21 golang.org/x/image v0.2.0 golang.org/x/net v0.4.0 google.golang.org/protobuf v1.28.1 @@ -35,7 +35,7 @@ require ( github.com/tidwall/pretty v1.2.0 // indirect github.com/tidwall/sjson v1.2.5 // indirect github.com/yuin/goldmark v1.5.3 // indirect - go.mau.fi/libsignal v0.0.0-20221015105917-d970e7c3c9cf // indirect + go.mau.fi/libsignal v0.1.0 // indirect golang.org/x/crypto v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/go.sum b/go.sum index a9b7bd2..e1add5e 100644 --- a/go.sum +++ b/go.sum @@ -64,10 +64,10 @@ github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6 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= -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/whatsmeow v0.0.0-20221221211611-6a0e825b4049 h1:QM3QppkH6DQWWROgR084Xj5g5ZHwGBFJVBpAua6Rkpg= -go.mau.fi/whatsmeow v0.0.0-20221221211611-6a0e825b4049/go.mod h1:2yweL8nczvtlIxkrvCb0y8xiO13rveX9lJPambwYV/E= +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-20230101112920-9b93048f5e21 h1:iDNhclPIMzMP2J3RW2d9qn+yjjV7TKt0WkcnRUiFonQ= +go.mau.fi/whatsmeow v0.0.0-20230101112920-9b93048f5e21/go.mod h1:TrdC8N6SnPFxWo5FiMnDIDFuVyfOLzy5dWDaUPNjcHY= 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.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= diff --git a/portal.go b/portal.go index a871cf1..8cbe6cc 100644 --- a/portal.go +++ b/portal.go @@ -4038,7 +4038,7 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event, timing } portal.log.Debugln("Sending event", evt.ID, "to WhatsApp", info.ID) start = time.Now() - resp, err := sender.Client.SendMessage(ctx, portal.Key.JID, info.ID, msg) + resp, err := sender.Client.SendMessage(ctx, portal.Key.JID, msg, whatsmeow.SendRequestExtra{ID: info.ID}) timings.totalSend = time.Since(start) timings.whatsmeow = resp.DebugTimings go ms.sendMessageMetrics(evt, err, "Error sending", true) @@ -4100,7 +4100,7 @@ func (portal *Portal) sendReactionToWhatsApp(sender *User, id types.MessageID, t messageKeyParticipant = proto.String(target.Sender.ToNonAD().String()) } key = variationselector.Remove(key) - return sender.Client.SendMessage(context.TODO(), portal.Key.JID, id, &waProto.Message{ + return sender.Client.SendMessage(context.TODO(), portal.Key.JID, &waProto.Message{ ReactionMessage: &waProto.ReactionMessage{ Key: &waProto.MessageKey{ RemoteJid: proto.String(portal.Key.JID.String()), @@ -4111,7 +4111,7 @@ func (portal *Portal) sendReactionToWhatsApp(sender *User, id types.MessageID, t Text: proto.String(key), SenderTimestampMs: proto.Int64(timestamp), }, - }) + }, whatsmeow.SendRequestExtra{ID: id}) } func (portal *Portal) upsertReaction(txn dbutil.Transaction, intent *appservice.IntentAPI, targetJID types.MessageID, senderJID types.JID, mxid id.EventID, jid types.MessageID) { @@ -4186,7 +4186,7 @@ func (portal *Portal) HandleMatrixRedaction(sender *User, evt *event.Event) { key.Participant = proto.String(msg.Sender.ToNonAD().String()) } portal.log.Debugfln("Sending redaction %s of %s/%s to WhatsApp", evt.ID, msg.MXID, msg.JID) - _, err := sender.Client.SendMessage(context.TODO(), portal.Key.JID, "", &waProto.Message{ + _, err := sender.Client.SendMessage(context.TODO(), portal.Key.JID, &waProto.Message{ ProtocolMessage: &waProto.ProtocolMessage{ Type: waProto.ProtocolMessage_REVOKE.Enum(), Key: key, diff --git a/user.go b/user.go index b913dd3..d2d558d 100644 --- a/user.go +++ b/user.go @@ -677,14 +677,14 @@ func (user *User) sendHackyPhonePing() { } else { user.log.Warnfln("Failed to get last app state key ID to send hacky phone ping: %v - sending empty request", err) } - resp, err := user.Client.SendMessage(context.Background(), user.JID.ToNonAD(), msgID, &waProto.Message{ + resp, err := user.Client.SendMessage(context.Background(), user.JID.ToNonAD(), &waProto.Message{ ProtocolMessage: &waProto.ProtocolMessage{ Type: waProto.ProtocolMessage_APP_STATE_SYNC_KEY_REQUEST.Enum(), AppStateSyncKeyRequest: &waProto.AppStateSyncKeyRequest{ KeyIds: keyIDs, }, }, - }) + }, whatsmeow.SendRequestExtra{Peer: true, ID: msgID}) if err != nil { user.log.Warnfln("Failed to send hacky phone ping: %v", err) } else {