From ea032244e77e750f9d38897fdf6f24c3fb858fbc Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 12 Jan 2024 18:55:41 +0100 Subject: [PATCH] remote comps --- solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp b/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp index b59dfb9..1877ab7 100644 --- a/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp +++ b/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp @@ -1069,8 +1069,11 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_message& e) { reg.emplace(new_msg_e); { // by whom - auto& synced_by = reg.get_or_emplace(new_msg_e).list; - synced_by.emplace(self_c); + reg.get_or_emplace(new_msg_e).ts.try_emplace(self_c, ts); + } + + { // we received it, so we have it + reg.get_or_emplace(new_msg_e).ts.try_emplace(self_c, ts); } // check if content exists @@ -1384,10 +1387,6 @@ bool SHA1_NGCFT1::sendFilePath(const Contact3 c, std::string_view file_name, std // TODO: check return self->_nft.NGC_FT1_send_message_public(group_number, message_id, static_cast(NGCFT1_file_kind::HASH_SHA1_INFO), sha1_info_hash.data(), sha1_info_hash.size()); reg_ptr->emplace(msg_e, message_id); - - // TODO: generalize? - auto& synced_by = reg_ptr->emplace(msg_e).list; - synced_by.emplace(c_self); } else if ( // non online group self->_cr.any_of(c) @@ -1395,12 +1394,11 @@ bool SHA1_NGCFT1::sendFilePath(const Contact3 c, std::string_view file_name, std // create msg_id const uint32_t message_id = randombytes_random(); reg_ptr->emplace(msg_e, message_id); - - // TODO: generalize? - auto& synced_by = reg_ptr->emplace(msg_e).list; - synced_by.emplace(c_self); } + reg_ptr->emplace(msg_e).ts.try_emplace(c_self, ts); + reg_ptr->get_or_emplace(msg_e).ts.try_emplace(c_self, ts); + self->_rmm.throwEventConstruct(*reg_ptr, msg_e); // TODO: place in iterate?