update to rmmi

This commit is contained in:
Green Sky 2024-10-06 11:39:26 +02:00
parent a678b62763
commit c81a04a778
No known key found for this signature in database
3 changed files with 5 additions and 6 deletions

View File

@ -38,7 +38,7 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
auto* zox_ngc_event_provider_i = PLUG_RESOLVE_INSTANCE(ZoxNGCEventProviderI);
auto* cr = PLUG_RESOLVE_INSTANCE_VERSIONED(Contact3Registry, "1");
auto* tcm = PLUG_RESOLVE_INSTANCE(ToxContactModel2);
auto* rmm = PLUG_RESOLVE_INSTANCE(RegistryMessageModel);
auto* rmm = PLUG_RESOLVE_INSTANCE(RegistryMessageModelI);
// static store, could be anywhere tho
// construct with fetched dependencies

View File

@ -21,7 +21,7 @@ void ZoxNGCHistorySync::subscribeToEvents(void) {
_tep.subscribe(this, Tox_Event_Type::TOX_EVENT_GROUP_PEER_JOIN);
}
ZoxNGCHistorySync::ZoxNGCHistorySync(ToxEventProviderI& tep, ZoxNGCEventProviderI& zngcepi, ToxI& t, Contact3Registry& cr, ToxContactModel2& tcm, RegistryMessageModel& rmm)
ZoxNGCHistorySync::ZoxNGCHistorySync(ToxEventProviderI& tep, ZoxNGCEventProviderI& zngcepi, ToxI& t, Contact3Registry& cr, ToxContactModel2& tcm, RegistryMessageModelI& rmm)
: _tep(tep), _zngcepi(zngcepi), _t(t), _cr(cr), _tcm(tcm), _rmm(rmm), _rng(std::random_device{}())
{
subscribeToEvents();
@ -259,7 +259,7 @@ bool ZoxNGCHistorySync::onEvent(const Events::ZoxNGC_ngch_request& e) {
}
// const -> dont create (this is a request for existing messages)
auto* reg_ptr = static_cast<const RegistryMessageModel&>(_rmm).get(request_sender);
auto* reg_ptr = static_cast<const RegistryMessageModelI&>(_rmm).get(request_sender);
if (reg_ptr == nullptr) {
std::cerr << "ZNGCHS error: group without reg\n";
return true;

View File

@ -13,7 +13,6 @@
// fwd
struct ToxI;
struct ContactModelI;
class RegistryMessageModel;
class ToxContactModel2;
// zoff ngc history sync (draft1?)
@ -25,7 +24,7 @@ class ZoxNGCHistorySync : public ToxEventI, public ZoxNGCEventI {
ToxI& _t;
Contact3Registry& _cr;
ToxContactModel2& _tcm;
RegistryMessageModel& _rmm;
RegistryMessageModelI& _rmm;
// how far apart the 2 timestamps can be, before they are considered different messages
const int64_t _max_age_difference_ms {130*60*1000}; // TODO: make this larger?
@ -67,7 +66,7 @@ class ZoxNGCHistorySync : public ToxEventI, public ZoxNGCEventI {
void subscribeToEvents(void); // private
public:
ZoxNGCHistorySync(ToxEventProviderI& tep, ZoxNGCEventProviderI& zngcepi, ToxI& t, Contact3Registry& cr, ToxContactModel2& tcm, RegistryMessageModel& rmm);
ZoxNGCHistorySync(ToxEventProviderI& tep, ZoxNGCEventProviderI& zngcepi, ToxI& t, Contact3Registry& cr, ToxContactModel2& tcm, RegistryMessageModelI& rmm);
float tick(float delta);