From ba8ca977f16a543a43439f9d5ff87bddebf6d9fb Mon Sep 17 00:00:00 2001 From: Green Sky Date: Tue, 18 Apr 2023 17:32:54 +0200 Subject: [PATCH] update to tox interface progress --- solanaceae/ipc1/tox_ipc_client.cpp | 38 +++++++++++++++++++++++++++++- solanaceae/ipc1/tox_ipc_client.hpp | 12 ++++++++-- solanaceae/ipc1/zpp_rpc_cldev.hpp | 9 +++++++ 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/solanaceae/ipc1/tox_ipc_client.cpp b/solanaceae/ipc1/tox_ipc_client.cpp index 4704883..7bb6fea 100644 --- a/solanaceae/ipc1/tox_ipc_client.cpp +++ b/solanaceae/ipc1/tox_ipc_client.cpp @@ -221,10 +221,46 @@ Tox_Err_Friend_Delete ToxIPCClient::toxFriendDelete(uint32_t friend_number) { CL_BODY(toxFriendDelete, friend_number) } -std::tuple>, Tox_Err_Friend_Get_Public_Key> ToxIPCClient::toxFriendGetPublicKey(uint32_t friend_number) { +std::tuple, Tox_Err_Friend_By_Public_Key> ToxIPCClient::toxFriendByPublicKey(const std::vector& public_key) { + CL_BODY(toxFriendByPublicKey, public_key) +} + +bool ToxIPCClient::toxFriendExists(uint32_t friend_number) { + CL_BODY(toxFriendExists, friend_number) +} + +std::optional> ToxIPCClient::toxFriendGetPublicKey(uint32_t friend_number) { CL_BODY(toxFriendGetPublicKey, friend_number) } +std::optional ToxIPCClient::toxFriendGetLastOnline(uint32_t friend_number) { + CL_BODY(toxFriendGetLastOnline, friend_number) +} + +std::optional ToxIPCClient::toxFriendGetName(uint32_t friend_number) { + CL_BODY(toxFriendGetName, friend_number) +} + +std::optional ToxIPCClient::toxFriendGetStatusMessage(uint32_t friend_number) { + CL_BODY(toxFriendGetStatusMessage, friend_number) +} + +std::optional ToxIPCClient::toxFriendGetStatus(uint32_t friend_number) { + CL_BODY(toxFriendGetStatus, friend_number) +} + +std::optional ToxIPCClient::toxFriendGetConnectionStatus(uint32_t friend_number) { + CL_BODY(toxFriendGetConnectionStatus, friend_number) +} + +std::optional ToxIPCClient::toxFriendGetTyping(uint32_t friend_number) { + CL_BODY(toxFriendGetTyping, friend_number) +} + +Tox_Err_Set_Typing ToxIPCClient::toxSelfSetTyping(uint32_t friend_number, bool typing) { + CL_BODY(toxSelfSetTyping, friend_number, typing) +} + std::tuple, Tox_Err_Friend_Send_Message> ToxIPCClient::toxFriendSendMessage(uint32_t friend_number, Tox_Message_Type type, std::string_view message) { CL_BODY(toxFriendSendMessage, friend_number, type, std::string{message}) } diff --git a/solanaceae/ipc1/tox_ipc_client.hpp b/solanaceae/ipc1/tox_ipc_client.hpp index a0b315d..bc9e8a8 100644 --- a/solanaceae/ipc1/tox_ipc_client.hpp +++ b/solanaceae/ipc1/tox_ipc_client.hpp @@ -45,8 +45,16 @@ class ToxIPCClient : public ToxI, public ToxEventProviderBase { std::tuple, Tox_Err_Friend_Add> toxFriendAdd(const std::vector& address, std::string_view message) override; std::tuple, Tox_Err_Friend_Add> toxFriendAddNorequest(const std::vector& public_key) override; Tox_Err_Friend_Delete toxFriendDelete(uint32_t friend_number) override; - std::tuple>, Tox_Err_Friend_Get_Public_Key> toxFriendGetPublicKey(uint32_t friend_number) override; - + std::tuple, Tox_Err_Friend_By_Public_Key> toxFriendByPublicKey(const std::vector& public_key) override; + bool toxFriendExists(uint32_t friend_number) override; + std::optional> toxFriendGetPublicKey(uint32_t friend_number) override; + std::optional toxFriendGetLastOnline(uint32_t friend_number) override; + std::optional toxFriendGetName(uint32_t friend_number) override; + std::optional toxFriendGetStatusMessage(uint32_t friend_number) override; + std::optional toxFriendGetStatus(uint32_t friend_number) override; + std::optional toxFriendGetConnectionStatus(uint32_t friend_number) override; + std::optional toxFriendGetTyping(uint32_t friend_number) override; + Tox_Err_Set_Typing toxSelfSetTyping(uint32_t friend_number, bool typing) override; std::tuple, Tox_Err_Friend_Send_Message> toxFriendSendMessage(uint32_t friend_number, Tox_Message_Type type, std::string_view message) override; // should this be virtual at all? diff --git a/solanaceae/ipc1/zpp_rpc_cldev.hpp b/solanaceae/ipc1/zpp_rpc_cldev.hpp index e4a84c7..3b7a388 100644 --- a/solanaceae/ipc1/zpp_rpc_cldev.hpp +++ b/solanaceae/ipc1/zpp_rpc_cldev.hpp @@ -28,7 +28,16 @@ using ToxI_rpc = zpp::bits::rpc< zpp::bits::bind<&ToxI::toxFriendAdd_str, "ToxI::toxFriendAdd"_sha1_int>, zpp::bits::bind<&ToxI::toxFriendAddNorequest, "ToxI::toxFriendAddNorequest"_sha1_int>, zpp::bits::bind<&ToxI::toxFriendDelete, "ToxI::toxFriendDelete"_sha1_int>, + zpp::bits::bind<&ToxI::toxFriendByPublicKey, "ToxI::toxFriendByPublicKey"_sha1_int>, + zpp::bits::bind<&ToxI::toxFriendExists, "ToxI::toxFriendExists"_sha1_int>, zpp::bits::bind<&ToxI::toxFriendGetPublicKey, "ToxI::toxFriendGetPublicKey"_sha1_int>, + zpp::bits::bind<&ToxI::toxFriendGetLastOnline, "ToxI::toxFriendGetLastOnline"_sha1_int>, + zpp::bits::bind<&ToxI::toxFriendGetName, "ToxI::toxFriendGetName"_sha1_int>, + zpp::bits::bind<&ToxI::toxFriendGetStatusMessage, "ToxI::toxFriendGetStatusMessage"_sha1_int>, + zpp::bits::bind<&ToxI::toxFriendGetStatus, "ToxI::toxFriendGetStatus"_sha1_int>, + zpp::bits::bind<&ToxI::toxFriendGetConnectionStatus, "ToxI::toxFriendGetConnectionStatus"_sha1_int>, + zpp::bits::bind<&ToxI::toxFriendGetTyping, "ToxI::toxFriendGetTyping"_sha1_int>, + zpp::bits::bind<&ToxI::toxSelfSetTyping, "ToxI::toxSelfSetTyping"_sha1_int>, zpp::bits::bind<&ToxI::toxFriendSendMessage_str, "ToxI::toxFriendSendMessage"_sha1_int>, zpp::bits::bind<&ToxI::toxHash, "ToxI::toxHash"_sha1_int>, // TODO: remove lol