summaryrefslogtreecommitdiff
path: root/testing/tox_sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/tox_sync.c')
-rw-r--r--testing/tox_sync.c26
1 files changed, 13 insertions, 13 deletions
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) {