Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing call event types #487

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions call.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 18 additions & 0 deletions internals.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -66,3 +68,19 @@ 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)
}

func (int *DangerousInternalClient) MakeDeviceIdentityNode() waBinary.Node {
return int.c.makeDeviceIdentityNode()
}
14 changes: 14 additions & 0 deletions types/events/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading