summaryrefslogtreecommitdiff
path: root/toxcore/tox.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r--toxcore/tox.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c
index a4a73838..82beb561 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -36,7 +36,7 @@ typedef struct Messenger Tox;
36 36
37/* 37/*
38 * returns a FRIEND_ADDRESS_SIZE byte address to give to others. 38 * returns a FRIEND_ADDRESS_SIZE byte address to give to others.
39 * Format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] 39 * Format: [public_key (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)]
40 * 40 *
41 */ 41 */
42void tox_get_address(const Tox *tox, uint8_t *address) 42void 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
73 * return the friend number if success. 73 * return the friend number if success.
74 * return -1 if failure. 74 * return -1 if failure.
75 */ 75 */
76int32_t tox_add_friend_norequest(Tox *tox, const uint8_t *client_id) 76int32_t tox_add_friend_norequest(Tox *tox, const uint8_t *public_key)
77{ 77{
78 Messenger *m = tox; 78 Messenger *m = tox;
79 return m_addfriend_norequest(m, client_id); 79 return m_addfriend_norequest(m, public_key);
80} 80}
81 81
82/* return the friend number associated to that client id. 82/* return the friend number associated to that client id.
83 * return -1 if no such friend. 83 * return -1 if no such friend.
84 */ 84 */
85int32_t tox_get_friend_number(const Tox *tox, const uint8_t *client_id) 85int32_t tox_get_friend_number(const Tox *tox, const uint8_t *public_key)
86{ 86{
87 const Messenger *m = tox; 87 const Messenger *m = tox;
88 return getfriend_id(m, client_id); 88 return getfriend_id(m, public_key);
89} 89}
90 90
91/* Copies the public key associated to that friend id into client_id buffer. 91/* Copies the public key associated to that friend id into public_key buffer.
92 * Make sure that client_id is of size CLIENT_ID_SIZE. 92 * Make sure that public_key is of size crypto_box_PUBLICKEYBYTES.
93 * 93 *
94 * return 0 if success. 94 * return 0 if success.
95 * return -1 if failure. 95 * return -1 if failure.
96 */ 96 */
97int tox_get_client_id(const Tox *tox, int32_t friendnumber, uint8_t *client_id) 97int tox_get_client_id(const Tox *tox, int32_t friendnumber, uint8_t *public_key)
98{ 98{
99 const Messenger *m = tox; 99 const Messenger *m = tox;
100 return getclient_id(m, friendnumber, client_id); 100 return get_real_pk(m, friendnumber, public_key);
101} 101}
102 102
103/* Remove a friend. */ 103/* Remove a friend. */
@@ -643,16 +643,16 @@ int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t
643 return group_peername(m->group_chat_object, groupnumber, peernumber, name); 643 return group_peername(m->group_chat_object, groupnumber, peernumber, name);
644} 644}
645 645
646/* Copy the public key of peernumber who is in groupnumber to pk. 646/* Copy the public key of peernumber who is in groupnumber to public_key.
647 * pk must be TOX_CLIENT_ID_SIZE long. 647 * public_key must be crypto_box_PUBLICKEYBYTES long.
648 * 648 *
649 * returns 0 on success 649 * returns 0 on success
650 * returns -1 on failure 650 * returns -1 on failure
651 */ 651 */
652int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *pk) 652int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *public_key)
653{ 653{
654 const Messenger *m = tox; 654 const Messenger *m = tox;
655 return group_peer_pubkey(m->group_chat_object, groupnumber, peernumber, pk); 655 return group_peer_pubkey(m->group_chat_object, groupnumber, peernumber, public_key);
656} 656}
657 657
658/* invite friendnumber to groupnumber 658/* invite friendnumber to groupnumber
@@ -1012,8 +1012,8 @@ uint32_t tox_do_interval(Tox *tox)
1012 */ 1012 */
1013Tox *tox_new(Tox_Options *options) 1013Tox *tox_new(Tox_Options *options)
1014{ 1014{
1015 logger_set_global(logger_new(LOGGER_OUTPUT_FILE, LOGGER_LEVEL, "toxcore")); 1015 if (!logger_get_global())
1016 1016 logger_set_global(logger_new(LOGGER_OUTPUT_FILE, LOGGER_LEVEL, "toxcore"));
1017 1017
1018 Messenger_Options m_options = {0}; 1018 Messenger_Options m_options = {0};
1019 1019