mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
revert to TOX_FILE_KIND
This commit is contained in:
parent
3bf259f69d
commit
64fefb6f43
|
@ -93,13 +93,13 @@ void handle_custom_packet(Tox *m, uint32_t friend_num, const uint8_t *data, size
|
|||
uint8_t filenum;
|
||||
uint32_t file_accepted;
|
||||
uint64_t file_size;
|
||||
void tox_file_receive(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_TYPE kind, uint64_t filesize,
|
||||
void tox_file_receive(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_KIND kind, uint64_t filesize,
|
||||
const uint8_t *filename, size_t filename_length, void *userdata)
|
||||
{
|
||||
if (*((uint32_t *)userdata) != 974536)
|
||||
return;
|
||||
|
||||
if (kind != TOX_FILE_TYPE_DATA) {
|
||||
if (kind != TOX_FILE_KIND_DATA) {
|
||||
ck_abort_msg("Bad kind");
|
||||
return;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ START_TEST(test_few_clients)
|
|||
tox_callback_file_recv_control(tox3, file_print_control, &to_compare);
|
||||
tox_callback_file_receive(tox3, tox_file_receive, &to_compare);
|
||||
uint64_t totalf_size = 100 * 1024 * 1024;
|
||||
uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_TYPE_DATA, totalf_size, (uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"),
|
||||
uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, (uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"),
|
||||
0);
|
||||
ck_assert_msg(fnum != UINT32_MAX, "tox_new_file_sender fail");
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ uint32_t add_filesender(Tox *m, uint16_t friendnum, char *filename)
|
|||
fseek(tempfile, 0, SEEK_END);
|
||||
uint64_t filesize = ftell(tempfile);
|
||||
fseek(tempfile, 0, SEEK_SET);
|
||||
uint32_t filenum = tox_file_send(m, friendnum, TOX_FILE_TYPE_DATA, filesize, (uint8_t *)filename, strlen(filename) + 1,
|
||||
uint32_t filenum = tox_file_send(m, friendnum, TOX_FILE_KIND_DATA, filesize, (uint8_t *)filename, strlen(filename) + 1,
|
||||
0);
|
||||
|
||||
if (filenum == -1)
|
||||
|
@ -1127,10 +1127,10 @@ void print_groupnamelistchange(Tox *m, int groupnumber, int peernumber, uint8_t
|
|||
print_groupchatpeers(m, groupnumber);
|
||||
}
|
||||
}
|
||||
void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_TYPE type,
|
||||
void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_KIND type,
|
||||
uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data)
|
||||
{
|
||||
if (type != TOX_FILE_TYPE_DATA) {
|
||||
if (type != TOX_FILE_KIND_DATA) {
|
||||
new_lines("Refused invalid file type.");
|
||||
tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
|
||||
return;
|
||||
|
|
|
@ -88,7 +88,7 @@ uint32_t add_filesender(Tox *m, uint16_t friendnum, char *filename)
|
|||
fseek(tempfile, 0, SEEK_END);
|
||||
uint64_t filesize = ftell(tempfile);
|
||||
fseek(tempfile, 0, SEEK_SET);
|
||||
uint32_t filenum = tox_file_send(m, friendnum, TOX_FILE_TYPE_DATA, filesize, (uint8_t *)filename, strlen(filename) + 1,
|
||||
uint32_t filenum = tox_file_send(m, friendnum, TOX_FILE_KIND_DATA, filesize, (uint8_t *)filename, strlen(filename) + 1,
|
||||
0);
|
||||
|
||||
if (filenum == -1)
|
||||
|
@ -124,10 +124,10 @@ int not_sending()
|
|||
|
||||
static char path[1024];
|
||||
|
||||
void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_TYPE type,
|
||||
void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_KIND type,
|
||||
uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data)
|
||||
{
|
||||
if (type != TOX_FILE_TYPE_DATA) {
|
||||
if (type != TOX_FILE_KIND_DATA) {
|
||||
printf("Refused invalid file type.");
|
||||
tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
|
||||
return;
|
||||
|
|
|
@ -877,7 +877,7 @@ void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function
|
|||
callback_file_control(m, function, user_data);
|
||||
}
|
||||
|
||||
uint32_t tox_file_send(Tox *tox, uint32_t friend_number, TOX_FILE_TYPE kind, uint64_t file_size,
|
||||
uint32_t tox_file_send(Tox *tox, uint32_t friend_number, TOX_FILE_KIND kind, uint64_t file_size,
|
||||
const uint8_t *filename, size_t filename_length, TOX_ERR_FILE_SEND *error)
|
||||
{
|
||||
if (!filename) {
|
||||
|
|
|
@ -1390,12 +1390,12 @@ void tox_callback_friend_action(Tox *tox, tox_friend_action_cb *function, void *
|
|||
******************************************************************************/
|
||||
|
||||
|
||||
typedef enum TOX_FILE_TYPE {
|
||||
typedef enum TOX_FILE_KIND {
|
||||
/**
|
||||
* Arbitrary file data. Clients can choose to handle it based on the file name
|
||||
* or magic or any other way they choose.
|
||||
*/
|
||||
TOX_FILE_TYPE_DATA,
|
||||
TOX_FILE_KIND_DATA,
|
||||
/**
|
||||
* Avatar data. This consists of tox_hash(image) + image.
|
||||
*
|
||||
|
@ -1412,8 +1412,8 @@ typedef enum TOX_FILE_TYPE {
|
|||
* saved hash and send TOX_FILE_CONTROL_CANCEL to terminate the avatar
|
||||
* transfer if it matches.
|
||||
*/
|
||||
TOX_FILE_TYPE_AVATAR
|
||||
} TOX_FILE_TYPE;
|
||||
TOX_FILE_KIND_AVATAR
|
||||
} TOX_FILE_KIND;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1618,7 +1618,7 @@ typedef enum TOX_ERR_FILE_SEND {
|
|||
* number is per friend. File numbers are reused after a transfer terminates.
|
||||
* on failure, this function returns UINT32_MAX.
|
||||
*/
|
||||
uint32_t tox_file_send(Tox *tox, uint32_t friend_number, TOX_FILE_TYPE kind, uint64_t file_size,
|
||||
uint32_t tox_file_send(Tox *tox, uint32_t friend_number, TOX_FILE_KIND kind, uint64_t file_size,
|
||||
const uint8_t *filename, size_t filename_length, TOX_ERR_FILE_SEND *error);
|
||||
|
||||
|
||||
|
@ -1731,7 +1731,7 @@ void tox_callback_file_request_chunk(Tox *tox, tox_file_request_chunk_cb *functi
|
|||
* @param file_number The friend-specific file number the data received is
|
||||
* associated with.
|
||||
*/
|
||||
typedef void tox_file_receive_cb(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_TYPE kind,
|
||||
typedef void tox_file_receive_cb(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_KIND kind,
|
||||
uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user