wip more refactoring

This commit is contained in:
2022-10-03 01:15:49 +02:00
parent 9a8bfe36f8
commit 5d6a5d8c01
7 changed files with 252 additions and 109 deletions

View File

@@ -3,31 +3,18 @@
// this is a c header
// outline:
// i am disgusting
//#include <stdbool.h>
//#include <stddef.h>
//#include <stdint.h>
#include <tox/tox.h>
#include "ngc_ext_common.h"
#ifdef __cplusplus
extern "C" {
#endif
// copy from tox.h:
#ifndef TOX_DEFINED
#define TOX_DEFINED
typedef struct Tox Tox;
#endif /* TOX_DEFINED */
// ========== struct / typedef ==========
typedef struct NGC_HS1 NGC_HS1;
@@ -50,15 +37,17 @@ struct NGC_HS1_options {
// ========== init / kill ==========
// (see tox api)
NGC_HS1* NGC_HS1_new(const struct NGC_HS1_options* options);
void NGC_HS1_kill(NGC_HS1* ngc_hs1_ctx);
//NGC_HS1* NGC_HS1_new(const struct NGC_HS1_options* options);
bool NGC_HS1_init(NGC_EXT_CTX* ngc_ext_ctx, const struct NGC_HS1_options* options);
//void NGC_HS1_kill(NGC_HS1* ngc_hs1_ctx);
void NGC_HS1_kill(NGC_EXT_CTX* ngc_ext_ctx);
// ========== iterate ==========
void NGC_HS1_iterate(Tox *tox, NGC_HS1* ngc_hs1_ctx/*, void *user_data*/);
void NGC_HS1_iterate(Tox *tox, NGC_EXT_CTX* ngc_ext_ctx/*, void *user_data*/);
// ========== peer online/offline ==========
void NGC_HS1_peer_online(Tox* tox, NGC_HS1* ngc_hs1_ctx, uint32_t group_number, uint32_t peer_number, bool online);
void NGC_HS1_peer_online(Tox* tox, NGC_EXT_CTX* ngc_ext_ctx, uint32_t group_number, uint32_t peer_number, bool online);
// ========== send ==========
@@ -66,7 +55,7 @@ void NGC_HS1_peer_online(Tox* tox, NGC_HS1* ngc_hs1_ctx, uint32_t group_number,
// NGC_HS1_record_own_message()
bool NGC_HS1_shim_group_send_message(
const Tox *tox,
NGC_HS1* ngc_hs1_ctx,
NGC_EXT_CTX* ngc_ext_ctx,
uint32_t group_number,
@@ -80,7 +69,7 @@ bool NGC_HS1_shim_group_send_message(
// record own msg
void NGC_HS1_record_own_message(
const Tox *tox,
NGC_HS1* ngc_hs1_ctx,
NGC_EXT_CTX* ngc_ext_ctx,
uint32_t group_number,
@@ -98,7 +87,7 @@ void NGC_HS1_record_own_message(
// record others msg
void NGC_HS1_record_message(
const Tox *tox,
NGC_HS1* ngc_hs1_ctx,
NGC_EXT_CTX* ngc_ext_ctx,
uint32_t group_number,
uint32_t peer_number,
@@ -106,27 +95,6 @@ void NGC_HS1_record_message(
Tox_Message_Type type, const uint8_t *message, size_t length, uint32_t message_id
);
// ========== receive custom ==========
// "callback"
void NGC_HS1_handle_group_custom_packet(
Tox* tox,
NGC_HS1* ngc_hs1_ctx,
uint32_t group_number,
uint32_t peer_number,
const uint8_t *data,
size_t length
//void *user_data
);
// ========== receive request ==========
//void NGC_HS1_custom_packet(
// ========== receive answer ==========
#ifdef __cplusplus
}
#endif