From 96d9cef66c551feae380596d77e6f120525ad0ca Mon Sep 17 00:00:00 2001 From: irungentoo Date: Fri, 13 Mar 2015 13:00:35 -0400 Subject: [PATCH] File kind is now a uint32_t. This allows clients to agree on what numbers mean what without having it be set in core. --- toxcore/Messenger.c | 4 ++-- toxcore/Messenger.h | 6 +++--- toxcore/tox.c | 4 ++-- toxcore/tox.h | 16 ++++++++-------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 607630b6..f61050bc 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -976,9 +976,9 @@ int send_group_invite_packet(const Messenger *m, int32_t friendnumber, const uin /* Set the callback for file send requests. * - * Function(Tox *tox, uint32_t friendnumber, uint32_t filenumber, unsigned int filetype, uint64_t filesize, uint8_t *filename, size_t filename_length, void *userdata) + * Function(Tox *tox, uint32_t friendnumber, uint32_t filenumber, uint32_t filetype, uint64_t filesize, uint8_t *filename, size_t filename_length, void *userdata) */ -void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, uint32_t, uint32_t, unsigned int, uint64_t, +void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, uint32_t, uint32_t, uint32_t, uint64_t, const uint8_t *, size_t, void *), void *userdata) { m->file_sendrequest = function; diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 5dec83df..d4cfa431 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h @@ -255,7 +255,7 @@ struct Messenger { void (*group_invite)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t); void (*group_message)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t); - void (*file_sendrequest)(struct Messenger *m, uint32_t, uint32_t, unsigned int, uint64_t, const uint8_t *, size_t, + void (*file_sendrequest)(struct Messenger *m, uint32_t, uint32_t, uint32_t, uint64_t, const uint8_t *, size_t, void *); void *file_sendrequest_userdata; void (*file_filecontrol)(struct Messenger *m, uint32_t, uint32_t, unsigned int, void *); @@ -574,9 +574,9 @@ int send_group_invite_packet(const Messenger *m, int32_t friendnumber, const uin /* Set the callback for file send requests. * - * Function(Tox *tox, uint32_t friendnumber, uint32_t filenumber, unsigned int filetype, uint64_t filesize, uint8_t *filename, size_t filename_length, void *userdata) + * Function(Tox *tox, uint32_t friendnumber, uint32_t filenumber, uint32_t filetype, uint64_t filesize, uint8_t *filename, size_t filename_length, void *userdata) */ -void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, uint32_t, uint32_t, unsigned int, uint64_t, +void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, uint32_t, uint32_t, uint32_t, uint64_t, const uint8_t *, size_t, void *), void *userdata); diff --git a/toxcore/tox.c b/toxcore/tox.c index 5dfac2c8..a8a44af3 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c @@ -888,8 +888,8 @@ void tox_callback_file_control(Tox *tox, tox_file_control_cb *function, void *us callback_file_control(m, function, user_data); } -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) +uint32_t tox_file_send(Tox *tox, uint32_t friend_number, uint32_t kind, uint64_t file_size, const uint8_t *filename, + size_t filename_length, TOX_ERR_FILE_SEND *error) { if (!filename) { SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEND_NULL); diff --git a/toxcore/tox.h b/toxcore/tox.h index eb6b4f31..4fc139b1 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -1617,8 +1617,8 @@ 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_KIND kind, uint64_t file_size, - const uint8_t *filename, size_t filename_length, TOX_ERR_FILE_SEND *error); +uint32_t tox_file_send(Tox *tox, uint32_t friend_number, uint32_t kind, uint64_t file_size, const uint8_t *filename, + size_t filename_length, TOX_ERR_FILE_SEND *error); typedef enum TOX_ERR_FILE_SEND_CHUNK { @@ -1664,11 +1664,11 @@ typedef enum TOX_ERR_FILE_SEND_CHUNK { * Send a chunk of file data to a friend. * * This function is called in response to the `file_request_chunk` callback. The - * length parameter should be equal to the one received though the callback. - * If it is zero, the transfer is assumed complete. For files with known size, - * Core will know that the transfer is complete after the last byte has been - * received, so it is not necessary (though not harmful) to send a zero-length - * chunk to terminate. For streams, core will know that the transfer is finished + * length parameter should be equal to the one received though the callback. + * If it is zero, the transfer is assumed complete. For files with known size, + * Core will know that the transfer is complete after the last byte has been + * received, so it is not necessary (though not harmful) to send a zero-length + * chunk to terminate. For streams, core will know that the transfer is finished * if a chunk with length less than the length requested in the callback is sent. * * @return true on success. @@ -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_KIND kind, +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); /**