fix it
This commit is contained in:
parent
f7313aa2bf
commit
1f4c2a39c5
@ -154,14 +154,6 @@ void NGC_FT1_register_callback_send_data(
|
||||
// ========== peer online/offline ==========
|
||||
//void NGC_FT1_peer_online(Tox* tox, NGC_FT1* ngc_hs1_ctx, uint32_t group_number, uint32_t peer_number, bool online);
|
||||
|
||||
// "callback"
|
||||
void NGC_FT1_handle_group_custom_packet(
|
||||
Tox* tox, NGC_FT1* ngc_hs1_ctx,
|
||||
uint32_t group_number, uint32_t peer_number,
|
||||
const uint8_t *data, size_t length
|
||||
//void *user_data
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
33
ngc_hs1.cpp
33
ngc_hs1.cpp
@ -90,6 +90,8 @@ void _handle_HS1_ft_send_data(
|
||||
NGC_HS1* NGC_HS1_new(const struct NGC_HS1_options* options) {
|
||||
auto* ngc_hs1_ctx = new NGC_HS1;
|
||||
|
||||
ngc_hs1_ctx->options = *options;
|
||||
|
||||
return ngc_hs1_ctx;
|
||||
}
|
||||
|
||||
@ -105,6 +107,7 @@ bool NGC_HS1_register_ext(NGC_HS1* ngc_hs1_ctx, NGC_EXT_CTX* ngc_ext_ctx) {
|
||||
|
||||
bool NGC_HS1_register_ft1(NGC_HS1* ngc_hs1_ctx, NGC_FT1* ngc_ft1_ctx) {
|
||||
ngc_hs1_ctx->ngc_ft1_ctx = ngc_ft1_ctx;
|
||||
|
||||
NGC_FT1_register_callback_recv_request(ngc_ft1_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_recv_request, ngc_hs1_ctx);
|
||||
NGC_FT1_register_callback_recv_init(ngc_ft1_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_recv_init, ngc_hs1_ctx);
|
||||
NGC_FT1_register_callback_recv_data(ngc_ft1_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_recv_data, ngc_hs1_ctx);
|
||||
@ -112,34 +115,10 @@ bool NGC_HS1_register_ft1(NGC_HS1* ngc_hs1_ctx, NGC_FT1* ngc_ft1_ctx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool NGC_HS1_init(NGC_EXT_CTX* ngc_ext_ctx, const struct NGC_HS1_options* options) {
|
||||
ngc_ext_ctx->ngc_hs1_ctx = new NGC_HS1;
|
||||
ngc_ext_ctx->ngc_hs1_ctx->options = *options;
|
||||
|
||||
ngc_ext_ctx->callbacks[HS1_REQUEST_LAST_IDS] = _handle_HS1_REQUEST_LAST_IDS;
|
||||
ngc_ext_ctx->callbacks[HS1_RESPONSE_LAST_IDS] = _handle_HS1_RESPONSE_LAST_IDS;
|
||||
|
||||
NGC_FT1_register_callback_recv_request(ngc_ext_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_recv_request);
|
||||
NGC_FT1_register_callback_recv_init(ngc_ext_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_recv_init);
|
||||
NGC_FT1_register_callback_recv_data(ngc_ext_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_recv_data);
|
||||
NGC_FT1_register_callback_send_data(ngc_ext_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_send_data);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void NGC_HS1_kill(NGC_HS1* ngc_hs1_ctx) {
|
||||
delete ngc_hs1_ctx;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void NGC_HS1_kill(NGC_EXT_CTX* ngc_ext_ctx) {
|
||||
delete ngc_ext_ctx->ngc_hs1_ctx;
|
||||
ngc_ext_ctx->ngc_hs1_ctx = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void _iterate_group(Tox *tox, NGC_HS1* ngc_hs1_ctx, uint32_t group_number, float time_delta) {
|
||||
//fprintf(stderr, "g:%u\n", g_i);
|
||||
NGC_EXT::GroupKey g_id{};
|
||||
@ -404,6 +383,7 @@ void _handle_HS1_ft_recv_request(
|
||||
const uint8_t* file_id, size_t file_id_size,
|
||||
void* user_data
|
||||
) {
|
||||
assert(user_data);
|
||||
NGC_HS1* ngc_hs1_ctx = static_cast<NGC_HS1*>(user_data);
|
||||
assert(file_id_size == TOX_GROUP_PEER_PUBLIC_KEY_SIZE+sizeof(uint32_t));
|
||||
|
||||
@ -476,6 +456,7 @@ bool _handle_HS1_ft_recv_init(
|
||||
const size_t file_size,
|
||||
void* user_data
|
||||
) {
|
||||
assert(user_data);
|
||||
NGC_HS1* ngc_hs1_ctx = static_cast<NGC_HS1*>(user_data);
|
||||
//fprintf(stderr, "HS: -------hs handle ft init\n");
|
||||
|
||||
@ -546,6 +527,7 @@ void _handle_HS1_ft_recv_data(
|
||||
const uint8_t* data, size_t data_size,
|
||||
void* user_data
|
||||
) {
|
||||
assert(user_data);
|
||||
NGC_HS1* ngc_hs1_ctx = static_cast<NGC_HS1*>(user_data);
|
||||
// get group id
|
||||
NGC_EXT::GroupKey g_id{};
|
||||
@ -614,6 +596,7 @@ void _handle_HS1_ft_send_data(
|
||||
size_t data_offset, uint8_t* data, size_t data_size,
|
||||
void* user_data
|
||||
) {
|
||||
assert(user_data);
|
||||
NGC_HS1* ngc_hs1_ctx = static_cast<NGC_HS1*>(user_data);
|
||||
// get group id
|
||||
NGC_EXT::GroupKey g_id{};
|
||||
@ -665,6 +648,7 @@ void _handle_HS1_REQUEST_LAST_IDS(
|
||||
size_t length,
|
||||
void* user_data
|
||||
) {
|
||||
assert(user_data);
|
||||
NGC_HS1* ngc_hs1_ctx = static_cast<NGC_HS1*>(user_data);
|
||||
size_t curser = 0;
|
||||
|
||||
@ -739,6 +723,7 @@ void _handle_HS1_RESPONSE_LAST_IDS(
|
||||
size_t length,
|
||||
void* user_data
|
||||
) {
|
||||
assert(user_data);
|
||||
NGC_HS1* ngc_hs1_ctx = static_cast<NGC_HS1*>(user_data);
|
||||
size_t curser = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user