From bfc9cfa1b317cf008c83e7df8a15492b55d7477a Mon Sep 17 00:00:00 2001 From: Green Sky Date: Mon, 10 Apr 2023 00:37:57 +0200 Subject: [PATCH] add file --- solanaceae/ipc1/tox_ipc_client.cpp | 20 ++++++++++++++++++++ solanaceae/ipc1/tox_ipc_client.hpp | 6 ++++++ solanaceae/ipc1/zpp_rpc_cldev.hpp | 7 +++++++ 3 files changed, 33 insertions(+) diff --git a/solanaceae/ipc1/tox_ipc_client.cpp b/solanaceae/ipc1/tox_ipc_client.cpp index f8491f6..4704883 100644 --- a/solanaceae/ipc1/tox_ipc_client.cpp +++ b/solanaceae/ipc1/tox_ipc_client.cpp @@ -233,6 +233,26 @@ std::vector ToxIPCClient::toxHash(const std::vector& data) { CL_BODY(toxHash, data) } +Tox_Err_File_Control ToxIPCClient::toxFileControl(uint32_t friend_number, uint32_t file_number, Tox_File_Control control) { + CL_BODY(toxFileControl, friend_number, file_number, control) +} + +Tox_Err_File_Seek ToxIPCClient::toxFileSeek(uint32_t friend_number, uint32_t file_number, uint64_t position) { + CL_BODY(toxFileSeek, friend_number, file_number, position) +} + +std::tuple>, Tox_Err_File_Get> ToxIPCClient::toxFileGetFileID(uint32_t friend_number, uint32_t file_number) { + CL_BODY(toxFileGetFileID, friend_number, file_number) +} + +std::tuple, Tox_Err_File_Send> ToxIPCClient::toxFileSend(uint32_t friend_number, uint32_t kind, uint64_t file_size, const std::vector& file_id, std::string_view filename) { + CL_BODY(toxFileSend, friend_number, kind, file_size, file_id, std::string{filename}) +} + +Tox_Err_File_Send_Chunk ToxIPCClient::toxFileSendChunk(uint32_t friend_number, uint32_t file_number, uint64_t position, const std::vector& data) { + CL_BODY(toxFileSendChunk, friend_number, file_number, position, data) +} + std::tuple, Tox_Err_Conference_Join> ToxIPCClient::toxConferenceJoin(uint32_t friend_number, const std::vector& cookie) { CL_BODY(toxConferenceJoin, friend_number, cookie) } diff --git a/solanaceae/ipc1/tox_ipc_client.hpp b/solanaceae/ipc1/tox_ipc_client.hpp index 0c5885b..a0b315d 100644 --- a/solanaceae/ipc1/tox_ipc_client.hpp +++ b/solanaceae/ipc1/tox_ipc_client.hpp @@ -54,6 +54,12 @@ class ToxIPCClient : public ToxI, public ToxEventProviderBase { std::vector toxHash(const std::vector& data) override; // files + Tox_Err_File_Control toxFileControl(uint32_t friend_number, uint32_t file_number, Tox_File_Control control) override; + Tox_Err_File_Seek toxFileSeek(uint32_t friend_number, uint32_t file_number, uint64_t position) override; + std::tuple>, Tox_Err_File_Get> toxFileGetFileID(uint32_t friend_number, uint32_t file_number) override; + std::tuple, Tox_Err_File_Send> toxFileSend(uint32_t friend_number, uint32_t kind, uint64_t file_size, const std::vector& file_id, std::string_view filename) override; + Tox_Err_File_Send_Chunk toxFileSendChunk(uint32_t friend_number, uint32_t file_number, uint64_t position, const std::vector& data) override; + // conferece std::tuple, Tox_Err_Conference_Join> toxConferenceJoin(uint32_t friend_number, const std::vector& cookie) override; Tox_Err_Conference_Send_Message toxConferenceSendMessage(uint32_t conference_number, Tox_Message_Type type, std::string_view message) override; diff --git a/solanaceae/ipc1/zpp_rpc_cldev.hpp b/solanaceae/ipc1/zpp_rpc_cldev.hpp index c595adc..e4a84c7 100644 --- a/solanaceae/ipc1/zpp_rpc_cldev.hpp +++ b/solanaceae/ipc1/zpp_rpc_cldev.hpp @@ -31,6 +31,13 @@ using ToxI_rpc = zpp::bits::rpc< zpp::bits::bind<&ToxI::toxFriendGetPublicKey, "ToxI::toxFriendGetPublicKey"_sha1_int>, zpp::bits::bind<&ToxI::toxFriendSendMessage_str, "ToxI::toxFriendSendMessage"_sha1_int>, zpp::bits::bind<&ToxI::toxHash, "ToxI::toxHash"_sha1_int>, // TODO: remove lol + + zpp::bits::bind<&ToxI::toxFileControl, "ToxI::toxFileControl"_sha1_int>, + zpp::bits::bind<&ToxI::toxFileSeek, "ToxI::toxFileSeek"_sha1_int>, + zpp::bits::bind<&ToxI::toxFileGetFileID, "ToxI::toxFileGetFileID"_sha1_int>, + zpp::bits::bind<&ToxI::toxFileSend_str, "ToxI::toxFileSend"_sha1_int>, + zpp::bits::bind<&ToxI::toxFileSendChunk, "ToxI::toxFileSendChunk"_sha1_int>, + zpp::bits::bind<&ToxI::toxConferenceJoin, "ToxI::toxConferenceJoin"_sha1_int>, zpp::bits::bind<&ToxI::toxConferenceSendMessage_str, "ToxI::toxConferenceSendMessage"_sha1_int>, zpp::bits::bind<&ToxI::toxFriendSendLossyPacket, "ToxI::toxFriendSendLossyPacket"_sha1_int>,