diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-07-13 19:10:22 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-07-13 19:30:02 +0000 |
commit | 90a63e8188aabde41beb60152b04d2cd4576c2ac (patch) | |
tree | 7598acc5d612f29c5463483ed77bcc4cdd3bc42e /toxcore/tox.c | |
parent | 3d5fd9c2d0114e7d4bbb389e11216c425adaa216 (diff) |
Add conference_by_uid and conference_get_uid functions.
These are useful once we have persistent group chats, so clients can
store data associated with this permanent group identifier.
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r-- | toxcore/tox.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c index 4c764aeb..cae2dcb3 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -1453,6 +1453,31 @@ Tox_Conference_Type tox_conference_get_type(const Tox *tox, uint32_t conference_ | |||
1453 | return (Tox_Conference_Type)ret; | 1453 | return (Tox_Conference_Type)ret; |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | bool tox_conference_get_uid(const Tox *tox, uint32_t conference_number, uint8_t *uid /* TOX_CONFERENCE_ID_SIZE bytes */) | ||
1457 | { | ||
1458 | const Messenger *m = tox; | ||
1459 | return conference_get_uid((Group_Chats *)m->conferences_object, conference_number, uid); | ||
1460 | } | ||
1461 | |||
1462 | uint32_t tox_conference_by_uid(const Tox *tox, const uint8_t *uid, Tox_Err_Conference_By_Uid *error) | ||
1463 | { | ||
1464 | if (!uid) { | ||
1465 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_BY_UID_NULL); | ||
1466 | return UINT32_MAX; | ||
1467 | } | ||
1468 | |||
1469 | const Messenger *m = tox; | ||
1470 | int32_t ret = conference_by_uid((Group_Chats *)m->conferences_object, uid); | ||
1471 | |||
1472 | if (ret == -1) { | ||
1473 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_BY_UID_NOT_FOUND); | ||
1474 | return UINT32_MAX; | ||
1475 | } | ||
1476 | |||
1477 | SET_ERROR_PARAMETER(error, TOX_ERR_CONFERENCE_BY_UID_OK); | ||
1478 | return ret; | ||
1479 | } | ||
1480 | |||
1456 | static void set_custom_packet_error(int ret, Tox_Err_Friend_Custom_Packet *error) | 1481 | static void set_custom_packet_error(int ret, Tox_Err_Friend_Custom_Packet *error) |
1457 | { | 1482 | { |
1458 | switch (ret) { | 1483 | switch (ret) { |