mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Api changes.
receive to recv in file receive functions. Added TOX_MAX_FILENAME_LENGTH define.
This commit is contained in:
parent
ad87dbb470
commit
5b7cbc8956
|
@ -547,11 +547,11 @@ START_TEST(test_few_clients)
|
|||
|
||||
file_accepted = file_size = file_recv = sendf_ok = size_recv = 0;
|
||||
long long unsigned int f_time = time(NULL);
|
||||
tox_callback_file_receive_chunk(tox3, write_file, &to_compare);
|
||||
tox_callback_file_recv_chunk(tox3, write_file, &to_compare);
|
||||
tox_callback_file_recv_control(tox2, file_print_control, &to_compare);
|
||||
tox_callback_file_request_chunk(tox2, tox_file_request_chunk, &to_compare);
|
||||
tox_callback_file_recv_control(tox3, file_print_control, &to_compare);
|
||||
tox_callback_file_receive(tox3, tox_file_receive, &to_compare);
|
||||
tox_callback_file_recv(tox3, tox_file_receive, &to_compare);
|
||||
uint64_t totalf_size = 100 * 1024 * 1024;
|
||||
uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, 0, (uint8_t *)"Gentoo.exe",
|
||||
sizeof("Gentoo.exe"), 0);
|
||||
|
|
|
@ -1269,9 +1269,9 @@ int main(int argc, char *argv[])
|
|||
tox_callback_friend_status_message(m, print_statuschange, NULL);
|
||||
tox_callback_group_invite(m, print_invite, NULL);
|
||||
tox_callback_group_message(m, print_groupmessage, NULL);
|
||||
tox_callback_file_receive_chunk(m, write_file, NULL);
|
||||
tox_callback_file_recv_chunk(m, write_file, NULL);
|
||||
tox_callback_file_recv_control(m, file_print_control, NULL);
|
||||
tox_callback_file_receive(m, file_request_accept, NULL);
|
||||
tox_callback_file_recv(m, file_request_accept, NULL);
|
||||
tox_callback_file_request_chunk(m, tox_file_request_chunk, NULL);
|
||||
tox_callback_group_namelist_change(m, print_groupnamelistchange, NULL);
|
||||
|
||||
|
|
|
@ -230,9 +230,9 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
Tox *tox = tox_new(0, 0, 0, 0);
|
||||
tox_callback_file_receive_chunk(tox, write_file, NULL);
|
||||
tox_callback_file_recv_chunk(tox, write_file, NULL);
|
||||
tox_callback_file_recv_control(tox, file_print_control, NULL);
|
||||
tox_callback_file_receive(tox, file_request_accept, NULL);
|
||||
tox_callback_file_recv(tox, file_request_accept, NULL);
|
||||
tox_callback_file_request_chunk(tox, tox_file_request_chunk, NULL);
|
||||
tox_callback_friend_connection_status(tox, print_online, NULL);
|
||||
|
||||
|
|
|
@ -1078,13 +1078,13 @@ void tox_callback_file_request_chunk(Tox *tox, tox_file_request_chunk_cb *functi
|
|||
callback_file_reqchunk(m, function, user_data);
|
||||
}
|
||||
|
||||
void tox_callback_file_receive(Tox *tox, tox_file_receive_cb *function, void *user_data)
|
||||
void tox_callback_file_recv(Tox *tox, tox_file_recv_cb *function, void *user_data)
|
||||
{
|
||||
Messenger *m = tox;
|
||||
callback_file_sendrequest(m, function, user_data);
|
||||
}
|
||||
|
||||
void tox_callback_file_receive_chunk(Tox *tox, tox_file_receive_chunk_cb *function, void *user_data)
|
||||
void tox_callback_file_recv_chunk(Tox *tox, tox_file_recv_chunk_cb *function, void *user_data)
|
||||
{
|
||||
Messenger *m = tox;
|
||||
callback_file_data(m, function, user_data);
|
||||
|
|
|
@ -260,6 +260,11 @@ bool tox_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch);
|
|||
*/
|
||||
#define TOX_FILE_ID_LENGTH 32
|
||||
|
||||
/**
|
||||
* Maximum file name length for file tran.
|
||||
*/
|
||||
#define TOX_MAX_FILENAME_LENGTH 255
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* :: Global enumerations
|
||||
|
@ -1627,7 +1632,7 @@ typedef enum TOX_ERR_FILE_SEND {
|
|||
*/
|
||||
TOX_ERR_FILE_SEND_FRIEND_NOT_CONNECTED,
|
||||
/**
|
||||
* Filename length exceeded 255 bytes.
|
||||
* Filename length exceeded TOX_MAX_FILENAME_LENGTH bytes.
|
||||
*/
|
||||
TOX_ERR_FILE_SEND_NAME_TOO_LONG,
|
||||
/**
|
||||
|
@ -1640,7 +1645,7 @@ typedef enum TOX_ERR_FILE_SEND {
|
|||
/**
|
||||
* Send a file transmission request.
|
||||
*
|
||||
* Maximum filename length is 255 bytes. The filename should generally just be
|
||||
* Maximum filename length is TOX_MAX_FILENAME_LENGTH bytes. The filename should generally just be
|
||||
* a file name, not a path with directory names.
|
||||
*
|
||||
* If a non-zero file size is provided, this can be used by both sides to
|
||||
|
@ -1805,15 +1810,15 @@ 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, uint32_t kind,
|
||||
uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data);
|
||||
typedef void tox_file_recv_cb(Tox *tox, uint32_t friend_number, uint32_t file_number, uint32_t kind,
|
||||
uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data);
|
||||
|
||||
/**
|
||||
* Set the callback for the `file_receive` event. Pass NULL to unset.
|
||||
*
|
||||
* This event is triggered when a file transfer request is received.
|
||||
*/
|
||||
void tox_callback_file_receive(Tox *tox, tox_file_receive_cb *function, void *user_data);
|
||||
void tox_callback_file_recv(Tox *tox, tox_file_recv_cb *function, void *user_data);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1837,13 +1842,13 @@ void tox_callback_file_receive(Tox *tox, tox_file_receive_cb *function, void *us
|
|||
* @param data A byte array containing the received chunk.
|
||||
* @param length The length of the received chunk.
|
||||
*/
|
||||
typedef void tox_file_receive_chunk_cb(Tox *tox, uint32_t friend_number, uint32_t file_number, uint64_t position,
|
||||
const uint8_t *data, size_t length, void *user_data);
|
||||
typedef void tox_file_recv_chunk_cb(Tox *tox, uint32_t friend_number, uint32_t file_number, uint64_t position,
|
||||
const uint8_t *data, size_t length, void *user_data);
|
||||
|
||||
/**
|
||||
* Set the callback for the `file_receive_chunk` event. Pass NULL to unset.
|
||||
*/
|
||||
void tox_callback_file_receive_chunk(Tox *tox, tox_file_receive_chunk_cb *function, void *user_data);
|
||||
void tox_callback_file_recv_chunk(Tox *tox, tox_file_recv_chunk_cb *function, void *user_data);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
Loading…
Reference in New Issue
Block a user