provide ToxPrivateI

This commit is contained in:
Green Sky 2023-11-13 15:14:30 +01:00
parent bedbacddde
commit 4e4f62dd20
No known key found for this signature in database
3 changed files with 21 additions and 0 deletions

View File

@ -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>("RegistryMessageModel", "host", &rmm);
g_provideInstance<ToxI>("ToxI", "host", &tc);
g_provideInstance<ToxPrivateI>("ToxPrivateI", "host", &tpi);
g_provideInstance<ToxEventProviderI>("ToxEventProviderI", "host", &tc);
g_provideInstance<ToxContactModel2>("ToxContactModel2", "host", &tcm);

View File

@ -8,6 +8,7 @@
#include <solanaceae/message3/message_time_sort.hpp>
#include <solanaceae/plugin/plugin_manager.hpp>
#include <solanaceae/toxcore/tox_event_logger.hpp>
#include "./tox_private_impl.hpp"
#include <solanaceae/tox_contacts/tox_contact_model2.hpp>
#include <solanaceae/tox_messages/tox_message_manager.hpp>
@ -47,6 +48,7 @@ struct MainScreen final : public Screen {
ToxEventLogger tel{std::cout};
ToxClient tc;
ToxPrivateImpl tpi;
AutoDirty ad;
ToxContactModel2 tcm;
ToxMessageManager tmm;

17
src/tox_private_impl.hpp Normal file
View File

@ -0,0 +1,17 @@
#include <tox/tox_private.h>
#include <solanaceae/toxcore/tox_private_interface.hpp>
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);
}
};