Api break.

TOX_CLIENT_ID_SIZE renamed to TOX_PUBLIC_KEY_SIZE.

Renamed client_id to public_ke in public api.
This commit is contained in:
irungentoo 2015-01-29 19:57:32 -05:00
parent f463cb52a2
commit b8d530c9e0
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 27 additions and 24 deletions

View File

@ -36,7 +36,7 @@ typedef struct Messenger Tox;
/* /*
* returns a FRIEND_ADDRESS_SIZE byte address to give to others. * returns a FRIEND_ADDRESS_SIZE byte address to give to others.
* Format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] * Format: [public_key (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)]
* *
*/ */
void tox_get_address(const Tox *tox, uint8_t *address) void tox_get_address(const Tox *tox, uint8_t *address)
@ -73,31 +73,31 @@ int32_t tox_add_friend(Tox *tox, const uint8_t *address, const uint8_t *data, ui
* return the friend number if success. * return the friend number if success.
* return -1 if failure. * return -1 if failure.
*/ */
int32_t tox_add_friend_norequest(Tox *tox, const uint8_t *client_id) int32_t tox_add_friend_norequest(Tox *tox, const uint8_t *public_key)
{ {
Messenger *m = tox; Messenger *m = tox;
return m_addfriend_norequest(m, client_id); return m_addfriend_norequest(m, public_key);
} }
/* return the friend number associated to that client id. /* return the friend number associated to that client id.
* return -1 if no such friend. * return -1 if no such friend.
*/ */
int32_t tox_get_friend_number(const Tox *tox, const uint8_t *client_id) int32_t tox_get_friend_number(const Tox *tox, const uint8_t *public_key)
{ {
const Messenger *m = tox; const Messenger *m = tox;
return getfriend_id(m, client_id); return getfriend_id(m, public_key);
} }
/* Copies the public key associated to that friend id into client_id buffer. /* Copies the public key associated to that friend id into public_key buffer.
* Make sure that client_id is of size CLIENT_ID_SIZE. * Make sure that public_key is of size crypto_box_PUBLICKEYBYTES.
* *
* return 0 if success. * return 0 if success.
* return -1 if failure. * return -1 if failure.
*/ */
int tox_get_client_id(const Tox *tox, int32_t friendnumber, uint8_t *client_id) int tox_get_client_id(const Tox *tox, int32_t friendnumber, uint8_t *public_key)
{ {
const Messenger *m = tox; const Messenger *m = tox;
return get_real_pk(m, friendnumber, client_id); return get_real_pk(m, friendnumber, public_key);
} }
/* Remove a friend. */ /* Remove a friend. */
@ -643,16 +643,16 @@ int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t
return group_peername(m->group_chat_object, groupnumber, peernumber, name); return group_peername(m->group_chat_object, groupnumber, peernumber, name);
} }
/* Copy the public key of peernumber who is in groupnumber to pk. /* Copy the public key of peernumber who is in groupnumber to public_key.
* pk must be TOX_CLIENT_ID_SIZE long. * public_key must be crypto_box_PUBLICKEYBYTES long.
* *
* returns 0 on success * returns 0 on success
* returns -1 on failure * returns -1 on failure
*/ */
int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *pk) int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *public_key)
{ {
const Messenger *m = tox; const Messenger *m = tox;
return group_peer_pubkey(m->group_chat_object, groupnumber, peernumber, pk); return group_peer_pubkey(m->group_chat_object, groupnumber, peernumber, public_key);
} }
/* invite friendnumber to groupnumber /* invite friendnumber to groupnumber

View File

@ -38,11 +38,14 @@ extern "C" {
#define TOX_MAX_STATUSMESSAGE_LENGTH 1007 #define TOX_MAX_STATUSMESSAGE_LENGTH 1007
#define TOX_MAX_FRIENDREQUEST_LENGTH 1016 #define TOX_MAX_FRIENDREQUEST_LENGTH 1016
#define TOX_CLIENT_ID_SIZE 32 #define TOX_PUBLIC_KEY_SIZE 32
/* TODO: remove */
#define TOX_CLIENT_ID_SIZE TOX_PUBLIC_KEY_SIZE
#define TOX_AVATAR_MAX_DATA_LENGTH 16384 #define TOX_AVATAR_MAX_DATA_LENGTH 16384
#define TOX_HASH_LENGTH /*crypto_hash_sha256_BYTES*/ 32 #define TOX_HASH_LENGTH /*crypto_hash_sha256_BYTES*/ 32
#define TOX_FRIEND_ADDRESS_SIZE (TOX_CLIENT_ID_SIZE + sizeof(uint32_t) + sizeof(uint16_t)) #define TOX_FRIEND_ADDRESS_SIZE (TOX_PUBLIC_KEY_SIZE + sizeof(uint32_t) + sizeof(uint16_t))
#define TOX_ENABLE_IPV6_DEFAULT 1 #define TOX_ENABLE_IPV6_DEFAULT 1
@ -97,7 +100,7 @@ typedef struct Tox Tox;
*/ */
/* return TOX_FRIEND_ADDRESS_SIZE byte address to give to others. /* return TOX_FRIEND_ADDRESS_SIZE byte address to give to others.
* format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] * format: [public_key (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)]
*/ */
void tox_get_address(const Tox *tox, uint8_t *address); void tox_get_address(const Tox *tox, uint8_t *address);
@ -124,18 +127,18 @@ int32_t tox_add_friend(Tox *tox, const uint8_t *address, const uint8_t *data, ui
* return the friend number if success. * return the friend number if success.
* return -1 if failure. * return -1 if failure.
*/ */
int32_t tox_add_friend_norequest(Tox *tox, const uint8_t *client_id); int32_t tox_add_friend_norequest(Tox *tox, const uint8_t *public_key);
/* return the friend number associated to that client id. /* return the friend number associated to that client id.
return -1 if no such friend */ return -1 if no such friend */
int32_t tox_get_friend_number(const Tox *tox, const uint8_t *client_id); int32_t tox_get_friend_number(const Tox *tox, const uint8_t *public_key);
/* Copies the public key associated to that friend id into client_id buffer. /* Copies the public key associated to that friend id into public_key buffer.
* Make sure that client_id is of size CLIENT_ID_SIZE. * Make sure that public_key is of size TOX_PUBLIC_KEY_SIZE.
* return 0 if success. * return 0 if success.
* return -1 if failure. * return -1 if failure.
*/ */
int tox_get_client_id(const Tox *tox, int32_t friendnumber, uint8_t *client_id); int tox_get_client_id(const Tox *tox, int32_t friendnumber, uint8_t *public_key);
/* Remove a friend. /* Remove a friend.
* *
@ -500,13 +503,13 @@ int tox_del_groupchat(Tox *tox, int groupnumber);
*/ */
int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t *name); int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t *name);
/* Copy the public key of peernumber who is in groupnumber to pk. /* Copy the public key of peernumber who is in groupnumber to public_key.
* pk must be TOX_CLIENT_ID_SIZE long. * public_key must be TOX_PUBLIC_KEY_SIZE long.
* *
* returns 0 on success * returns 0 on success
* returns -1 on failure * returns -1 on failure
*/ */
int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *pk); int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *public_key);
/* invite friendnumber to groupnumber /* invite friendnumber to groupnumber
* return 0 on success * return 0 on success