summaryrefslogtreecommitdiff
path: root/toxav/toxav.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-07-25 06:54:04 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-08-04 09:29:15 +0000
commit064ffe58756f1adbd1917689ea79db95756d535e (patch)
tree23441f9ff49793ed40059941c022236b92c77140 /toxav/toxav.c
parent7f8b29c3465bae5b34999ad417508c2d0f6e6946 (diff)
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.
Diffstat (limited to 'toxav/toxav.c')
-rw-r--r--toxav/toxav.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/toxav/toxav.c b/toxav/toxav.c
index 57d14942..f26834b1 100644
--- a/toxav/toxav.c
+++ b/toxav/toxav.c
@@ -123,13 +123,16 @@ ToxAV *toxav_new(Tox *tox, TOXAV_ERR_NEW *error)
123{ 123{
124 TOXAV_ERR_NEW rc = TOXAV_ERR_NEW_OK; 124 TOXAV_ERR_NEW rc = TOXAV_ERR_NEW_OK;
125 ToxAV *av = nullptr; 125 ToxAV *av = nullptr;
126 Messenger *m = (Messenger *)tox;
127 126
128 if (tox == nullptr) { 127 if (tox == nullptr) {
129 rc = TOXAV_ERR_NEW_NULL; 128 rc = TOXAV_ERR_NEW_NULL;
130 goto END; 129 goto END;
131 } 130 }
132 131
132 // TODO(iphydf): Don't rely on toxcore internals.
133 Messenger *m;
134 m = *(Messenger **)tox;
135
133 if (m->msi_packet) { 136 if (m->msi_packet) {
134 rc = TOXAV_ERR_NEW_MULTIPLE; 137 rc = TOXAV_ERR_NEW_MULTIPLE;
135 goto END; 138 goto END;