summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testing/nTox.c50
-rw-r--r--testing/tox_sync.c26
-rw-r--r--toxcore/tox.c74
-rw-r--r--toxcore/tox.h86
4 files changed, 118 insertions, 118 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index 6e333abf..02b93d6f 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -131,17 +131,17 @@ void send_filesenders(Tox *m)
131 continue; 131 continue;
132 132
133 while (1) { 133 while (1) {
134 if (tox_file_senddata(m, file_senders[i].friendnum, file_senders[i].filenumber, file_senders[i].nextpiece, 134 if (tox_file_send_data(m, file_senders[i].friendnum, file_senders[i].filenumber, file_senders[i].nextpiece,
135 file_senders[i].piecelength) == -1) 135 file_senders[i].piecelength) == -1)
136 break; 136 break;
137 137
138 file_senders[i].piecelength = fread(file_senders[i].nextpiece, 1, tox_filedata_size(m, file_senders[i].friendnum), 138 file_senders[i].piecelength = fread(file_senders[i].nextpiece, 1, tox_file_data_size(m, file_senders[i].friendnum),
139 file_senders[i].file); 139 file_senders[i].file);
140 140
141 if (file_senders[i].piecelength == 0) { 141 if (file_senders[i].piecelength == 0) {
142 fclose(file_senders[i].file); 142 fclose(file_senders[i].file);
143 file_senders[i].file = 0; 143 file_senders[i].file = 0;
144 tox_file_sendcontrol(m, file_senders[i].friendnum, 0, file_senders[i].filenumber, 3, 0, 0); 144 tox_file_send_control(m, file_senders[i].friendnum, 0, file_senders[i].filenumber, 3, 0, 0);
145 char msg[512]; 145 char msg[512];
146 sprintf(msg, "[t] %u file transfer: %u completed", file_senders[i].friendnum, file_senders[i].filenumber); 146 sprintf(msg, "[t] %u file transfer: %u completed", file_senders[i].friendnum, file_senders[i].filenumber);
147 new_lines(msg); 147 new_lines(msg);
@@ -160,13 +160,13 @@ int add_filesender(Tox *m, uint16_t friendnum, char *filename)
160 fseek(tempfile, 0, SEEK_END); 160 fseek(tempfile, 0, SEEK_END);
161 uint64_t filesize = ftell(tempfile); 161 uint64_t filesize = ftell(tempfile);
162 fseek(tempfile, 0, SEEK_SET); 162 fseek(tempfile, 0, SEEK_SET);
163 int filenum = tox_new_filesender(m, friendnum, filesize, (uint8_t *)filename, strlen(filename) + 1); 163 int filenum = tox_new_file_sender(m, friendnum, filesize, (uint8_t *)filename, strlen(filename) + 1);
164 164
165 if (filenum == -1) 165 if (filenum == -1)
166 return -1; 166 return -1;
167 167
168 file_senders[numfilesenders].file = tempfile; 168 file_senders[numfilesenders].file = tempfile;
169 file_senders[numfilesenders].piecelength = fread(file_senders[numfilesenders].nextpiece, 1, tox_filedata_size(m, 169 file_senders[numfilesenders].piecelength = fread(file_senders[numfilesenders].nextpiece, 1, tox_file_data_size(m,
170 file_senders[numfilesenders].friendnum), 170 file_senders[numfilesenders].friendnum),
171 file_senders[numfilesenders].file); 171 file_senders[numfilesenders].file);
172 file_senders[numfilesenders].friendnum = friendnum; 172 file_senders[numfilesenders].friendnum = friendnum;
@@ -270,13 +270,13 @@ void get_id(Tox *m, char *data)
270 sprintf(data, "[i] ID: "); 270 sprintf(data, "[i] ID: ");
271 int offset = strlen(data); 271 int offset = strlen(data);
272 uint8_t address[TOX_FRIEND_ADDRESS_SIZE]; 272 uint8_t address[TOX_FRIEND_ADDRESS_SIZE];
273 tox_getaddress(m, address); 273 tox_get_address(m, address);
274 fraddr_to_str(address, data + offset); 274 fraddr_to_str(address, data + offset);
275} 275}
276 276
277int getfriendname_terminated(Tox *m, int friendnum, char *namebuf) 277int getfriendname_terminated(Tox *m, int friendnum, char *namebuf)
278{ 278{
279 int res = tox_getname(m, friendnum, (uint8_t *)namebuf); 279 int res = tox_get_name(m, friendnum, (uint8_t *)namebuf);
280 280
281 if (res >= 0) 281 if (res >= 0)
282 namebuf[res] = 0; 282 namebuf[res] = 0;
@@ -323,7 +323,7 @@ void print_friendlist(Tox *m)
323 uint i = 0; 323 uint i = 0;
324 324
325 while (getfriendname_terminated(m, i, name) != -1) { 325 while (getfriendname_terminated(m, i, name) != -1) {
326 if (!tox_getclient_id(m, i, fraddr_bin)) 326 if (!tox_get_client_id(m, i, fraddr_bin))
327 fraddr_to_str(fraddr_bin, fraddr_str); 327 fraddr_to_str(fraddr_bin, fraddr_str);
328 else 328 else
329 sprintf(fraddr_str, "???"); 329 sprintf(fraddr_str, "???");
@@ -406,7 +406,7 @@ void line_eval(Tox *m, char *line)
406 } 406 }
407 407
408 unsigned char *bin_string = hex_string_to_bin(temp_id); 408 unsigned char *bin_string = hex_string_to_bin(temp_id);
409 int num = tox_addfriend(m, bin_string, (uint8_t *)"Install Gentoo", sizeof("Install Gentoo")); 409 int num = tox_add_friend(m, bin_string, (uint8_t *)"Install Gentoo", sizeof("Install Gentoo"));
410 free(bin_string); 410 free(bin_string);
411 char numstring[100]; 411 char numstring[100];
412 412
@@ -449,7 +449,7 @@ void line_eval(Tox *m, char *line)
449 int num = strtoul(line + prompt_offset, posi, 0); 449 int num = strtoul(line + prompt_offset, posi, 0);
450 450
451 if (**posi != 0) { 451 if (**posi != 0) {
452 if (tox_sendmessage(m, num, (uint8_t *) *posi + 1, strlen(*posi + 1) + 1) < 1) { 452 if (tox_send_message(m, num, (uint8_t *) *posi + 1, strlen(*posi + 1) + 1) < 1) {
453 char sss[256]; 453 char sss[256];
454 sprintf(sss, "[i] could not send message to friend num %u", num); 454 sprintf(sss, "[i] could not send message to friend num %u", num);
455 new_lines(sss); 455 new_lines(sss);
@@ -469,7 +469,7 @@ void line_eval(Tox *m, char *line)
469 } 469 }
470 470
471 name[i - 3] = 0; 471 name[i - 3] = 0;
472 tox_setname(m, name, i - 2); 472 tox_set_name(m, name, i - 2);
473 char numstring[100]; 473 char numstring[100];
474 sprintf(numstring, "[i] changed nick to %s", (char *)name); 474 sprintf(numstring, "[i] changed nick to %s", (char *)name);
475 new_lines(numstring); 475 new_lines(numstring);
@@ -486,7 +486,7 @@ void line_eval(Tox *m, char *line)
486 } 486 }
487 487
488 status[i - 3] = 0; 488 status[i - 3] = 0;
489 tox_set_statusmessage(m, status, strlen((char *)status) + 1); 489 tox_set_status_message(m, status, strlen((char *)status) + 1);
490 char numstring[100]; 490 char numstring[100];
491 sprintf(numstring, "[i] changed status to %s", (char *)status); 491 sprintf(numstring, "[i] changed status to %s", (char *)status);
492 new_lines(numstring); 492 new_lines(numstring);
@@ -498,7 +498,7 @@ void line_eval(Tox *m, char *line)
498 sprintf(numchar, "[i] you either didn't receive that request or you already accepted it"); 498 sprintf(numchar, "[i] you either didn't receive that request or you already accepted it");
499 new_lines(numchar); 499 new_lines(numchar);
500 } else { 500 } else {
501 int num = tox_addfriend_norequest(m, pending_requests[numf].id); 501 int num = tox_add_friend_norequest(m, pending_requests[numf].id);
502 502
503 if (num != -1) { 503 if (num != -1) {
504 pending_requests[numf].accepted = 1; 504 pending_requests[numf].accepted = 1;
@@ -534,7 +534,7 @@ void line_eval(Tox *m, char *line)
534 } while ((c != 'y') && (c != 'n') && (c != EOF)); 534 } while ((c != 'y') && (c != 'n') && (c != EOF));
535 535
536 if (c == 'y') { 536 if (c == 'y') {
537 int res = tox_delfriend(m, numf); 537 int res = tox_del_friend(m, numf);
538 538
539 if (res == 0) 539 if (res == 0)
540 sprintf(msg, "[i] [%i: %s] is no longer your friend", numf, fname); 540 sprintf(msg, "[i] [%i: %s] is no longer your friend", numf, fname);
@@ -660,7 +660,7 @@ void line_eval(Tox *m, char *line)
660 if (conversation_default != 0) { 660 if (conversation_default != 0) {
661 if (conversation_default > 0) { 661 if (conversation_default > 0) {
662 int friendnumber = conversation_default - 1; 662 int friendnumber = conversation_default - 1;
663 uint32_t res = tox_sendmessage(m, friendnumber, (uint8_t *)line, strlen(line) + 1); 663 uint32_t res = tox_send_message(m, friendnumber, (uint8_t *)line, strlen(line) + 1);
664 664
665 if (res == 0) { 665 if (res == 0) {
666 char sss[128]; 666 char sss[128];
@@ -1080,7 +1080,7 @@ void print_groupchatpeers(Tox *m, int groupnumber)
1080 } 1080 }
1081 1081
1082 uint8_t names[num][TOX_MAX_NAME_LENGTH]; 1082 uint8_t names[num][TOX_MAX_NAME_LENGTH];
1083 tox_group_copy_names(m, groupnumber, names, num); 1083 tox_group_get_names(m, groupnumber, names, num);
1084 int i; 1084 int i;
1085 char numstr[16]; 1085 char numstr[16];
1086 char header[] = "[g]+ "; 1086 char header[] = "[g]+ ";
@@ -1182,7 +1182,7 @@ void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t
1182 sprintf(msg, "[t] %u is sending us: %s of size %llu", friendnumber, filename, (long long unsigned int)filesize); 1182 sprintf(msg, "[t] %u is sending us: %s of size %llu", friendnumber, filename, (long long unsigned int)filesize);
1183 new_lines(msg); 1183 new_lines(msg);
1184 1184
1185 if (tox_file_sendcontrol(m, friendnumber, 1, filenumber, 0, 0, 0) == 0) { 1185 if (tox_file_send_control(m, friendnumber, 1, filenumber, 0, 0, 0) == 0) {
1186 sprintf(msg, "Accepted file transfer. (saving file as: %u.%u.bin)", friendnumber, filenumber); 1186 sprintf(msg, "Accepted file transfer. (saving file as: %u.%u.bin)", friendnumber, filenumber);
1187 new_lines(msg); 1187 new_lines(msg);
1188 } else 1188 } else
@@ -1211,7 +1211,7 @@ void write_file(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uin
1211 sprintf(filename, "%u.%u.bin", friendnumber, filenumber); 1211 sprintf(filename, "%u.%u.bin", friendnumber, filenumber);
1212 FILE *pFile = fopen(filename, "a"); 1212 FILE *pFile = fopen(filename, "a");
1213 1213
1214 if (tox_file_dataremaining(m, friendnumber, filenumber, 1) == 0) { 1214 if (tox_file_data_remaining(m, friendnumber, filenumber, 1) == 0) {
1215 //file_control(m, friendnumber, 1, filenumber, 3, 0, 0); 1215 //file_control(m, friendnumber, 1, filenumber, 3, 0, 0);
1216 char msg[512]; 1216 char msg[512];
1217 sprintf(msg, "[t] %u file transfer: %u completed", friendnumber, filenumber); 1217 sprintf(msg, "[t] %u file transfer: %u completed", friendnumber, filenumber);
@@ -1267,16 +1267,16 @@ int main(int argc, char *argv[])
1267 1267
1268 load_data_or_init(m, filename); 1268 load_data_or_init(m, filename);
1269 1269
1270 tox_callback_friendrequest(m, print_request, NULL); 1270 tox_callback_friend_request(m, print_request, NULL);
1271 tox_callback_friendmessage(m, print_message, NULL); 1271 tox_callback_friend_message(m, print_message, NULL);
1272 tox_callback_namechange(m, print_nickchange, NULL); 1272 tox_callback_name_change(m, print_nickchange, NULL);
1273 tox_callback_statusmessage(m, print_statuschange, NULL); 1273 tox_callback_status_message(m, print_statuschange, NULL);
1274 tox_callback_group_invite(m, print_invite, NULL); 1274 tox_callback_group_invite(m, print_invite, NULL);
1275 tox_callback_group_message(m, print_groupmessage, NULL); 1275 tox_callback_group_message(m, print_groupmessage, NULL);
1276 tox_callback_file_data(m, write_file, NULL); 1276 tox_callback_file_data(m, write_file, NULL);
1277 tox_callback_file_control(m, file_print_control, NULL); 1277 tox_callback_file_control(m, file_print_control, NULL);
1278 tox_callback_file_sendrequest(m, file_request_accept, NULL); 1278 tox_callback_file_send_request(m, file_request_accept, NULL);
1279 tox_callback_group_namelistchange(m, print_groupnamelistchange, NULL); 1279 tox_callback_group_namelist_change(m, print_groupnamelistchange, NULL);
1280 1280
1281 initscr(); 1281 initscr();
1282 noecho(); 1282 noecho();
@@ -1303,7 +1303,7 @@ int main(int argc, char *argv[])
1303 1303
1304 new_lines("[i] change username with /n"); 1304 new_lines("[i] change username with /n");
1305 uint8_t name[TOX_MAX_NAME_LENGTH + 1]; 1305 uint8_t name[TOX_MAX_NAME_LENGTH + 1];
1306 uint16_t namelen = tox_getselfname(m, name, sizeof(name)); 1306 uint16_t namelen = tox_get_self_name(m, name, sizeof(name));
1307 name[namelen] = 0; 1307 name[namelen] = 0;
1308 1308
1309 if (namelen > 0) { 1309 if (namelen > 0) {
diff --git a/testing/tox_sync.c b/testing/tox_sync.c
index 3207e297..c00189aa 100644
--- a/testing/tox_sync.c
+++ b/testing/tox_sync.c
@@ -62,11 +62,11 @@ void send_filesenders(Tox *m)
62 continue; 62 continue;
63 63
64 while (1) { 64 while (1) {
65 if (!tox_file_senddata(m, file_senders[i].friendnum, file_senders[i].filenumber, file_senders[i].nextpiece, 65 if (!tox_file_send_data(m, file_senders[i].friendnum, file_senders[i].filenumber, file_senders[i].nextpiece,
66 file_senders[i].piecelength)) 66 file_senders[i].piecelength))
67 break; 67 break;
68 68
69 file_senders[i].piecelength = fread(file_senders[i].nextpiece, 1, tox_filedata_size(m, file_senders[i].friendnum), 69 file_senders[i].piecelength = fread(file_senders[i].nextpiece, 1, tox_file_data_size(m, file_senders[i].friendnum),
70 file_senders[i].file); 70 file_senders[i].file);
71 71
72 if (file_senders[i].piecelength == 0) { 72 if (file_senders[i].piecelength == 0) {
@@ -74,7 +74,7 @@ void send_filesenders(Tox *m)
74 file_senders[i].file = 0; 74 file_senders[i].file = 0;
75 75
76 printf("[t] %u file transfer: %u completed %i\n", file_senders[i].friendnum, file_senders[i].filenumber, 76 printf("[t] %u file transfer: %u completed %i\n", file_senders[i].friendnum, file_senders[i].filenumber,
77 tox_file_sendcontrol(m, file_senders[i].friendnum, 0, file_senders[i].filenumber, TOX_FILECONTROL_FINISHED, 0, 0)); 77 tox_file_send_control(m, file_senders[i].friendnum, 0, file_senders[i].filenumber, TOX_FILECONTROL_FINISHED, 0, 0));
78 break; 78 break;
79 } 79 }
80 } 80 }
@@ -90,13 +90,13 @@ int add_filesender(Tox *m, uint16_t friendnum, char *filename)
90 fseek(tempfile, 0, SEEK_END); 90 fseek(tempfile, 0, SEEK_END);
91 uint64_t filesize = ftell(tempfile); 91 uint64_t filesize = ftell(tempfile);
92 fseek(tempfile, 0, SEEK_SET); 92 fseek(tempfile, 0, SEEK_SET);
93 int filenum = tox_new_filesender(m, friendnum, filesize, (uint8_t *)filename, strlen(filename) + 1); 93 int filenum = tox_new_file_sender(m, friendnum, filesize, (uint8_t *)filename, strlen(filename) + 1);
94 94
95 if (filenum == -1) 95 if (filenum == -1)
96 return -1; 96 return -1;
97 97
98 file_senders[numfilesenders].file = tempfile; 98 file_senders[numfilesenders].file = tempfile;
99 file_senders[numfilesenders].piecelength = fread(file_senders[numfilesenders].nextpiece, 1, tox_filedata_size(m, 99 file_senders[numfilesenders].piecelength = fread(file_senders[numfilesenders].nextpiece, 1, tox_file_data_size(m,
100 file_senders[numfilesenders].friendnum), 100 file_senders[numfilesenders].friendnum),
101 file_senders[numfilesenders].file); 101 file_senders[numfilesenders].file);
102 file_senders[numfilesenders].friendnum = friendnum; 102 file_senders[numfilesenders].friendnum = friendnum;
@@ -149,18 +149,18 @@ void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t
149 149
150 if (tempfile != 0) { 150 if (tempfile != 0) {
151 fclose(tempfile); 151 fclose(tempfile);
152 tox_file_sendcontrol(m, friendnumber, 1, filenumber, TOX_FILECONTROL_KILL, 0, 0); 152 tox_file_send_control(m, friendnumber, 1, filenumber, TOX_FILECONTROL_KILL, 0, 0);
153 return; 153 return;
154 } 154 }
155 155
156 file_recv[filenumber].file = fopen(fullpath, "wb"); 156 file_recv[filenumber].file = fopen(fullpath, "wb");
157 157
158 if (file_recv[filenumber].file == 0) { 158 if (file_recv[filenumber].file == 0) {
159 tox_file_sendcontrol(m, friendnumber, 1, filenumber, TOX_FILECONTROL_KILL, 0, 0); 159 tox_file_send_control(m, friendnumber, 1, filenumber, TOX_FILECONTROL_KILL, 0, 0);
160 return; 160 return;
161 } 161 }
162 162
163 if (tox_file_sendcontrol(m, friendnumber, 1, filenumber, TOX_FILECONTROL_ACCEPT, 0, 0)) { 163 if (tox_file_send_control(m, friendnumber, 1, filenumber, TOX_FILECONTROL_ACCEPT, 0, 0)) {
164 printf("Accepted file transfer. (file: %s)\n", fullpath); 164 printf("Accepted file transfer. (file: %s)\n", fullpath);
165 } 165 }
166 166
@@ -215,8 +215,8 @@ int main(int argc, char *argv[])
215 Tox *tox = tox_new(ipv6enabled); 215 Tox *tox = tox_new(ipv6enabled);
216 tox_callback_file_data(tox, write_file, NULL); 216 tox_callback_file_data(tox, write_file, NULL);
217 tox_callback_file_control(tox, file_print_control, NULL); 217 tox_callback_file_control(tox, file_print_control, NULL);
218 tox_callback_file_sendrequest(tox, file_request_accept, NULL); 218 tox_callback_file_send_request(tox, file_request_accept, NULL);
219 tox_callback_connectionstatus(tox, print_online, NULL); 219 tox_callback_connection_status(tox, print_online, NULL);
220 220
221 uint16_t port = htons(atoi(argv[argvoffset + 2])); 221 uint16_t port = htons(atoi(argv[argvoffset + 2]));
222 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); 222 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]);
@@ -228,7 +228,7 @@ int main(int argc, char *argv[])
228 } 228 }
229 229
230 uint8_t address[TOX_FRIEND_ADDRESS_SIZE]; 230 uint8_t address[TOX_FRIEND_ADDRESS_SIZE];
231 tox_getaddress(tox, address); 231 tox_get_address(tox, address);
232 uint32_t i; 232 uint32_t i;
233 233
234 for (i = 0; i < TOX_FRIEND_ADDRESS_SIZE; i++) { 234 for (i = 0; i < TOX_FRIEND_ADDRESS_SIZE; i++) {
@@ -242,7 +242,7 @@ int main(int argc, char *argv[])
242 return 1; 242 return 1;
243 } 243 }
244 244
245 int num = tox_addfriend(tox, hex_string_to_bin(temp_id), (uint8_t *)"Install Gentoo", sizeof("Install Gentoo")); 245 int num = tox_add_friend(tox, hex_string_to_bin(temp_id), (uint8_t *)"Install Gentoo", sizeof("Install Gentoo"));
246 246
247 if (num < 0) { 247 if (num < 0) {
248 printf("\nSomething went wrong when adding friend.\n"); 248 printf("\nSomething went wrong when adding friend.\n");
@@ -260,7 +260,7 @@ int main(int argc, char *argv[])
260 notconnected = 0; 260 notconnected = 0;
261 } 261 }
262 262
263 if (not_sending() && tox_get_friend_connectionstatus(tox, num)) { 263 if (not_sending() && tox_get_friend_connection_status(tox, num)) {
264 d = opendir(path); 264 d = opendir(path);
265 265
266 if (d) { 266 if (d) {
diff --git a/toxcore/tox.c b/toxcore/tox.c
index f4e65ec8..bdc110e6 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -37,7 +37,7 @@ typedef struct Messenger Tox;
37 * Format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] 37 * Format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)]
38 * 38 *
39 */ 39 */
40void tox_getaddress(Tox *tox, uint8_t *address) 40void tox_get_address(Tox *tox, uint8_t *address)
41{ 41{
42 Messenger *m = tox; 42 Messenger *m = tox;
43 getaddress(m, address); 43 getaddress(m, address);
@@ -60,7 +60,7 @@ void tox_getaddress(Tox *tox, uint8_t *address)
60 * (the nospam for that friend was set to the new one). 60 * (the nospam for that friend was set to the new one).
61 * return FAERR_NOMEM if increasing the friend list size fails. 61 * return FAERR_NOMEM if increasing the friend list size fails.
62 */ 62 */
63int tox_addfriend(Tox *tox, uint8_t *address, uint8_t *data, uint16_t length) 63int tox_add_friend(Tox *tox, uint8_t *address, uint8_t *data, uint16_t length)
64{ 64{
65 Messenger *m = tox; 65 Messenger *m = tox;
66 return m_addfriend(m, address, data, length); 66 return m_addfriend(m, address, data, length);
@@ -71,7 +71,7 @@ int tox_addfriend(Tox *tox, uint8_t *address, uint8_t *data, uint16_t length)
71 * return the friend number if success. 71 * return the friend number if success.
72 * return -1 if failure. 72 * return -1 if failure.
73 */ 73 */
74int tox_addfriend_norequest(Tox *tox, uint8_t *client_id) 74int tox_add_friend_norequest(Tox *tox, uint8_t *client_id)
75{ 75{
76 Messenger *m = tox; 76 Messenger *m = tox;
77 return m_addfriend_norequest(m, client_id); 77 return m_addfriend_norequest(m, client_id);
@@ -80,7 +80,7 @@ int tox_addfriend_norequest(Tox *tox, uint8_t *client_id)
80/* return the friend id associated to that client id. 80/* return the friend id associated to that client id.
81 * return -1 if no such friend. 81 * return -1 if no such friend.
82 */ 82 */
83int tox_getfriend_id(Tox *tox, uint8_t *client_id) 83int tox_get_friend_id(Tox *tox, uint8_t *client_id)
84{ 84{
85 Messenger *m = tox; 85 Messenger *m = tox;
86 return getfriend_id(m, client_id); 86 return getfriend_id(m, client_id);
@@ -92,14 +92,14 @@ int tox_getfriend_id(Tox *tox, uint8_t *client_id)
92 * return 0 if success. 92 * return 0 if success.
93 * return -1 if failure. 93 * return -1 if failure.
94 */ 94 */
95int tox_getclient_id(Tox *tox, int friend_id, uint8_t *client_id) 95int tox_get_client_id(Tox *tox, int friend_id, uint8_t *client_id)
96{ 96{
97 Messenger *m = tox; 97 Messenger *m = tox;
98 return getclient_id(m, friend_id, client_id); 98 return getclient_id(m, friend_id, client_id);
99} 99}
100 100
101/* Remove a friend. */ 101/* Remove a friend. */
102int tox_delfriend(Tox *tox, int friendnumber) 102int tox_del_friend(Tox *tox, int friendnumber)
103{ 103{
104 Messenger *m = tox; 104 Messenger *m = tox;
105 return m_delfriend(m, friendnumber); 105 return m_delfriend(m, friendnumber);
@@ -111,7 +111,7 @@ int tox_delfriend(Tox *tox, int friendnumber)
111 * return 0 if friend is not connected to us (Offline). 111 * return 0 if friend is not connected to us (Offline).
112 * return -1 on failure. 112 * return -1 on failure.
113 */ 113 */
114int tox_get_friend_connectionstatus(Tox *tox, int friendnumber) 114int tox_get_friend_connection_status(Tox *tox, int friendnumber)
115{ 115{
116 Messenger *m = tox; 116 Messenger *m = tox;
117 return m_get_friend_connectionstatus(m, friendnumber); 117 return m_get_friend_connectionstatus(m, friendnumber);
@@ -137,13 +137,13 @@ int tox_friend_exists(Tox *tox, int friendnumber)
137 * m_sendmessage_withid will send a message with the id of your choosing, 137 * m_sendmessage_withid will send a message with the id of your choosing,
138 * however we can generate an id for you by calling plain m_sendmessage. 138 * however we can generate an id for you by calling plain m_sendmessage.
139 */ 139 */
140uint32_t tox_sendmessage(Tox *tox, int friendnumber, uint8_t *message, uint32_t length) 140uint32_t tox_send_message(Tox *tox, int friendnumber, uint8_t *message, uint32_t length)
141{ 141{
142 Messenger *m = tox; 142 Messenger *m = tox;
143 return m_sendmessage(m, friendnumber, message, length); 143 return m_sendmessage(m, friendnumber, message, length);
144} 144}
145 145
146uint32_t tox_sendmessage_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *message, uint32_t length) 146uint32_t tox_send_message_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *message, uint32_t length)
147{ 147{
148 Messenger *m = tox; 148 Messenger *m = tox;
149 return m_sendmessage_withid(m, friendnumber, theid, message, length); 149 return m_sendmessage_withid(m, friendnumber, theid, message, length);
@@ -159,13 +159,13 @@ uint32_t tox_sendmessage_withid(Tox *tox, int friendnumber, uint32_t theid, uint
159 * m_sendaction_withid will send an action message with the id of your choosing, 159 * m_sendaction_withid will send an action message with the id of your choosing,
160 * however we can generate an id for you by calling plain m_sendaction. 160 * however we can generate an id for you by calling plain m_sendaction.
161 */ 161 */
162uint32_t tox_sendaction(Tox *tox, int friendnumber, uint8_t *action, uint32_t length) 162uint32_t tox_send_action(Tox *tox, int friendnumber, uint8_t *action, uint32_t length)
163{ 163{
164 Messenger *m = tox; 164 Messenger *m = tox;
165 return m_sendaction(m, friendnumber, action, length); 165 return m_sendaction(m, friendnumber, action, length);
166} 166}
167 167
168uint32_t tox_sendaction_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *action, uint32_t length) 168uint32_t tox_send_action_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *action, uint32_t length)
169{ 169{
170 Messenger *m = tox; 170 Messenger *m = tox;
171 return m_sendaction_withid(m, friendnumber, theid, action, length); 171 return m_sendaction_withid(m, friendnumber, theid, action, length);
@@ -179,7 +179,7 @@ uint32_t tox_sendaction_withid(Tox *tox, int friendnumber, uint32_t theid, uint8
179 * return 0 if success. 179 * return 0 if success.
180 * return -1 if failure. 180 * return -1 if failure.
181 */ 181 */
182int tox_setname(Tox *tox, uint8_t *name, uint16_t length) 182int tox_set_name(Tox *tox, uint8_t *name, uint16_t length)
183{ 183{
184 Messenger *m = tox; 184 Messenger *m = tox;
185 return setname(m, name, length); 185 return setname(m, name, length);
@@ -193,7 +193,7 @@ int tox_setname(Tox *tox, uint8_t *name, uint16_t length)
193 * return length of the name. 193 * return length of the name.
194 * return 0 on error. 194 * return 0 on error.
195 */ 195 */
196uint16_t tox_getselfname(Tox *tox, uint8_t *name, uint16_t nlen) 196uint16_t tox_get_self_name(Tox *tox, uint8_t *name, uint16_t nlen)
197{ 197{
198 Messenger *m = tox; 198 Messenger *m = tox;
199 return getself_name(m, name, nlen); 199 return getself_name(m, name, nlen);
@@ -205,7 +205,7 @@ uint16_t tox_getselfname(Tox *tox, uint8_t *name, uint16_t nlen)
205 * return length of name (with the NULL terminator) if success. 205 * return length of name (with the NULL terminator) if success.
206 * return -1 if failure. 206 * return -1 if failure.
207 */ 207 */
208int tox_getname(Tox *tox, int friendnumber, uint8_t *name) 208int tox_get_name(Tox *tox, int friendnumber, uint8_t *name)
209{ 209{
210 Messenger *m = tox; 210 Messenger *m = tox;
211 return getname(m, friendnumber, name); 211 return getname(m, friendnumber, name);
@@ -216,7 +216,7 @@ int tox_getname(Tox *tox, int friendnumber, uint8_t *name)
216 * 216 *
217 * return 0 on success, -1 on failure. 217 * return 0 on success, -1 on failure.
218 */ 218 */
219int tox_set_statusmessage(Tox *tox, uint8_t *status, uint16_t length) 219int tox_set_status_message(Tox *tox, uint8_t *status, uint16_t length)
220{ 220{
221 Messenger *m = tox; 221 Messenger *m = tox;
222 return m_set_statusmessage(m, status, length); 222 return m_set_statusmessage(m, status, length);
@@ -231,7 +231,7 @@ int tox_set_userstatus(Tox *tox, TOX_USERSTATUS status)
231/* return the length of friendnumber's status message, including null. 231/* return the length of friendnumber's status message, including null.
232 * Pass it into malloc. 232 * Pass it into malloc.
233 */ 233 */
234int tox_get_statusmessage_size(Tox *tox, int friendnumber) 234int tox_get_status_message_size(Tox *tox, int friendnumber)
235{ 235{
236 Messenger *m = tox; 236 Messenger *m = tox;
237 return m_get_statusmessage_size(m, friendnumber); 237 return m_get_statusmessage_size(m, friendnumber);
@@ -241,13 +241,13 @@ int tox_get_statusmessage_size(Tox *tox, int friendnumber)
241 * Get the size you need to allocate from m_get_statusmessage_size. 241 * Get the size you need to allocate from m_get_statusmessage_size.
242 * The self variant will copy our own status message. 242 * The self variant will copy our own status message.
243 */ 243 */
244int tox_copy_statusmessage(Tox *tox, int friendnumber, uint8_t *buf, uint32_t maxlen) 244int tox_get_status_message(Tox *tox, int friendnumber, uint8_t *buf, uint32_t maxlen)
245{ 245{
246 Messenger *m = tox; 246 Messenger *m = tox;
247 return m_copy_statusmessage(m, friendnumber, buf, maxlen); 247 return m_copy_statusmessage(m, friendnumber, buf, maxlen);
248} 248}
249 249
250int tox_copy_self_statusmessage(Tox *tox, uint8_t *buf, uint32_t maxlen) 250int tox_get_self_status_message(Tox *tox, uint8_t *buf, uint32_t maxlen)
251{ 251{
252 Messenger *m = tox; 252 Messenger *m = tox;
253 return m_copy_self_statusmessage(m, buf, maxlen); 253 return m_copy_self_statusmessage(m, buf, maxlen);
@@ -258,13 +258,13 @@ int tox_copy_self_statusmessage(Tox *tox, uint8_t *buf, uint32_t maxlen)
258 * As above, the self variant will return our own USERSTATUS. 258 * As above, the self variant will return our own USERSTATUS.
259 * If friendnumber is invalid, this shall return USERSTATUS_INVALID. 259 * If friendnumber is invalid, this shall return USERSTATUS_INVALID.
260 */ 260 */
261TOX_USERSTATUS tox_get_userstatus(Tox *tox, int friendnumber) 261TOX_USERSTATUS tox_get_user_status(Tox *tox, int friendnumber)
262{ 262{
263 Messenger *m = tox; 263 Messenger *m = tox;
264 return (TOX_USERSTATUS)m_get_userstatus(m, friendnumber); 264 return (TOX_USERSTATUS)m_get_userstatus(m, friendnumber);
265} 265}
266 266
267TOX_USERSTATUS tox_get_selfuserstatus(Tox *tox) 267TOX_USERSTATUS tox_get_self_user_status(Tox *tox)
268{ 268{
269 Messenger *m = tox; 269 Messenger *m = tox;
270 return (TOX_USERSTATUS)m_get_self_userstatus(m); 270 return (TOX_USERSTATUS)m_get_self_userstatus(m);
@@ -294,7 +294,7 @@ uint32_t tox_count_friendlist(Tox *tox)
294 * Otherwise, returns the number of elements copied. 294 * Otherwise, returns the number of elements copied.
295 * If the array was too small, the contents 295 * If the array was too small, the contents
296 * of out_list will be truncated to list_size. */ 296 * of out_list will be truncated to list_size. */
297uint32_t tox_copy_friendlist(Tox *tox, int *out_list, uint32_t list_size) 297uint32_t tox_get_friendlist(Tox *tox, int *out_list, uint32_t list_size)
298{ 298{
299 Messenger *m = tox; 299 Messenger *m = tox;
300 return copy_friendlist(m, out_list, list_size); 300 return copy_friendlist(m, out_list, list_size);
@@ -303,7 +303,7 @@ uint32_t tox_copy_friendlist(Tox *tox, int *out_list, uint32_t list_size)
303/* Set the function that will be executed when a friend request is received. 303/* Set the function that will be executed when a friend request is received.
304 * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) 304 * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length)
305 */ 305 */
306void tox_callback_friendrequest(Tox *tox, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), void *userdata) 306void tox_callback_friend_request(Tox *tox, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), void *userdata)
307{ 307{
308 Messenger *m = tox; 308 Messenger *m = tox;
309 m_callback_friendrequest(m, function, userdata); 309 m_callback_friendrequest(m, function, userdata);
@@ -313,7 +313,7 @@ void tox_callback_friendrequest(Tox *tox, void (*function)(uint8_t *, uint8_t *,
313/* Set the function that will be executed when a message from a friend is received. 313/* Set the function that will be executed when a message from a friend is received.
314 * Function format is: function(int friendnumber, uint8_t * message, uint32_t length) 314 * Function format is: function(int friendnumber, uint8_t * message, uint32_t length)
315 */ 315 */
316void tox_callback_friendmessage(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *), 316void tox_callback_friend_message(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *),
317 void *userdata) 317 void *userdata)
318{ 318{
319 Messenger *m = tox; 319 Messenger *m = tox;
@@ -333,7 +333,7 @@ void tox_callback_action(Tox *tox, void (*function)(Messenger *tox, int, uint8_t
333 * function(int friendnumber, uint8_t *newname, uint16_t length) 333 * function(int friendnumber, uint8_t *newname, uint16_t length)
334 * You are not responsible for freeing newname. 334 * You are not responsible for freeing newname.
335 */ 335 */
336void tox_callback_namechange(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *), 336void tox_callback_name_change(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *),
337 void *userdata) 337 void *userdata)
338{ 338{
339 Messenger *m = tox; 339 Messenger *m = tox;
@@ -344,7 +344,7 @@ void tox_callback_namechange(Tox *tox, void (*function)(Messenger *tox, int, uin
344 * function(int friendnumber, uint8_t *newstatus, uint16_t length) 344 * function(int friendnumber, uint8_t *newstatus, uint16_t length)
345 * You are not responsible for freeing newstatus. 345 * You are not responsible for freeing newstatus.
346 */ 346 */
347void tox_callback_statusmessage(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *), 347void tox_callback_status_message(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *),
348 void *userdata) 348 void *userdata)
349{ 349{
350 Messenger *m = tox; 350 Messenger *m = tox;
@@ -354,7 +354,7 @@ void tox_callback_statusmessage(Tox *tox, void (*function)(Messenger *tox, int,
354/* Set the callback for status type changes. 354/* Set the callback for status type changes.
355 * function(int friendnumber, USERSTATUS kind) 355 * function(int friendnumber, USERSTATUS kind)
356 */ 356 */
357void tox_callback_userstatus(Tox *tox, void (*_function)(Tox *tox, int, TOX_USERSTATUS, void *), void *userdata) 357void tox_callback_user_status(Tox *tox, void (*_function)(Tox *tox, int, TOX_USERSTATUS, void *), void *userdata)
358{ 358{
359 Messenger *m = tox; 359 Messenger *m = tox;
360 typedef void (*function_type)(Messenger *, int, USERSTATUS, void *); 360 typedef void (*function_type)(Messenger *, int, USERSTATUS, void *);
@@ -388,7 +388,7 @@ void tox_callback_read_receipt(Tox *tox, void (*function)(Messenger *tox, int, u
388 * being previously online" part. It's assumed that when adding friends, 388 * being previously online" part. It's assumed that when adding friends,
389 * their connection status is offline. 389 * their connection status is offline.
390 */ 390 */
391void tox_callback_connectionstatus(Tox *tox, void (*function)(Messenger *tox, int, uint8_t, void *), void *userdata) 391void tox_callback_connection_status(Tox *tox, void (*function)(Messenger *tox, int, uint8_t, void *), void *userdata)
392{ 392{
393 Messenger *m = tox; 393 Messenger *m = tox;
394 m_callback_connectionstatus(m, function, userdata); 394 m_callback_connectionstatus(m, function, userdata);
@@ -422,7 +422,7 @@ void tox_callback_group_message(Tox *tox, void (*function)(Messenger *tox, int,
422 * Function(Tox *tox, int groupnumber, void *userdata) 422 * Function(Tox *tox, int groupnumber, void *userdata)
423 */ 423 */
424 424
425void tox_callback_group_namelistchange(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), void *userdata) 425void tox_callback_group_namelist_change(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), void *userdata)
426{ 426{
427 Messenger *m = tox; 427 Messenger *m = tox;
428 m_callback_group_namelistchange(m, function, userdata); 428 m_callback_group_namelistchange(m, function, userdata);
@@ -507,7 +507,7 @@ int tox_group_number_peers(Tox *tox, int groupnumber)
507 * 507 *
508 * return -1 on failure. 508 * return -1 on failure.
509 */ 509 */
510int tox_group_copy_names(Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t length) 510int tox_group_get_names(Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t length)
511{ 511{
512 Messenger *m = tox; 512 Messenger *m = tox;
513 return group_names(m, groupnumber, names, length); 513 return group_names(m, groupnumber, names, length);
@@ -527,7 +527,7 @@ uint32_t tox_count_chatlist(Tox *tox)
527 * Otherwise, returns the number of elements copied. 527 * Otherwise, returns the number of elements copied.
528 * If the array was too small, the contents 528 * If the array was too small, the contents
529 * of out_list will be truncated to list_size. */ 529 * of out_list will be truncated to list_size. */
530uint32_t tox_copy_chatlist(Tox *tox, int *out_list, uint32_t list_size) 530uint32_t tox_get_chatlist(Tox *tox, int *out_list, uint32_t list_size)
531{ 531{
532 Messenger *m = tox; 532 Messenger *m = tox;
533 return copy_chatlist(m, out_list, list_size); 533 return copy_chatlist(m, out_list, list_size);
@@ -541,7 +541,7 @@ uint32_t tox_copy_chatlist(Tox *tox, int *out_list, uint32_t list_size)
541 * 541 *
542 * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata) 542 * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata)
543 */ 543 */
544void tox_callback_file_sendrequest(Tox *tox, void (*function)(Messenger *tox, int, uint8_t, uint64_t, uint8_t *, 544void tox_callback_file_send_request(Tox *tox, void (*function)(Messenger *tox, int, uint8_t, uint64_t, uint8_t *,
545 uint16_t, 545 uint16_t,
546 void *), void *userdata) 546 void *), void *userdata)
547{ 547{
@@ -577,7 +577,7 @@ void tox_callback_file_data(Tox *tox, void (*function)(Messenger *tox, int, uint
577 * return file number on success 577 * return file number on success
578 * return -1 on failure 578 * return -1 on failure
579 */ 579 */
580int tox_new_filesender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length) 580int tox_new_file_sender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length)
581{ 581{
582 Messenger *m = tox; 582 Messenger *m = tox;
583 return new_filesender(m, friendnumber, filesize, filename, filename_length); 583 return new_filesender(m, friendnumber, filesize, filename, filename_length);
@@ -588,7 +588,7 @@ int tox_new_filesender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *f
588 * return 0 on success 588 * return 0 on success
589 * return -1 on failure 589 * return -1 on failure
590 */ 590 */
591int tox_file_sendcontrol(Tox *tox, int friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t message_id, 591int tox_file_send_control(Tox *tox, int friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t message_id,
592 uint8_t *data, uint16_t length) 592 uint8_t *data, uint16_t length)
593{ 593{
594 Messenger *m = tox; 594 Messenger *m = tox;
@@ -599,18 +599,18 @@ int tox_file_sendcontrol(Tox *tox, int friendnumber, uint8_t send_receive, uint8
599 * return 0 on success 599 * return 0 on success
600 * return -1 on failure 600 * return -1 on failure
601 */ 601 */
602int tox_file_senddata(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length) 602int tox_file_send_data(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length)
603{ 603{
604 Messenger *m = tox; 604 Messenger *m = tox;
605 return file_data(m, friendnumber, filenumber, data, length); 605 return file_data(m, friendnumber, filenumber, data, length);
606} 606}
607 607
608/* Returns the recommended/maximum size of the filedata you send with tox_file_senddata() 608/* Returns the recommended/maximum size of the filedata you send with tox_file_send_data()
609 * 609 *
610 * return size on success 610 * return size on success
611 * return -1 on failure (currently will never return -1) 611 * return -1 on failure (currently will never return -1)
612 */ 612 */
613int tox_filedata_size(Tox *tox, int friendnumber) 613int tox_file_data_size(Tox *tox, int friendnumber)
614{ 614{
615 return MAX_DATA_SIZE - crypto_box_MACBYTES - 3; 615 return MAX_DATA_SIZE - crypto_box_MACBYTES - 3;
616} 616}
@@ -622,7 +622,7 @@ int tox_filedata_size(Tox *tox, int friendnumber)
622 * return number of bytes remaining to be sent/received on success 622 * return number of bytes remaining to be sent/received on success
623 * return 0 on failure 623 * return 0 on failure
624 */ 624 */
625uint64_t tox_file_dataremaining(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t send_receive) 625uint64_t tox_file_data_remaining(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t send_receive)
626{ 626{
627 Messenger *m = tox; 627 Messenger *m = tox;
628 return file_dataremaining(m, friendnumber, filenumber, send_receive); 628 return file_dataremaining(m, friendnumber, filenumber, send_receive);
diff --git a/toxcore/tox.h b/toxcore/tox.h
index ea373488..407d7441 100644
--- a/toxcore/tox.h
+++ b/toxcore/tox.h
@@ -129,7 +129,7 @@ typedef struct Tox Tox;
129/* return FRIEND_ADDRESS_SIZE byte address to give to others. 129/* return FRIEND_ADDRESS_SIZE byte address to give to others.
130 * format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] 130 * format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)]
131 */ 131 */
132void tox_getaddress(Tox *tox, uint8_t *address); 132void tox_get_address(Tox *tox, uint8_t *address);
133 133
134/* Add a friend. 134/* Add a friend.
135 * Set the data that will be sent along with friend request. 135 * Set the data that will be sent along with friend request.
@@ -147,28 +147,28 @@ void tox_getaddress(Tox *tox, uint8_t *address);
147 * (the nospam for that friend was set to the new one). 147 * (the nospam for that friend was set to the new one).
148 * return TOX_FAERR_NOMEM if increasing the friend list size fails. 148 * return TOX_FAERR_NOMEM if increasing the friend list size fails.
149 */ 149 */
150int tox_addfriend(Tox *tox, uint8_t *address, uint8_t *data, uint16_t length); 150int tox_add_friend(Tox *tox, uint8_t *address, uint8_t *data, uint16_t length);
151 151
152 152
153/* Add a friend without sending a friendrequest. 153/* Add a friend without sending a friendrequest.
154 * return the friend number if success. 154 * return the friend number if success.
155 * return -1 if failure. 155 * return -1 if failure.
156 */ 156 */
157int tox_addfriend_norequest(Tox *tox, uint8_t *client_id); 157int tox_add_friend_norequest(Tox *tox, uint8_t *client_id);
158 158
159/* return the friend id associated to that client id. 159/* return the friend id associated to that client id.
160 return -1 if no such friend */ 160 return -1 if no such friend */
161int tox_getfriend_id(Tox *tox, uint8_t *client_id); 161int tox_get_friend_id(Tox *tox, uint8_t *client_id);
162 162
163/* Copies the public key associated to that friend id into client_id buffer. 163/* Copies the public key associated to that friend id into client_id buffer.
164 * Make sure that client_id is of size CLIENT_ID_SIZE. 164 * Make sure that client_id is of size CLIENT_ID_SIZE.
165 * return 0 if success. 165 * return 0 if success.
166 * return -1 if failure. 166 * return -1 if failure.
167 */ 167 */
168int tox_getclient_id(Tox *tox, int friend_id, uint8_t *client_id); 168int tox_get_client_id(Tox *tox, int friend_id, uint8_t *client_id);
169 169
170/* Remove a friend. */ 170/* Remove a friend. */
171int tox_delfriend(Tox *tox, int friendnumber); 171int tox_del_friend(Tox *tox, int friendnumber);
172 172
173/* Checks friend's connecting status. 173/* Checks friend's connecting status.
174 * 174 *
@@ -176,7 +176,7 @@ int tox_delfriend(Tox *tox, int friendnumber);
176 * return 0 if friend is not connected to us (Offline). 176 * return 0 if friend is not connected to us (Offline).
177 * return -1 on failure. 177 * return -1 on failure.
178 */ 178 */
179int tox_get_friend_connectionstatus(Tox *tox, int friendnumber); 179int tox_get_friend_connection_status(Tox *tox, int friendnumber);
180 180
181/* Checks if there exists a friend with given friendnumber. 181/* Checks if there exists a friend with given friendnumber.
182 * 182 *
@@ -195,8 +195,8 @@ int tox_friend_exists(Tox *tox, int friendnumber);
195 * m_sendmessage_withid will send a message with the id of your choosing, 195 * m_sendmessage_withid will send a message with the id of your choosing,
196 * however we can generate an id for you by calling plain m_sendmessage. 196 * however we can generate an id for you by calling plain m_sendmessage.
197 */ 197 */
198uint32_t tox_sendmessage(Tox *tox, int friendnumber, uint8_t *message, uint32_t length); 198uint32_t tox_send_message(Tox *tox, int friendnumber, uint8_t *message, uint32_t length);
199uint32_t tox_sendmessage_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *message, uint32_t length); 199uint32_t tox_send_message_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *message, uint32_t length);
200 200
201/* Send an action to an online friend. 201/* Send an action to an online friend.
202 * 202 *
@@ -208,8 +208,8 @@ uint32_t tox_sendmessage_withid(Tox *tox, int friendnumber, uint32_t theid, uint
208 * m_sendaction_withid will send an action message with the id of your choosing, 208 * m_sendaction_withid will send an action message with the id of your choosing,
209 * however we can generate an id for you by calling plain m_sendaction. 209 * however we can generate an id for you by calling plain m_sendaction.
210 */ 210 */
211uint32_t tox_sendaction(Tox *tox, int friendnumber, uint8_t *action, uint32_t length); 211uint32_t tox_send_action(Tox *tox, int friendnumber, uint8_t *action, uint32_t length);
212uint32_t tox_sendaction_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *action, uint32_t length); 212uint32_t tox_send_action_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *action, uint32_t length);
213 213
214/* Set our nickname. 214/* Set our nickname.
215 * name must be a string of maximum MAX_NAME_LENGTH length. 215 * name must be a string of maximum MAX_NAME_LENGTH length.
@@ -219,7 +219,7 @@ uint32_t tox_sendaction_withid(Tox *tox, int friendnumber, uint32_t theid, uint8
219 * return 0 if success. 219 * return 0 if success.
220 * return -1 if failure. 220 * return -1 if failure.
221 */ 221 */
222int tox_setname(Tox *tox, uint8_t *name, uint16_t length); 222int tox_set_name(Tox *tox, uint8_t *name, uint16_t length);
223 223
224/* 224/*
225 * Get your nickname. 225 * Get your nickname.
@@ -230,7 +230,7 @@ int tox_setname(Tox *tox, uint8_t *name, uint16_t length);
230 * return length of name. 230 * return length of name.
231 * return 0 on error. 231 * return 0 on error.
232 */ 232 */
233uint16_t tox_getselfname(Tox *tox, uint8_t *name, uint16_t nlen); 233uint16_t tox_get_self_name(Tox *tox, uint8_t *name, uint16_t nlen);
234 234
235/* Get name of friendnumber and put it in name. 235/* Get name of friendnumber and put it in name.
236 * name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. 236 * name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
@@ -238,7 +238,7 @@ uint16_t tox_getselfname(Tox *tox, uint8_t *name, uint16_t nlen);
238 * return length of name (with the NULL terminator) if success. 238 * return length of name (with the NULL terminator) if success.
239 * return -1 if failure. 239 * return -1 if failure.
240 */ 240 */
241int tox_getname(Tox *tox, int friendnumber, uint8_t *name); 241int tox_get_name(Tox *tox, int friendnumber, uint8_t *name);
242 242
243/* Set our user status. 243/* Set our user status.
244 * You are responsible for freeing status after. 244 * You are responsible for freeing status after.
@@ -246,13 +246,13 @@ int tox_getname(Tox *tox, int friendnumber, uint8_t *name);
246 * returns 0 on success. 246 * returns 0 on success.
247 * returns -1 on failure. 247 * returns -1 on failure.
248 */ 248 */
249int tox_set_statusmessage(Tox *tox, uint8_t *status, uint16_t length); 249int tox_set_status_message(Tox *tox, uint8_t *status, uint16_t length);
250int tox_set_userstatus(Tox *tox, TOX_USERSTATUS status); 250int tox_set_userstatus(Tox *tox, TOX_USERSTATUS status);
251 251
252/* return the length of friendnumber's status message, including null. 252/* return the length of friendnumber's status message, including null.
253 * Pass it into malloc 253 * Pass it into malloc
254 */ 254 */
255int tox_get_statusmessage_size(Tox *tox, int friendnumber); 255int tox_get_status_message_size(Tox *tox, int friendnumber);
256 256
257/* Copy friendnumber's status message into buf, truncating if size is over maxlen. 257/* Copy friendnumber's status message into buf, truncating if size is over maxlen.
258 * Get the size you need to allocate from m_get_statusmessage_size. 258 * Get the size you need to allocate from m_get_statusmessage_size.
@@ -261,16 +261,16 @@ int tox_get_statusmessage_size(Tox *tox, int friendnumber);
261 * returns the length of the copied data on success 261 * returns the length of the copied data on success
262 * retruns -1 on failure. 262 * retruns -1 on failure.
263 */ 263 */
264int tox_copy_statusmessage(Tox *tox, int friendnumber, uint8_t *buf, uint32_t maxlen); 264int tox_get_status_message(Tox *tox, int friendnumber, uint8_t *buf, uint32_t maxlen);
265int tox_copy_self_statusmessage(Tox *tox, uint8_t *buf, uint32_t maxlen); 265int tox_get_self_status_message(Tox *tox, uint8_t *buf, uint32_t maxlen);
266 266
267/* return one of USERSTATUS values. 267/* return one of USERSTATUS values.
268 * Values unknown to your application should be represented as USERSTATUS_NONE. 268 * Values unknown to your application should be represented as USERSTATUS_NONE.
269 * As above, the self variant will return our own USERSTATUS. 269 * As above, the self variant will return our own USERSTATUS.
270 * If friendnumber is invalid, this shall return USERSTATUS_INVALID. 270 * If friendnumber is invalid, this shall return USERSTATUS_INVALID.
271 */ 271 */
272TOX_USERSTATUS tox_get_userstatus(Tox *tox, int friendnumber); 272TOX_USERSTATUS tox_get_user_status(Tox *tox, int friendnumber);
273TOX_USERSTATUS tox_get_selfuserstatus(Tox *tox); 273TOX_USERSTATUS tox_get_self_user_status(Tox *tox);
274 274
275/* Sets whether we send read receipts for friendnumber. 275/* Sets whether we send read receipts for friendnumber.
276 * This function is not lazy, and it will fail if yesno is not (0 or 1). 276 * This function is not lazy, and it will fail if yesno is not (0 or 1).
@@ -287,17 +287,17 @@ uint32_t tox_count_friendlist(Tox *tox);
287 * Otherwise, returns the number of elements copied. 287 * Otherwise, returns the number of elements copied.
288 * If the array was too small, the contents 288 * If the array was too small, the contents
289 * of out_list will be truncated to list_size. */ 289 * of out_list will be truncated to list_size. */
290uint32_t tox_copy_friendlist(Tox *tox, int *out_list, uint32_t list_size); 290uint32_t tox_get_friendlist(Tox *tox, int *out_list, uint32_t list_size);
291 291
292/* Set the function that will be executed when a friend request is received. 292/* Set the function that will be executed when a friend request is received.
293 * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) 293 * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length)
294 */ 294 */
295void tox_callback_friendrequest(Tox *tox, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), void *userdata); 295void tox_callback_friend_request(Tox *tox, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), void *userdata);
296 296
297/* Set the function that will be executed when a message from a friend is received. 297/* Set the function that will be executed when a message from a friend is received.
298 * Function format is: function(int friendnumber, uint8_t * message, uint32_t length) 298 * Function format is: function(int friendnumber, uint8_t * message, uint32_t length)
299 */ 299 */
300void tox_callback_friendmessage(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *), 300void tox_callback_friend_message(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *),
301 void *userdata); 301 void *userdata);
302 302
303/* Set the function that will be executed when an action from a friend is received. 303/* Set the function that will be executed when an action from a friend is received.
@@ -309,20 +309,20 @@ void tox_callback_action(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, ui
309 * function(int friendnumber, uint8_t *newname, uint16_t length) 309 * function(int friendnumber, uint8_t *newname, uint16_t length)
310 * You are not responsible for freeing newname 310 * You are not responsible for freeing newname
311 */ 311 */
312void tox_callback_namechange(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *), 312void tox_callback_name_change(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *),
313 void *userdata); 313 void *userdata);
314 314
315/* Set the callback for status message changes. 315/* Set the callback for status message changes.
316 * function(int friendnumber, uint8_t *newstatus, uint16_t length) 316 * function(int friendnumber, uint8_t *newstatus, uint16_t length)
317 * You are not responsible for freeing newstatus. 317 * You are not responsible for freeing newstatus.
318 */ 318 */
319void tox_callback_statusmessage(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *), 319void tox_callback_status_message(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *),
320 void *userdata); 320 void *userdata);
321 321
322/* Set the callback for status type changes. 322/* Set the callback for status type changes.
323 * function(int friendnumber, USERSTATUS kind) 323 * function(int friendnumber, USERSTATUS kind)
324 */ 324 */
325void tox_callback_userstatus(Tox *tox, void (*function)(Tox *tox, int, TOX_USERSTATUS, void *), void *userdata); 325void tox_callback_user_status(Tox *tox, void (*function)(Tox *tox, int, TOX_USERSTATUS, void *), void *userdata);
326 326
327/* Set the callback for read receipts. 327/* Set the callback for read receipts.
328 * function(int friendnumber, uint32_t receipt) 328 * function(int friendnumber, uint32_t receipt)
@@ -346,7 +346,7 @@ void tox_callback_read_receipt(Tox *tox, void (*function)(Tox *tox, int, uint32_
346 * being previously online" part. it's assumed that when adding friends, 346 * being previously online" part. it's assumed that when adding friends,
347 * their connection status is offline. 347 * their connection status is offline.
348 */ 348 */
349void tox_callback_connectionstatus(Tox *tox, void (*function)(Tox *tox, int, uint8_t, void *), void *userdata); 349void tox_callback_connection_status(Tox *tox, void (*function)(Tox *tox, int, uint8_t, void *), void *userdata);
350 350
351/**********GROUP CHAT FUNCTIONS: WARNING WILL BREAK A LOT************/ 351/**********GROUP CHAT FUNCTIONS: WARNING WILL BREAK A LOT************/
352 352
@@ -374,7 +374,7 @@ typedef enum {
374 TOX_CHAT_CHANGE_PEER_NAME, 374 TOX_CHAT_CHANGE_PEER_NAME,
375} TOX_CHAT_CHANGE; 375} TOX_CHAT_CHANGE;
376 376
377void tox_callback_group_namelistchange(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), void *userdata); 377void tox_callback_group_namelist_change(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), void *userdata);
378 378
379/* Creates a new groupchat and puts it in the chats array. 379/* Creates a new groupchat and puts it in the chats array.
380 * 380 *
@@ -430,7 +430,7 @@ int tox_group_number_peers(Tox *tox, int groupnumber);
430 * 430 *
431 * return -1 on failure. 431 * return -1 on failure.
432 */ 432 */
433int tox_group_copy_names(Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t length); 433int tox_group_get_names(Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t length);
434 434
435/* Return the number of chats in the instance m. 435/* Return the number of chats in the instance m.
436 * You should use this to determine how much memory to allocate 436 * You should use this to determine how much memory to allocate
@@ -442,26 +442,26 @@ uint32_t tox_count_chatlist(Tox *tox);
442 * Otherwise, returns the number of elements copied. 442 * Otherwise, returns the number of elements copied.
443 * If the array was too small, the contents 443 * If the array was too small, the contents
444 * of out_list will be truncated to list_size. */ 444 * of out_list will be truncated to list_size. */
445uint32_t tox_copy_chatlist(Tox *tox, int *out_list, uint32_t list_size); 445uint32_t tox_get_chatlist(Tox *tox, int *out_list, uint32_t list_size);
446 446
447 447
448/****************FILE SENDING FUNCTIONS*****************/ 448/****************FILE SENDING FUNCTIONS*****************/
449/* NOTE: This how to will be updated. 449/* NOTE: This how to will be updated.
450 * 450 *
451 * HOW TO SEND FILES CORRECTLY: 451 * HOW TO SEND FILES CORRECTLY:
452 * 1. Use tox_new_filesender(...) to create a new file sender. 452 * 1. Use tox_new_file_sender(...) to create a new file sender.
453 * 2. Wait for the callback set with tox_callback_file_control(...) to be called with receive_send == 1 and control_type == TOX_FILECONTROL_ACCEPT 453 * 2. Wait for the callback set with tox_callback_file_control(...) to be called with receive_send == 1 and control_type == TOX_FILECONTROL_ACCEPT
454 * 3. Send the data with tox_file_senddata(...) with chunk size tox_filedata_size(...) 454 * 3. Send the data with tox_file_send_data(...) with chunk size tox_file_data_size(...)
455 * 4. When sending is done, send a tox_file_sendcontrol(...) with send_receive = 0 and message_id = TOX_FILECONTROL_FINISHED 455 * 4. When sending is done, send a tox_file_send_control(...) with send_receive = 0 and message_id = TOX_FILECONTROL_FINISHED
456 * 456 *
457 * HOW TO RECEIVE FILES CORRECTLY: 457 * HOW TO RECEIVE FILES CORRECTLY:
458 * 1. wait for the callback set with tox_callback_file_sendrequest(...) 458 * 1. wait for the callback set with tox_callback_file_send_request(...)
459 * 2. accept or refuse the connection with tox_file_sendcontrol(...) with send_receive = 1 and message_id = TOX_FILECONTROL_ACCEPT or TOX_FILECONTROL_KILL 459 * 2. accept or refuse the connection with tox_file_send_control(...) with send_receive = 1 and message_id = TOX_FILECONTROL_ACCEPT or TOX_FILECONTROL_KILL
460 * 3. save all the data received with the callback set with tox_callback_file_data(...) to a file. 460 * 3. save all the data received with the callback set with tox_callback_file_data(...) to a file.
461 * 4. when the callback set with tox_callback_file_control(...) is called with receive_send == 0 and control_type == TOX_FILECONTROL_FINISHED 461 * 4. when the callback set with tox_callback_file_control(...) is called with receive_send == 0 and control_type == TOX_FILECONTROL_FINISHED
462 * the file is done transferring. 462 * the file is done transferring.
463 * 463 *
464 * tox_file_dataremaining(...) can be used to know how many bytes are left to send/receive. 464 * tox_file_data_remaining(...) can be used to know how many bytes are left to send/receive.
465 * 465 *
466 * If the connection breaks during file sending (The other person goes offline without pausing the sending and then comes back) 466 * If the connection breaks during file sending (The other person goes offline without pausing the sending and then comes back)
467 * the reciever must send a control packet with receive_send == 0 message_id = TOX_FILECONTROL_RESUME_BROKEN and the data being 467 * the reciever must send a control packet with receive_send == 0 message_id = TOX_FILECONTROL_RESUME_BROKEN and the data being
@@ -484,7 +484,7 @@ enum {
484 * 484 *
485 * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata) 485 * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata)
486 */ 486 */
487void tox_callback_file_sendrequest(Tox *tox, void (*function)(Tox *m, int, uint8_t, uint64_t, uint8_t *, uint16_t, 487void tox_callback_file_send_request(Tox *tox, void (*function)(Tox *m, int, uint8_t, uint64_t, uint8_t *, uint16_t,
488 void *), void *userdata); 488 void *), void *userdata);
489 489
490/* Set the callback for file control requests. 490/* Set the callback for file control requests.
@@ -512,7 +512,7 @@ void tox_callback_file_data(Tox *tox, void (*function)(Tox *m, int, uint8_t, uin
512 * return file number on success 512 * return file number on success
513 * return -1 on failure 513 * return -1 on failure
514 */ 514 */
515int tox_new_filesender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length); 515int tox_new_file_sender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length);
516 516
517/* Send a file control request. 517/* Send a file control request.
518 * 518 *
@@ -522,7 +522,7 @@ int tox_new_filesender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *f
522 * return 0 on success 522 * return 0 on success
523 * return -1 on failure 523 * return -1 on failure
524 */ 524 */
525int tox_file_sendcontrol(Tox *tox, int friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t message_id, 525int tox_file_send_control(Tox *tox, int friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t message_id,
526 uint8_t *data, uint16_t length); 526 uint8_t *data, uint16_t length);
527 527
528/* Send file data. 528/* Send file data.
@@ -530,14 +530,14 @@ int tox_file_sendcontrol(Tox *tox, int friendnumber, uint8_t send_receive, uint8
530 * return 0 on success 530 * return 0 on success
531 * return -1 on failure 531 * return -1 on failure
532 */ 532 */
533int tox_file_senddata(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length); 533int tox_file_send_data(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length);
534 534
535/* Returns the recommended/maximum size of the filedata you send with tox_file_senddata() 535/* Returns the recommended/maximum size of the filedata you send with tox_file_send_data()
536 * 536 *
537 * return size on success 537 * return size on success
538 * return -1 on failure (currently will never return -1) 538 * return -1 on failure (currently will never return -1)
539 */ 539 */
540int tox_filedata_size(Tox *tox, int friendnumber); 540int tox_file_data_size(Tox *tox, int friendnumber);
541 541
542/* Give the number of bytes left to be sent/received. 542/* Give the number of bytes left to be sent/received.
543 * 543 *
@@ -546,7 +546,7 @@ int tox_filedata_size(Tox *tox, int friendnumber);
546 * return number of bytes remaining to be sent/received on success 546 * return number of bytes remaining to be sent/received on success
547 * return 0 on failure 547 * return 0 on failure
548 */ 548 */
549uint64_t tox_file_dataremaining(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t send_receive); 549uint64_t tox_file_data_remaining(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t send_receive);
550 550
551/***************END OF FILE SENDING FUNCTIONS******************/ 551/***************END OF FILE SENDING FUNCTIONS******************/
552 552