File kind is now a uint32_t.

This allows clients to agree on what numbers mean what without having
it be set in core.
This commit is contained in:
irungentoo 2015-03-13 13:00:35 -04:00
parent 669975c226
commit 96d9cef66c
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
4 changed files with 15 additions and 15 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);
/**