diff options
author | irungentoo <irungentoo@gmail.com> | 2013-10-02 20:53:24 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-10-02 20:53:24 -0400 |
commit | fbd494a8b44d58911a6329761d48a85f71fc1718 (patch) | |
tree | 90cfce72c3e43cfdc0ce3e03786ec63412149c3f /testing | |
parent | 8a77211b434460cc22cb8c4d3382bbfe137336fb (diff) |
File sending added to public api.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/nTox.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/testing/nTox.c b/testing/nTox.c index 1051155f..f82c0fba 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -87,8 +87,8 @@ void send_filesenders(Tox *m) | |||
87 | continue; | 87 | continue; |
88 | 88 | ||
89 | while (1) { | 89 | while (1) { |
90 | if (!file_data(m, file_senders[i].friendnum, file_senders[i].filenumber, file_senders[i].nextpiece, | 90 | if (!tox_file_senddata(m, file_senders[i].friendnum, file_senders[i].filenumber, file_senders[i].nextpiece, |
91 | file_senders[i].piecelength)) | 91 | file_senders[i].piecelength)) |
92 | break; | 92 | break; |
93 | 93 | ||
94 | file_senders[i].piecelength = fread(file_senders[i].nextpiece, 1, 1000, file_senders[i].file); | 94 | file_senders[i].piecelength = fread(file_senders[i].nextpiece, 1, 1000, file_senders[i].file); |
@@ -96,7 +96,7 @@ void send_filesenders(Tox *m) | |||
96 | if (file_senders[i].piecelength == 0) { | 96 | if (file_senders[i].piecelength == 0) { |
97 | fclose(file_senders[i].file); | 97 | fclose(file_senders[i].file); |
98 | file_senders[i].file = 0; | 98 | file_senders[i].file = 0; |
99 | file_control(m, file_senders[i].friendnum, 0, file_senders[i].filenumber, 3, 0, 0); | 99 | tox_file_sendcontrol(m, file_senders[i].friendnum, 0, file_senders[i].filenumber, 3, 0, 0); |
100 | char msg[512]; | 100 | char msg[512]; |
101 | sprintf(msg, "[t] %u file transfer: %u completed", file_senders[i].friendnum, file_senders[i].filenumber); | 101 | sprintf(msg, "[t] %u file transfer: %u completed", file_senders[i].friendnum, file_senders[i].filenumber); |
102 | new_lines(msg); | 102 | new_lines(msg); |
@@ -115,7 +115,7 @@ int add_filesender(Tox *m, uint16_t friendnum, char *filename) | |||
115 | fseek(tempfile, 0, SEEK_END); | 115 | fseek(tempfile, 0, SEEK_END); |
116 | uint64_t filesize = ftell(tempfile); | 116 | uint64_t filesize = ftell(tempfile); |
117 | fseek(tempfile, 0, SEEK_SET); | 117 | fseek(tempfile, 0, SEEK_SET); |
118 | int filenum = new_filesender(m, friendnum, filesize, filename, strlen(filename) + 1); | 118 | int filenum = tox_new_filesender(m, friendnum, filesize, (uint8_t *)filename, strlen(filename) + 1); |
119 | 119 | ||
120 | if (filenum == -1) | 120 | if (filenum == -1) |
121 | return -1; | 121 | return -1; |
@@ -665,7 +665,7 @@ void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t | |||
665 | sprintf(msg, "[t] %u is sending us: %s of size %llu", friendnumber, filename, filesize); | 665 | sprintf(msg, "[t] %u is sending us: %s of size %llu", friendnumber, filename, filesize); |
666 | new_lines(msg); | 666 | new_lines(msg); |
667 | 667 | ||
668 | if (file_control(m, friendnumber, 1, filenumber, 0, 0, 0)) { | 668 | if (tox_file_sendcontrol(m, friendnumber, 1, filenumber, 0, 0, 0)) { |
669 | sprintf(msg, "Accepted file transfer. (saving file as: %u.%u.bin)", friendnumber, filenumber); | 669 | sprintf(msg, "Accepted file transfer. (saving file as: %u.%u.bin)", friendnumber, filenumber); |
670 | new_lines(msg); | 670 | new_lines(msg); |
671 | } else | 671 | } else |
@@ -679,7 +679,7 @@ void file_print_control(Tox *m, int friendnumber, uint8_t send_recieve, uint8_t | |||
679 | char msg[512] = {0}; | 679 | char msg[512] = {0}; |
680 | 680 | ||
681 | if (control_type == 0) | 681 | if (control_type == 0) |
682 | sprintf(msg, "[t] %u accepted file transfer: %u", friendnumber, filenumber, friendnumber, filenumber); | 682 | sprintf(msg, "[t] %u accepted file transfer: %u", friendnumber, filenumber); |
683 | else if (control_type == 3) | 683 | else if (control_type == 3) |
684 | sprintf(msg, "[t] %u file transfer: %u completed", friendnumber, filenumber); | 684 | sprintf(msg, "[t] %u file transfer: %u completed", friendnumber, filenumber); |
685 | else | 685 | else |
@@ -694,7 +694,7 @@ void write_file(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uin | |||
694 | sprintf(filename, "%u.%u.bin", friendnumber, filenumber); | 694 | sprintf(filename, "%u.%u.bin", friendnumber, filenumber); |
695 | FILE *pFile = fopen(filename, "a"); | 695 | FILE *pFile = fopen(filename, "a"); |
696 | 696 | ||
697 | if (file_dataremaining(m, friendnumber, filenumber, 1) == 0) { | 697 | if (tox_file_dataremaining(m, friendnumber, filenumber, 1) == 0) { |
698 | //file_control(m, friendnumber, 1, filenumber, 3, 0, 0); | 698 | //file_control(m, friendnumber, 1, filenumber, 3, 0, 0); |
699 | char msg[512]; | 699 | char msg[512]; |
700 | sprintf(msg, "[t] %u file transfer: %u completed", friendnumber, filenumber); | 700 | sprintf(msg, "[t] %u file transfer: %u completed", friendnumber, filenumber); |
@@ -752,9 +752,9 @@ int main(int argc, char *argv[]) | |||
752 | tox_callback_statusmessage(m, print_statuschange, NULL); | 752 | tox_callback_statusmessage(m, print_statuschange, NULL); |
753 | tox_callback_group_invite(m, print_invite, NULL); | 753 | tox_callback_group_invite(m, print_invite, NULL); |
754 | tox_callback_group_message(m, print_groupmessage, NULL); | 754 | tox_callback_group_message(m, print_groupmessage, NULL); |
755 | callback_file_data(m, write_file, NULL); | 755 | tox_callback_file_data(m, write_file, NULL); |
756 | callback_file_control(m, file_print_control, NULL); | 756 | tox_callback_file_control(m, file_print_control, NULL); |
757 | callback_file_sendrequest(m, file_request_accept, NULL); | 757 | tox_callback_file_sendrequest(m, file_request_accept, NULL); |
758 | 758 | ||
759 | initscr(); | 759 | initscr(); |
760 | noecho(); | 760 | noecho(); |