Skip to content

Commit

Permalink
Updated Go Example
Browse files Browse the repository at this point in the history
  • Loading branch information
Laky-64 committed Apr 18, 2024
1 parent 377aba6 commit 6f05c6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func main() {
})
_ = mtproto.Start()
// Choose between outgoingCall or joinGroupCall
fmt.Println(client.Calls())
//outgoingCall(client, mtproto, "@PyTgCallsVideoBeta")
//joinGroupCall(client, mtproto, "@pytgcallschat")
client.OnStreamEnd(func(chatId int64, streamType ntgcalls.StreamType) {
Expand Down
6 changes: 5 additions & 1 deletion examples/go/ntgcalls/ntgcalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ func (ctx *Client) CreateP2PCall(chatId int64, dhConfig DhConfig, gAHash []byte,
var buffer [32]C.uint8_t
size := C.int(len(buffer))
gAHashC, gAHashSize := parseBytes(gAHash)
C.ntg_create_p2p(C.uint32_t(ctx.uid), C.int64_t(chatId), dhConfig.ParseToC(), gAHashC, gAHashSize, desc.ParseToC(), &buffer[0], size, f.ParseToC())
dhConfigC := dhConfig.ParseToC()
C.ntg_create_p2p(C.uint32_t(ctx.uid), C.int64_t(chatId), &dhConfigC, gAHashC, gAHashSize, desc.ParseToC(), &buffer[0], size, f.ParseToC())
f.wait()
return C.GoBytes(unsafe.Pointer(&buffer[0]), size), parseErrorCode(*f.errCode)
}
Expand Down Expand Up @@ -325,6 +326,9 @@ func (ctx *Client) Calls() map[int64]StreamStatus {
_ = C.ntg_calls_count(C.uint32_t(ctx.uid), &callSize, f.ParseToC())
f.wait()
f = CreateFuture()
if callSize == 0 {
return mapReturn
}
buffer := make([]C.ntg_call_struct, callSize)
C.ntg_calls(C.uint32_t(ctx.uid), &buffer[0], callSize, f.ParseToC())
f.wait()
Expand Down

0 comments on commit 6f05c6f

Please sign in to comment.