summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-03-13 13:00:35 -0400
committerirungentoo <irungentoo@gmail.com>2015-03-13 13:00:35 -0400
commit96d9cef66c551feae380596d77e6f120525ad0ca (patch)
tree23d54660695e55779b248e15cc8fa40534e7cdca
parent669975c226a385c1d0ffee8384abd776c7962d53 (diff)
File kind is now a uint32_t.
This allows clients to agree on what numbers mean what without having it be set in core.
-rw-r--r--toxcore/Messenger.c4
-rw-r--r--toxcore/Messenger.h6
-rw-r--r--toxcore/tox.c4
-rw-r--r--toxcore/tox.h16
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
976 976
977/* Set the callback for file send requests. 977/* Set the callback for file send requests.
978 * 978 *
979 * Function(Tox *tox, uint32_t friendnumber, uint32_t filenumber, unsigned int filetype, uint64_t filesize, uint8_t *filename, size_t filename_length, void *userdata) 979 * Function(Tox *tox, uint32_t friendnumber, uint32_t filenumber, uint32_t filetype, uint64_t filesize, uint8_t *filename, size_t filename_length, void *userdata)
980 */ 980 */
981void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, uint32_t, uint32_t, unsigned int, uint64_t, 981void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, uint32_t, uint32_t, uint32_t, uint64_t,
982 const uint8_t *, size_t, void *), void *userdata) 982 const uint8_t *, size_t, void *), void *userdata)
983{ 983{
984 m->file_sendrequest = function; 984 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 {
255 void (*group_invite)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t); 255 void (*group_invite)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t);
256 void (*group_message)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t); 256 void (*group_message)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t);
257 257
258 void (*file_sendrequest)(struct Messenger *m, uint32_t, uint32_t, unsigned int, uint64_t, const uint8_t *, size_t, 258 void (*file_sendrequest)(struct Messenger *m, uint32_t, uint32_t, uint32_t, uint64_t, const uint8_t *, size_t,
259 void *); 259 void *);
260 void *file_sendrequest_userdata; 260 void *file_sendrequest_userdata;
261 void (*file_filecontrol)(struct Messenger *m, uint32_t, uint32_t, unsigned int, void *); 261 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
574 574
575/* Set the callback for file send requests. 575/* Set the callback for file send requests.
576 * 576 *
577 * Function(Tox *tox, uint32_t friendnumber, uint32_t filenumber, unsigned int filetype, uint64_t filesize, uint8_t *filename, size_t filename_length, void *userdata) 577 * Function(Tox *tox, uint32_t friendnumber, uint32_t filenumber, uint32_t filetype, uint64_t filesize, uint8_t *filename, size_t filename_length, void *userdata)
578 */ 578 */
579void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, uint32_t, uint32_t, unsigned int, uint64_t, 579void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, uint32_t, uint32_t, uint32_t, uint64_t,
580 const uint8_t *, size_t, void *), void *userdata); 580 const uint8_t *, size_t, void *), void *userdata);
581 581
582 582
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
888 callback_file_control(m, function, user_data); 888 callback_file_control(m, function, user_data);
889} 889}
890 890
891uint32_t tox_file_send(Tox *tox, uint32_t friend_number, TOX_FILE_KIND kind, uint64_t file_size, 891uint32_t tox_file_send(Tox *tox, uint32_t friend_number, uint32_t kind, uint64_t file_size, const uint8_t *filename,
892 const uint8_t *filename, size_t filename_length, TOX_ERR_FILE_SEND *error) 892 size_t filename_length, TOX_ERR_FILE_SEND *error)
893{ 893{
894 if (!filename) { 894 if (!filename) {
895 SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEND_NULL); 895 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 {
1617 * number is per friend. File numbers are reused after a transfer terminates. 1617 * number is per friend. File numbers are reused after a transfer terminates.
1618 * on failure, this function returns UINT32_MAX. 1618 * on failure, this function returns UINT32_MAX.
1619 */ 1619 */
1620uint32_t tox_file_send(Tox *tox, uint32_t friend_number, TOX_FILE_KIND kind, uint64_t file_size, 1620uint32_t tox_file_send(Tox *tox, uint32_t friend_number, uint32_t kind, uint64_t file_size, const uint8_t *filename,
1621 const uint8_t *filename, size_t filename_length, TOX_ERR_FILE_SEND *error); 1621 size_t filename_length, TOX_ERR_FILE_SEND *error);
1622 1622
1623 1623
1624typedef enum TOX_ERR_FILE_SEND_CHUNK { 1624typedef enum TOX_ERR_FILE_SEND_CHUNK {
@@ -1664,11 +1664,11 @@ typedef enum TOX_ERR_FILE_SEND_CHUNK {
1664 * Send a chunk of file data to a friend. 1664 * Send a chunk of file data to a friend.
1665 * 1665 *
1666 * This function is called in response to the `file_request_chunk` callback. The 1666 * This function is called in response to the `file_request_chunk` callback. The
1667 * length parameter should be equal to the one received though the callback. 1667 * length parameter should be equal to the one received though the callback.
1668 * If it is zero, the transfer is assumed complete. For files with known size, 1668 * If it is zero, the transfer is assumed complete. For files with known size,
1669 * Core will know that the transfer is complete after the last byte has been 1669 * Core will know that the transfer is complete after the last byte has been
1670 * received, so it is not necessary (though not harmful) to send a zero-length 1670 * received, so it is not necessary (though not harmful) to send a zero-length
1671 * chunk to terminate. For streams, core will know that the transfer is finished 1671 * chunk to terminate. For streams, core will know that the transfer is finished
1672 * if a chunk with length less than the length requested in the callback is sent. 1672 * if a chunk with length less than the length requested in the callback is sent.
1673 * 1673 *
1674 * @return true on success. 1674 * @return true on success.
@@ -1731,7 +1731,7 @@ void tox_callback_file_request_chunk(Tox *tox, tox_file_request_chunk_cb *functi
1731 * @param file_number The friend-specific file number the data received is 1731 * @param file_number The friend-specific file number the data received is
1732 * associated with. 1732 * associated with.
1733 */ 1733 */
1734typedef void tox_file_receive_cb(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_KIND kind, 1734typedef void tox_file_receive_cb(Tox *tox, uint32_t friend_number, uint32_t file_number, uint32_t kind,
1735 uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data); 1735 uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data);
1736 1736
1737/** 1737/**