summaryrefslogtreecommitdiff
path: root/toxcore/tox.h
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-07-23 21:04:50 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-07-28 16:39:44 +0000
commit1f27fcb5afdecc0ea027908cf4b8645bb919175b (patch)
tree58d631de2096fc1460f88d7209eaf7b5c80b59ac /toxcore/tox.h
parent051eb1d5a78ac196362fde9b917641ddb4e59c4f (diff)
Add `by_id` and `get_id` functions, renaming from `*_uid`.
`UID` sounds like `User ID`. While it is a Unique ID, the property of an "identifier" is generally that it identifies a unique thing, so the 'U' is redundant, and `GUID` as a globally unique id (which is likely also true for these IDs) has a specific meaning and syntax, so we're not using that. So, we just say conference `id`.
Diffstat (limited to 'toxcore/tox.h')
-rw-r--r--toxcore/tox.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/toxcore/tox.h b/toxcore/tox.h
index f8279afe..4c83ca23 100644
--- a/toxcore/tox.h
+++ b/toxcore/tox.h
@@ -250,12 +250,21 @@ uint32_t tox_secret_key_size(void);
250 250
251/** 251/**
252 * The size of a Tox Conference unique id in bytes. 252 * The size of a Tox Conference unique id in bytes.
253 *
254 * @deprecated Use TOX_CONFERENCE_ID_SIZE instead.
253 */ 255 */
254#define TOX_CONFERENCE_UID_SIZE 32 256#define TOX_CONFERENCE_UID_SIZE 32
255 257
256uint32_t tox_conference_uid_size(void); 258uint32_t tox_conference_uid_size(void);
257 259
258/** 260/**
261 * The size of a Tox Conference unique id in bytes.
262 */
263#define TOX_CONFERENCE_ID_SIZE 32
264
265uint32_t tox_conference_id_size(void);
266
267/**
259 * The size of the nospam in bytes when written in a Tox address. 268 * The size of the nospam in bytes when written in a Tox address.
260 */ 269 */
261#define TOX_NOSPAM_SIZE (sizeof(uint32_t)) 270#define TOX_NOSPAM_SIZE (sizeof(uint32_t))
@@ -2817,11 +2826,52 @@ TOX_CONFERENCE_TYPE tox_conference_get_type(const Tox *tox, uint32_t conference_
2817/** 2826/**
2818 * Get the conference unique ID. 2827 * Get the conference unique ID.
2819 * 2828 *
2829 * If id is NULL, this function has no effect.
2830 *
2831 * @param id A memory region large enough to store TOX_CONFERENCE_ID_SIZE bytes.
2832 *
2833 * @return true on success.
2834 */
2835bool tox_conference_get_id(const Tox *tox, uint32_t conference_number, uint8_t *id);
2836
2837typedef enum TOX_ERR_CONFERENCE_BY_ID {
2838
2839 /**
2840 * The function returned successfully.
2841 */
2842 TOX_ERR_CONFERENCE_BY_ID_OK,
2843
2844 /**
2845 * One of the arguments to the function was NULL when it was not expected.
2846 */
2847 TOX_ERR_CONFERENCE_BY_ID_NULL,
2848
2849 /**
2850 * No conference with the given id exists on the conference list.
2851 */
2852 TOX_ERR_CONFERENCE_BY_ID_NOT_FOUND,
2853
2854} TOX_ERR_CONFERENCE_BY_ID;
2855
2856
2857/**
2858 * Return the conference number associated with the specified id.
2859 *
2860 * @param id A byte array containing the conference id (TOX_CONFERENCE_ID_SIZE).
2861 *
2862 * @return the conference number on success, an unspecified value on failure.
2863 */
2864uint32_t tox_conference_by_id(const Tox *tox, const uint8_t *id, TOX_ERR_CONFERENCE_BY_ID *error);
2865
2866/**
2867 * Get the conference unique ID.
2868 *
2820 * If uid is NULL, this function has no effect. 2869 * If uid is NULL, this function has no effect.
2821 * 2870 *
2822 * @param uid A memory region large enough to store TOX_CONFERENCE_UID_SIZE bytes. 2871 * @param uid A memory region large enough to store TOX_CONFERENCE_UID_SIZE bytes.
2823 * 2872 *
2824 * @return true on success. 2873 * @return true on success.
2874 * @deprecated use tox_conference_get_id instead (exactly the same function, just renamed).
2825 */ 2875 */
2826bool tox_conference_get_uid(const Tox *tox, uint32_t conference_number, uint8_t *uid); 2876bool tox_conference_get_uid(const Tox *tox, uint32_t conference_number, uint8_t *uid);
2827 2877
@@ -2851,6 +2901,7 @@ typedef enum TOX_ERR_CONFERENCE_BY_UID {
2851 * @param uid A byte array containing the conference id (TOX_CONFERENCE_UID_SIZE). 2901 * @param uid A byte array containing the conference id (TOX_CONFERENCE_UID_SIZE).
2852 * 2902 *
2853 * @return the conference number on success, an unspecified value on failure. 2903 * @return the conference number on success, an unspecified value on failure.
2904 * @deprecated use tox_conference_by_id instead (exactly the same function, just renamed).
2854 */ 2905 */
2855uint32_t tox_conference_by_uid(const Tox *tox, const uint8_t *uid, TOX_ERR_CONFERENCE_BY_UID *error); 2906uint32_t tox_conference_by_uid(const Tox *tox, const uint8_t *uid, TOX_ERR_CONFERENCE_BY_UID *error);
2856 2907
@@ -3054,6 +3105,7 @@ typedef TOX_ERR_FILE_SEND_CHUNK Tox_Err_File_Send_Chunk;
3054typedef TOX_ERR_CONFERENCE_NEW Tox_Err_Conference_New; 3105typedef TOX_ERR_CONFERENCE_NEW Tox_Err_Conference_New;
3055typedef TOX_ERR_CONFERENCE_DELETE Tox_Err_Conference_Delete; 3106typedef TOX_ERR_CONFERENCE_DELETE Tox_Err_Conference_Delete;
3056typedef TOX_ERR_CONFERENCE_PEER_QUERY Tox_Err_Conference_Peer_Query; 3107typedef TOX_ERR_CONFERENCE_PEER_QUERY Tox_Err_Conference_Peer_Query;
3108typedef TOX_ERR_CONFERENCE_BY_ID Tox_Err_Conference_By_Id;
3057typedef TOX_ERR_CONFERENCE_BY_UID Tox_Err_Conference_By_Uid; 3109typedef TOX_ERR_CONFERENCE_BY_UID Tox_Err_Conference_By_Uid;
3058typedef TOX_ERR_CONFERENCE_INVITE Tox_Err_Conference_Invite; 3110typedef TOX_ERR_CONFERENCE_INVITE Tox_Err_Conference_Invite;
3059typedef TOX_ERR_CONFERENCE_JOIN Tox_Err_Conference_Join; 3111typedef TOX_ERR_CONFERENCE_JOIN Tox_Err_Conference_Join;