diff --git a/src/main_screen.cpp b/src/main_screen.cpp index 9b66b8a..0e9f185 100644 --- a/src/main_screen.cpp +++ b/src/main_screen.cpp @@ -11,6 +11,7 @@ MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path, std::stri rmm(cr), mts(rmm), tc(save_path, save_password), + tpi(tc.getTox()), ad(tc), tcm(cr, tc, tc), tmm(rmm, cr, tcm, tc, tc), @@ -44,6 +45,7 @@ MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path, std::stri g_provideInstance("RegistryMessageModel", "host", &rmm); g_provideInstance("ToxI", "host", &tc); + g_provideInstance("ToxPrivateI", "host", &tpi); g_provideInstance("ToxEventProviderI", "host", &tc); g_provideInstance("ToxContactModel2", "host", &tcm); diff --git a/src/main_screen.hpp b/src/main_screen.hpp index a4faef4..e4e8ab2 100644 --- a/src/main_screen.hpp +++ b/src/main_screen.hpp @@ -8,6 +8,7 @@ #include #include #include +#include "./tox_private_impl.hpp" #include #include @@ -47,6 +48,7 @@ struct MainScreen final : public Screen { ToxEventLogger tel{std::cout}; ToxClient tc; + ToxPrivateImpl tpi; AutoDirty ad; ToxContactModel2 tcm; ToxMessageManager tmm; diff --git a/src/tox_private_impl.hpp b/src/tox_private_impl.hpp new file mode 100644 index 0000000..85f83a4 --- /dev/null +++ b/src/tox_private_impl.hpp @@ -0,0 +1,17 @@ +#include +#include + +struct ToxPrivateImpl : public ToxPrivateI { + Tox* _tox = nullptr; + + ToxPrivateImpl(Tox* tox) : _tox(tox) {} + virtual ~ToxPrivateImpl(void) {} + + uint16_t toxDHTGetNumCloselist(void) override { + return tox_dht_get_num_closelist(_tox); + } + + uint16_t toxDHTGetNumCloselistAnnounceCapable(void) override { + return tox_dht_get_num_closelist_announce_capable(_tox); + } +};