diff options
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r-- | toxcore/tox.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c index 36f87cc6..87b8e8de 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -883,6 +883,48 @@ bool tox_file_send_control(Tox *tox, uint32_t friend_number, uint32_t file_numbe | |||
883 | return 0; | 883 | return 0; |
884 | } | 884 | } |
885 | 885 | ||
886 | bool tox_file_send_seek(Tox *tox, uint32_t friend_number, uint32_t file_number, uint64_t position, | ||
887 | TOX_ERR_FILE_SEEK *error) | ||
888 | { | ||
889 | Messenger *m = tox; | ||
890 | int ret = file_seek(m, friend_number, file_number, position); | ||
891 | |||
892 | if (ret == 0) { | ||
893 | SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEEK_OK); | ||
894 | return 1; | ||
895 | } | ||
896 | |||
897 | switch (ret) { | ||
898 | case -1: | ||
899 | SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEEK_FRIEND_NOT_FOUND); | ||
900 | return 0; | ||
901 | |||
902 | case -2: | ||
903 | SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEEK_FRIEND_NOT_CONNECTED); | ||
904 | return 0; | ||
905 | |||
906 | case -3: | ||
907 | SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEEK_NOT_FOUND); | ||
908 | return 0; | ||
909 | |||
910 | case -4: | ||
911 | case -5: | ||
912 | SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEEK_DENIED); | ||
913 | return 0; | ||
914 | |||
915 | case -6: | ||
916 | SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEEK_INVALID_POSITION); | ||
917 | return 0; | ||
918 | |||
919 | case -8: | ||
920 | SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEEK_SEND_FAILED); | ||
921 | return 0; | ||
922 | } | ||
923 | |||
924 | /* can't happen */ | ||
925 | return 0; | ||
926 | } | ||
927 | |||
886 | void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function, void *user_data) | 928 | void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function, void *user_data) |
887 | { | 929 | { |
888 | Messenger *m = tox; | 930 | Messenger *m = tox; |