diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-07-23 21:04:50 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-07-28 16:39:44 +0000 |
commit | 1f27fcb5afdecc0ea027908cf4b8645bb919175b (patch) | |
tree | 58d631de2096fc1460f88d7209eaf7b5c80b59ac /toxcore/tox.api.h | |
parent | 051eb1d5a78ac196362fde9b917641ddb4e59c4f (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.api.h')
-rw-r--r-- | toxcore/tox.api.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/toxcore/tox.api.h b/toxcore/tox.api.h index 97a85312..6cb3145b 100644 --- a/toxcore/tox.api.h +++ b/toxcore/tox.api.h | |||
@@ -245,10 +245,17 @@ const SECRET_KEY_SIZE = 32; | |||
245 | 245 | ||
246 | /** | 246 | /** |
247 | * The size of a Tox Conference unique id in bytes. | 247 | * The size of a Tox Conference unique id in bytes. |
248 | * | ||
249 | * @deprecated Use $CONFERENCE_ID_SIZE instead. | ||
248 | */ | 250 | */ |
249 | const CONFERENCE_UID_SIZE = 32; | 251 | const CONFERENCE_UID_SIZE = 32; |
250 | 252 | ||
251 | /** | 253 | /** |
254 | * The size of a Tox Conference unique id in bytes. | ||
255 | */ | ||
256 | const CONFERENCE_ID_SIZE = 32; | ||
257 | |||
258 | /** | ||
252 | * The size of the nospam in bytes when written in a Tox address. | 259 | * The size of the nospam in bytes when written in a Tox address. |
253 | */ | 260 | */ |
254 | const NOSPAM_SIZE = sizeof(uint32_t); | 261 | const NOSPAM_SIZE = sizeof(uint32_t); |
@@ -2464,11 +2471,38 @@ namespace conference { | |||
2464 | /** | 2471 | /** |
2465 | * Get the conference unique ID. | 2472 | * Get the conference unique ID. |
2466 | * | 2473 | * |
2474 | * If id is NULL, this function has no effect. | ||
2475 | * | ||
2476 | * @param id A memory region large enough to store $CONFERENCE_ID_SIZE bytes. | ||
2477 | * | ||
2478 | * @return true on success. | ||
2479 | */ | ||
2480 | const bool get_id(uint32_t conference_number, uint8_t[CONFERENCE_ID_SIZE] id); | ||
2481 | |||
2482 | /** | ||
2483 | * Return the conference number associated with the specified id. | ||
2484 | * | ||
2485 | * @param id A byte array containing the conference id ($CONFERENCE_ID_SIZE). | ||
2486 | * | ||
2487 | * @return the conference number on success, an unspecified value on failure. | ||
2488 | */ | ||
2489 | const uint32_t by_id(const uint8_t[CONFERENCE_ID_SIZE] id) { | ||
2490 | NULL, | ||
2491 | /** | ||
2492 | * No conference with the given id exists on the conference list. | ||
2493 | */ | ||
2494 | NOT_FOUND, | ||
2495 | } | ||
2496 | |||
2497 | /** | ||
2498 | * Get the conference unique ID. | ||
2499 | * | ||
2467 | * If uid is NULL, this function has no effect. | 2500 | * If uid is NULL, this function has no effect. |
2468 | * | 2501 | * |
2469 | * @param uid A memory region large enough to store $CONFERENCE_UID_SIZE bytes. | 2502 | * @param uid A memory region large enough to store $CONFERENCE_UID_SIZE bytes. |
2470 | * | 2503 | * |
2471 | * @return true on success. | 2504 | * @return true on success. |
2505 | * @deprecated use $get_id instead (exactly the same function, just renamed). | ||
2472 | */ | 2506 | */ |
2473 | const bool get_uid(uint32_t conference_number, uint8_t[CONFERENCE_UID_SIZE] uid); | 2507 | const bool get_uid(uint32_t conference_number, uint8_t[CONFERENCE_UID_SIZE] uid); |
2474 | 2508 | ||
@@ -2478,6 +2512,7 @@ namespace conference { | |||
2478 | * @param uid A byte array containing the conference id ($CONFERENCE_UID_SIZE). | 2512 | * @param uid A byte array containing the conference id ($CONFERENCE_UID_SIZE). |
2479 | * | 2513 | * |
2480 | * @return the conference number on success, an unspecified value on failure. | 2514 | * @return the conference number on success, an unspecified value on failure. |
2515 | * @deprecated use $by_id instead (exactly the same function, just renamed). | ||
2481 | */ | 2516 | */ |
2482 | const uint32_t by_uid(const uint8_t[CONFERENCE_UID_SIZE] uid) { | 2517 | const uint32_t by_uid(const uint8_t[CONFERENCE_UID_SIZE] uid) { |
2483 | NULL, | 2518 | NULL, |
@@ -2678,6 +2713,7 @@ typedef TOX_ERR_FILE_SEND_CHUNK Tox_Err_File_Send_Chunk; | |||
2678 | typedef TOX_ERR_CONFERENCE_NEW Tox_Err_Conference_New; | 2713 | typedef TOX_ERR_CONFERENCE_NEW Tox_Err_Conference_New; |
2679 | typedef TOX_ERR_CONFERENCE_DELETE Tox_Err_Conference_Delete; | 2714 | typedef TOX_ERR_CONFERENCE_DELETE Tox_Err_Conference_Delete; |
2680 | typedef TOX_ERR_CONFERENCE_PEER_QUERY Tox_Err_Conference_Peer_Query; | 2715 | typedef TOX_ERR_CONFERENCE_PEER_QUERY Tox_Err_Conference_Peer_Query; |
2716 | typedef TOX_ERR_CONFERENCE_BY_ID Tox_Err_Conference_By_Id; | ||
2681 | typedef TOX_ERR_CONFERENCE_BY_UID Tox_Err_Conference_By_Uid; | 2717 | typedef TOX_ERR_CONFERENCE_BY_UID Tox_Err_Conference_By_Uid; |
2682 | typedef TOX_ERR_CONFERENCE_INVITE Tox_Err_Conference_Invite; | 2718 | typedef TOX_ERR_CONFERENCE_INVITE Tox_Err_Conference_Invite; |
2683 | typedef TOX_ERR_CONFERENCE_JOIN Tox_Err_Conference_Join; | 2719 | typedef TOX_ERR_CONFERENCE_JOIN Tox_Err_Conference_Join; |