From f2030667bd9ad1a4de13dd28f0a8c2c04f3d9d8d Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 25 Oct 2024 12:25:39 +0200 Subject: [PATCH] use sr --- src/solanaceae/crdtnotes_toxsync/crdtnotes_toxsync.cpp | 10 ++++++---- src/solanaceae/crdtnotes_toxsync/crdtnotes_toxsync.hpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/solanaceae/crdtnotes_toxsync/crdtnotes_toxsync.cpp b/src/solanaceae/crdtnotes_toxsync/crdtnotes_toxsync.cpp index cde1f38..c20cbe2 100644 --- a/src/solanaceae/crdtnotes_toxsync/crdtnotes_toxsync.cpp +++ b/src/solanaceae/crdtnotes_toxsync/crdtnotes_toxsync.cpp @@ -43,15 +43,17 @@ CRDTNotesToxSync::CRDTNotesToxSync( ToxI& t, ToxEventProviderI& tep, ToxContactModel2& tcm -) : _notes_sync(notes_sync), _cr(cr), _t(t), _tep(tep), _tcm(tcm) { +) : _notes_sync(notes_sync), _cr(cr), _t(t), _tep_sr(tep.newSubRef(this)), _tcm(tcm) { // TODO: non groups // should be called for every peer (except self) // we hook here to inject ourself as contact sync model - _tep.subscribe(this, Tox_Event_Type::TOX_EVENT_GROUP_PEER_JOIN); + _tep_sr + .subscribe(Tox_Event_Type::TOX_EVENT_GROUP_PEER_JOIN) - _tep.subscribe(this, Tox_Event_Type::TOX_EVENT_GROUP_CUSTOM_PACKET); - _tep.subscribe(this, Tox_Event_Type::TOX_EVENT_GROUP_CUSTOM_PRIVATE_PACKET); + .subscribe(Tox_Event_Type::TOX_EVENT_GROUP_CUSTOM_PACKET) + .subscribe(Tox_Event_Type::TOX_EVENT_GROUP_CUSTOM_PRIVATE_PACKET) + ; } CRDTNotesToxSync::~CRDTNotesToxSync(void) { diff --git a/src/solanaceae/crdtnotes_toxsync/crdtnotes_toxsync.hpp b/src/solanaceae/crdtnotes_toxsync/crdtnotes_toxsync.hpp index a3880d0..a8e301b 100644 --- a/src/solanaceae/crdtnotes_toxsync/crdtnotes_toxsync.hpp +++ b/src/solanaceae/crdtnotes_toxsync/crdtnotes_toxsync.hpp @@ -16,7 +16,7 @@ class CRDTNotesToxSync : public CRDTNotesContactSyncModelI, public ToxEventI { CRDTNotesEventI& _notes_sync; Contact3Registry& _cr; ToxI& _t; - ToxEventProviderI& _tep; + ToxEventProviderI::SubscriptionReference _tep_sr; ToxContactModel2& _tcm; public: