From f4e4278158f8916eb836a26f2e3fd4604da4678f Mon Sep 17 00:00:00 2001 From: Gellert Hegyi Date: Wed, 8 Nov 2023 13:56:25 +0800 Subject: [PATCH 1/2] adds missing call event types --- call.go | 18 ++++++++++++++++++ internals.go | 14 ++++++++++++++ types/events/call.go | 14 ++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/call.go b/call.go index f4de9bd8..7a6ffcb2 100644 --- a/call.go +++ b/call.go @@ -59,6 +59,24 @@ func (cli *Client) handleCallEvent(node *waBinary.Node) { }, Data: &child, }) + case "preaccept": + cli.dispatchEvent(&events.CallPreAccept{ + BasicCallMeta: basicMeta, + CallRemoteMeta: types.CallRemoteMeta{ + RemotePlatform: ag.String("platform"), + RemoteVersion: ag.String("version"), + }, + Data: &child, + }) + case "transport": + cli.dispatchEvent(&events.CallTransport{ + BasicCallMeta: basicMeta, + CallRemoteMeta: types.CallRemoteMeta{ + RemotePlatform: ag.String("platform"), + RemoteVersion: ag.String("version"), + }, + Data: &child, + }) case "terminate": cli.dispatchEvent(&events.CallTerminate{ BasicCallMeta: basicMeta, diff --git a/internals.go b/internals.go index 8227b0ce..0ead70ea 100644 --- a/internals.go +++ b/internals.go @@ -9,6 +9,8 @@ package whatsmeow import ( "context" + "go.mau.fi/libsignal/keys/prekey" + waBinary "go.mau.fi/whatsmeow/binary" "go.mau.fi/whatsmeow/types" ) @@ -66,3 +68,15 @@ func (int *DangerousInternalClient) RequestAppStateKeys(ctx context.Context, key func (int *DangerousInternalClient) SendRetryReceipt(node *waBinary.Node, info *types.MessageInfo, forceIncludeIdentity bool) { int.c.sendRetryReceipt(node, info, forceIncludeIdentity) } + +func (int *DangerousInternalClient) EncryptMessageForDevice(plaintext []byte, to types.JID, bundle *prekey.Bundle, extraAttrs waBinary.Attrs) (*waBinary.Node, bool, error) { + return int.c.encryptMessageForDevice(plaintext, to, bundle, extraAttrs) +} + +func (int *DangerousInternalClient) GetOwnID() types.JID { + return int.c.getOwnID() +} + +func (int *DangerousInternalClient) DecryptDM(child *waBinary.Node, from types.JID, isPreKey bool) ([]byte, error) { + return int.c.decryptDM(child, from, isPreKey) +} diff --git a/types/events/call.go b/types/events/call.go index 3622cb53..8ced457c 100644 --- a/types/events/call.go +++ b/types/events/call.go @@ -27,6 +27,20 @@ type CallAccept struct { Data *waBinary.Node } +type CallPreAccept struct { + types.BasicCallMeta + types.CallRemoteMeta + + Data *waBinary.Node +} + +type CallTransport struct { + types.BasicCallMeta + types.CallRemoteMeta + + Data *waBinary.Node +} + // CallOfferNotice is emitted when the user receives a notice of a call on WhatsApp. // This seems to be primarily for group calls (whereas CallOffer is for 1:1 calls). type CallOfferNotice struct { From 327bb5813b4a5fb19480ddb468c73e5afed81ab4 Mon Sep 17 00:00:00 2001 From: Gellert Hegyi Date: Sun, 12 Nov 2023 19:37:36 +0800 Subject: [PATCH 2/2] adds makedeviceentitynode method to internals --- internals.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internals.go b/internals.go index 0ead70ea..126eb938 100644 --- a/internals.go +++ b/internals.go @@ -80,3 +80,7 @@ func (int *DangerousInternalClient) GetOwnID() types.JID { func (int *DangerousInternalClient) DecryptDM(child *waBinary.Node, from types.JID, isPreKey bool) ([]byte, error) { return int.c.decryptDM(child, from, isPreKey) } + +func (int *DangerousInternalClient) MakeDeviceIdentityNode() waBinary.Node { + return int.c.makeDeviceIdentityNode() +}