Update dependencies (#1813)

This commit is contained in:
Wim
2022-04-25 23:50:10 +02:00
committed by GitHub
parent 2fca3c7563
commit 67adad3e08
288 changed files with 266038 additions and 3755 deletions

View File

@@ -10,6 +10,7 @@ package whatsmeow
import (
"context"
"crypto/rand"
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
@@ -110,6 +111,8 @@ type Client struct {
// If false, decrypting a message from untrusted devices will fail.
AutoTrustIdentity bool
DebugDecodeBeforeSend bool
uniqueID string
idCounter uint32
@@ -497,6 +500,15 @@ func (cli *Client) sendNode(node waBinary.Node) error {
if err != nil {
return fmt.Errorf("failed to marshal node: %w", err)
}
if cli.DebugDecodeBeforeSend {
var decoded *waBinary.Node
decoded, err = waBinary.Unmarshal(payload[1:])
if err != nil {
cli.Log.Infof("Malformed payload: %s", base64.URLEncoding.EncodeToString(payload))
return fmt.Errorf("failed to decode the binary we just produced: %w", err)
}
node = *decoded
}
cli.sendLog.Debugf("%s", node.XMLString())
return sock.SendFrame(payload)