Pārlūkot izejas kodu

Undo incorrect changes

Tulir Asokan 2 gadi atpakaļ
vecāks
revīzija
23c75948f5
3 mainītis faili ar 16 papildinājumiem un 12 dzēšanām
  1. 1 1
      go.mod
  2. 2 2
      go.sum
  3. 13 9
      portal.go

+ 1 - 1
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-20230406111517-0120a5e3f989
+	go.mau.fi/whatsmeow v0.0.0-20230406113034-091a74fe9b32
 	golang.org/x/image v0.6.0
 	golang.org/x/net v0.8.0
 	google.golang.org/protobuf v1.28.1

+ 2 - 2
go.sum

@@ -67,8 +67,8 @@ 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-20230406111517-0120a5e3f989 h1:fa9OHOLT/+bhRSThxGLQ7Qeyb5ayghsJke/Naage/zM=
-go.mau.fi/whatsmeow v0.0.0-20230406111517-0120a5e3f989/go.mod h1:zoTtv1CupGEyTew7TOwnBmTbHB4pVad2OzjTf5CVwa0=
+go.mau.fi/whatsmeow v0.0.0-20230406113034-091a74fe9b32 h1:nLZhYQk4XZbH6Owc7qBQbeFY1wT4mXiGYkxtlfBFg1I=
+go.mau.fi/whatsmeow v0.0.0-20230406113034-091a74fe9b32/go.mod h1:zoTtv1CupGEyTew7TOwnBmTbHB4pVad2OzjTf5CVwa0=
 go.mau.fi/zeroconfig v0.1.2 h1:DKOydWnhPMn65GbXZOafgkPm11BvFashZWLct0dGFto=
 go.mau.fi/zeroconfig v0.1.2/go.mod h1:NcSJkf180JT+1IId76PcMuLTNa1CzsFFZ0nBygIQM70=
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

+ 13 - 9
portal.go

@@ -3984,15 +3984,19 @@ func (portal *Portal) convertMatrixMessage(ctx context.Context, sender *User, ev
 
 	if editRootMsg != nil {
 		msg = &waProto.Message{
-			ProtocolMessage: &waProto.ProtocolMessage{
-				Key: &waProto.MessageKey{
-					FromMe:    proto.Bool(true),
-					Id:        proto.String(editRootMsg.JID),
-					RemoteJid: proto.String(portal.Key.JID.String()),
+			EditedMessage: &waProto.FutureProofMessage{
+				Message: &waProto.Message{
+					ProtocolMessage: &waProto.ProtocolMessage{
+						Key: &waProto.MessageKey{
+							FromMe:    proto.Bool(true),
+							Id:        proto.String(editRootMsg.JID),
+							RemoteJid: proto.String(portal.Key.JID.String()),
+						},
+						Type:          waProto.ProtocolMessage_MESSAGE_EDIT.Enum(),
+						EditedMessage: msg,
+						TimestampMs:   proto.Int64(evt.Timestamp),
+					},
 				},
-				Type:          waProto.ProtocolMessage_MESSAGE_EDIT.Enum(),
-				EditedMessage: msg,
-				TimestampMs:   proto.Int64(evt.Timestamp),
 			},
 		}
 	}
@@ -4086,7 +4090,7 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event, timing
 	dbMsgType := database.MsgNormal
 	if msg.PollCreationMessage != nil || msg.PollCreationMessageV2 != nil {
 		dbMsgType = database.MsgMatrixPoll
-	} else if msg.GetProtocolMessage().GetType() != waProto.ProtocolMessage_MESSAGE_EDIT {
+	} else if msg.EditedMessage == nil {
 		portal.MarkDisappearing(nil, origEvtID, time.Duration(portal.ExpirationTime)*time.Second, time.Now())
 	} else {
 		dbMsgType = database.MsgEdit