diff options
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/client.go')
-rw-r--r-- | vendor/go.mau.fi/whatsmeow/client.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/client.go b/vendor/go.mau.fi/whatsmeow/client.go index 41bad823..75054cea 100644 --- a/vendor/go.mau.fi/whatsmeow/client.go +++ b/vendor/go.mau.fi/whatsmeow/client.go @@ -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) |