Skip to content

Commit

Permalink
Include DSM metadata in FB group messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Feb 9, 2024
1 parent e82ca29 commit 50c00bd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sendfb.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func (cli *Client) sendGroupV3(
ciphertext := encrypted.SignedSerialize()
timings.GroupEncrypt = time.Since(start)

node, allDevices, err := cli.prepareMessageNodeV3(ctx, to, ownID, id, nil, skdm, nil, msgAttrs, frankingTag, participants, timings)
node, allDevices, err := cli.prepareMessageNodeV3(ctx, to, ownID, id, nil, skdm, msgAttrs, frankingTag, participants, timings)
if err != nil {
return "", nil, err
}
Expand Down Expand Up @@ -281,10 +281,6 @@ func (cli *Client) sendDMV3(
frankingTag []byte,
timings *MessageDebugTimings,
) ([]byte, string, error) {
dsm := &waMsgTransport.MessageTransport_Protocol_Integral_DeviceSentMessage{
DestinationJID: to.String(),
Phash: "",
}
payload := &waMsgTransport.MessageTransport_Payload{
ApplicationPayload: &waCommon.SubProtocol{
Payload: messageApp,
Expand All @@ -293,7 +289,7 @@ func (cli *Client) sendDMV3(
FutureProof: waCommon.FutureProofBehavior_PLACEHOLDER,
}

node, allDevices, err := cli.prepareMessageNodeV3(ctx, to, ownID, id, payload, nil, dsm, msgAttrs, frankingTag, []types.JID{to, ownID.ToNonAD()}, timings)
node, allDevices, err := cli.prepareMessageNodeV3(ctx, to, ownID, id, payload, nil, msgAttrs, frankingTag, []types.JID{to, ownID.ToNonAD()}, timings)
if err != nil {
return nil, "", err
}
Expand Down Expand Up @@ -394,7 +390,6 @@ func (cli *Client) prepareMessageNodeV3(
id types.MessageID,
payload *waMsgTransport.MessageTransport_Payload,
skdm *waMsgTransport.MessageTransport_Protocol_Ancillary_SenderKeyDistributionMessage,
dsm *waMsgTransport.MessageTransport_Protocol_Integral_DeviceSentMessage,
msgAttrs messageAttrs,
frankingTag []byte,
participants []types.JID,
Expand Down Expand Up @@ -424,6 +419,11 @@ func (cli *Client) prepareMessageNodeV3(
encAttrs["decrypt-fail"] = string(msgAttrs.DecryptFail)
}

dsm := &waMsgTransport.MessageTransport_Protocol_Integral_DeviceSentMessage{
DestinationJID: to.String(),
Phash: "",
}

start = time.Now()
participantNodes := cli.encryptMessageForDevicesV3(ctx, allDevices, ownID, id, payload, skdm, dsm, encAttrs)
timings.PeerEncrypt = time.Since(start)
Expand Down

0 comments on commit 50c00bd

Please sign in to comment.