mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Make a separate struct Tox
containing the Messenger.
This allows Tox to contain additional data on top of Messenger, making Messenger not necessarily the most top-level object. E.g. groups are built on Messenger and currently awkwardly void-pointered into it to pretend there is no cyclic dependency.
This commit is contained in:
parent
7f8b29c346
commit
064ffe5875
|
@ -40,9 +40,6 @@ echo "#include <cstdio>" >> amalgamation.cc
|
|||
echo "#include <memory>" >> amalgamation.cc
|
||||
echo "#include <random>" >> amalgamation.cc
|
||||
|
||||
echo "#define TOX_DEFINED" >> amalgamation.cc
|
||||
echo "typedef struct Messenger Tox;" >> amalgamation.cc
|
||||
|
||||
put auto_tests/check_compat.h
|
||||
|
||||
FIND_QUERY="find . '-(' -name '*.cc' -or -name '*.c' '-)'"
|
||||
|
|
|
@ -123,13 +123,16 @@ ToxAV *toxav_new(Tox *tox, TOXAV_ERR_NEW *error)
|
|||
{
|
||||
TOXAV_ERR_NEW rc = TOXAV_ERR_NEW_OK;
|
||||
ToxAV *av = nullptr;
|
||||
Messenger *m = (Messenger *)tox;
|
||||
|
||||
if (tox == nullptr) {
|
||||
rc = TOXAV_ERR_NEW_NULL;
|
||||
goto END;
|
||||
}
|
||||
|
||||
// TODO(iphydf): Don't rely on toxcore internals.
|
||||
Messenger *m;
|
||||
m = *(Messenger **)tox;
|
||||
|
||||
if (m->msi_packet) {
|
||||
rc = TOXAV_ERR_NEW_MULTIPLE;
|
||||
goto END;
|
||||
|
|
|
@ -1985,7 +1985,7 @@ Messenger *new_messenger(Messenger_Options *options, unsigned int *error)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
logger_callback_log(m->log, options->log_callback, m, options->log_user_data);
|
||||
logger_callback_log(m->log, options->log_callback, options->log_context, options->log_user_data);
|
||||
|
||||
unsigned int net_err = 0;
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ typedef struct Messenger_Options {
|
|||
bool local_discovery_enabled;
|
||||
|
||||
logger_cb *log_callback;
|
||||
void *log_context;
|
||||
void *log_user_data;
|
||||
} Messenger_Options;
|
||||
|
||||
|
|
486
toxcore/tox.c
486
toxcore/tox.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user