Skip to content

Commit

Permalink
provide ToxPrivateI
Browse files Browse the repository at this point in the history
  • Loading branch information
Green-Sky committed Nov 13, 2023
1 parent bedbacd commit 4e4f62d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/main_screen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -47,6 +48,7 @@ struct MainScreen final : public Screen {

ToxEventLogger tel{std::cout};
ToxClient tc;
ToxPrivateImpl tpi;
AutoDirty ad;
ToxContactModel2 tcm;
ToxMessageManager tmm;
Expand Down
17 changes: 17 additions & 0 deletions src/tox_private_impl.hpp
Original file line number Diff line number Diff line change
@@ -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);
}
};

0 comments on commit 4e4f62d

Please sign in to comment.