summaryrefslogtreecommitdiff
path: root/toxcore/tox.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-03-16 09:26:05 -0400
committerirungentoo <irungentoo@gmail.com>2015-03-16 09:26:05 -0400
commit2757b254fef9354feff7527d9209232654d58126 (patch)
treecc6705bbfd49e043dbe5bb6a377a1bf705f45c61 /toxcore/tox.c
parent08585e5b60aeaf304701245ea7a1b7e3ce843e57 (diff)
parentfa7c21f95c78eabf3c0f0d247cd7f28ec47eff3d (diff)
Merge branch 'iphydf-new_api' into new_api
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r--toxcore/tox.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c
index 54daafc8..da109502 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -135,7 +135,7 @@ Tox *tox_new(const struct Tox_Options *options, const uint8_t *data, size_t leng
135 break; 135 break;
136 136
137 default: 137 default:
138 SET_ERROR_PARAMETER(error, TOX_ERR_PROXY_TYPE); 138 SET_ERROR_PARAMETER(error, TOX_ERR_NEW_PROXY_BAD_TYPE);
139 return NULL; 139 return NULL;
140 } 140 }
141 141
@@ -150,7 +150,7 @@ Tox *tox_new(const struct Tox_Options *options, const uint8_t *data, size_t leng
150 if (m_options.ipv6enabled) 150 if (m_options.ipv6enabled)
151 m_options.proxy_info.ip_port.ip.family = AF_UNSPEC; 151 m_options.proxy_info.ip_port.ip.family = AF_UNSPEC;
152 152
153 if (!addr_resolve_or_parse_ip(options->proxy_address, &m_options.proxy_info.ip_port.ip, NULL)) { 153 if (!addr_resolve_or_parse_ip(options->proxy_host, &m_options.proxy_info.ip_port.ip, NULL)) {
154 SET_ERROR_PARAMETER(error, TOX_ERR_NEW_PROXY_BAD_HOST); 154 SET_ERROR_PARAMETER(error, TOX_ERR_NEW_PROXY_BAD_HOST);
155 //TODO: TOX_ERR_NEW_PROXY_NOT_FOUND if domain. 155 //TODO: TOX_ERR_NEW_PROXY_NOT_FOUND if domain.
156 return NULL; 156 return NULL;
@@ -249,7 +249,7 @@ bool tox_bootstrap(Tox *tox, const char *address, uint16_t port, const uint8_t *
249 return ret; 249 return ret;
250 } else { /* DHT only works on UDP. */ 250 } else { /* DHT only works on UDP. */
251 if (DHT_bootstrap_from_address(m->dht, address, m->options.ipv6enabled, htons(port), public_key) == 0) { 251 if (DHT_bootstrap_from_address(m->dht, address, m->options.ipv6enabled, htons(port), public_key) == 0) {
252 SET_ERROR_PARAMETER(error, TOX_ERR_BOOTSTRAP_BAD_ADDRESS); 252 SET_ERROR_PARAMETER(error, TOX_ERR_BOOTSTRAP_BAD_HOST);
253 return 0; 253 return 0;
254 } 254 }
255 255
@@ -275,7 +275,7 @@ bool tox_add_tcp_relay(Tox *tox, const char *address, uint16_t port, const uint8
275 } 275 }
276 276
277 if (address_to_ip(m, address, &ip_port, &ip_port_v4) == -1) { 277 if (address_to_ip(m, address, &ip_port, &ip_port_v4) == -1) {
278 SET_ERROR_PARAMETER(error, TOX_ERR_BOOTSTRAP_BAD_ADDRESS); 278 SET_ERROR_PARAMETER(error, TOX_ERR_BOOTSTRAP_BAD_HOST);
279 return 0; 279 return 0;
280 } 280 }
281 281
@@ -350,12 +350,12 @@ void tox_self_get_public_key(const Tox *tox, uint8_t *public_key)
350 memcpy(public_key, m->net_crypto->self_public_key, crypto_box_PUBLICKEYBYTES); 350 memcpy(public_key, m->net_crypto->self_public_key, crypto_box_PUBLICKEYBYTES);
351} 351}
352 352
353void tox_self_get_private_key(const Tox *tox, uint8_t *private_key) 353void tox_self_get_secret_key(const Tox *tox, uint8_t *secret_key)
354{ 354{
355 const Messenger *m = tox; 355 const Messenger *m = tox;
356 356
357 if (private_key) 357 if (secret_key)
358 memcpy(private_key, m->net_crypto->self_secret_key, crypto_box_SECRETKEYBYTES); 358 memcpy(secret_key, m->net_crypto->self_secret_key, crypto_box_SECRETKEYBYTES);
359} 359}
360 360
361bool tox_self_set_name(Tox *tox, const uint8_t *name, size_t length, TOX_ERR_SET_INFO *error) 361bool tox_self_set_name(Tox *tox, const uint8_t *name, size_t length, TOX_ERR_SET_INFO *error)
@@ -567,18 +567,18 @@ bool tox_friend_exists(const Tox *tox, uint32_t friend_number)
567 return m_friend_exists(m, friend_number); 567 return m_friend_exists(m, friend_number);
568} 568}
569 569
570size_t tox_friend_list_size(const Tox *tox) 570size_t tox_self_get_friend_list_size(const Tox *tox)
571{ 571{
572 const Messenger *m = tox; 572 const Messenger *m = tox;
573 return count_friendlist(m); 573 return count_friendlist(m);
574} 574}
575 575
576void tox_friend_get_list(const Tox *tox, uint32_t *list) 576void tox_self_get_friend_list(const Tox *tox, uint32_t *list)
577{ 577{
578 if (list) { 578 if (list) {
579 const Messenger *m = tox; 579 const Messenger *m = tox;
580 //TODO: size parameter? 580 //TODO: size parameter?
581 copy_friendlist(m, list, tox_friend_list_size(tox)); 581 copy_friendlist(m, list, tox_self_get_friend_list_size(tox));
582 } 582 }
583} 583}
584 584
@@ -965,7 +965,7 @@ bool tox_file_send_chunk(Tox *tox, uint32_t friend_number, uint32_t file_number,
965 return 0; 965 return 0;
966 966
967 case -6: 967 case -6:
968 SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEND_CHUNK_QUEUE_FULL); 968 SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEND_CHUNK_SENDQ);
969 return 0; 969 return 0;
970 970
971 case -7: 971 case -7: