syncedBy got moved and adopt the timestamp change

This commit is contained in:
Green Sky 2024-01-12 12:46:51 +01:00
parent c01d91144c
commit a5da51a428
No known key found for this signature in database
3 changed files with 3 additions and 11 deletions

View File

@ -15,10 +15,6 @@ struct ToxGroupMessageID {
// TODO: move all those comps
struct SyncedBy {
std::set<Contact3> list;
};
namespace Transfer {
struct ToxTransferFriend {

View File

@ -13,7 +13,6 @@ constexpr entt::id_type entt::type_hash<x>::value() noexcept { \
// cross compile(r) stable ids
DEFINE_COMP_ID(Message::Components::ToxGroupMessageID)
DEFINE_COMP_ID(Message::Components::SyncedBy)
DEFINE_COMP_ID(Message::Components::Transfer::ToxTransferFriend)
DEFINE_COMP_ID(Message::Components::Transfer::FileID)
DEFINE_COMP_ID(Message::Components::Transfer::FileKind)

View File

@ -128,8 +128,7 @@ bool ToxMessageManager::sendText(const Contact3 c, std::string_view message, boo
reg.emplace<Message::Components::ToxGroupMessageID>(new_msg_e, message_id_opt.value());
// TODO: generalize?
auto& synced_by = reg.emplace<Message::Components::SyncedBy>(new_msg_e).list;
synced_by.emplace(c_self);
reg.emplace<Message::Components::SyncedBy>(new_msg_e).ts.emplace(c_self, ts);
}
} else if (
// non online group
@ -140,8 +139,7 @@ bool ToxMessageManager::sendText(const Contact3 c, std::string_view message, boo
reg.emplace<Message::Components::ToxGroupMessageID>(new_msg_e, msg_id);
// TODO: generalize?
auto& synced_by = reg.emplace<Message::Components::SyncedBy>(new_msg_e).list;
synced_by.emplace(c_self);
reg.emplace<Message::Components::SyncedBy>(new_msg_e).ts.emplace(c_self, ts);
} else if (
_cr.any_of<Contact::Components::ToxGroupPeerEphemeral>(c)
) {
@ -256,8 +254,7 @@ bool ToxMessageManager::onToxEvent(const Tox_Event_Group_Message* e) {
reg.emplace<Message::Components::TagUnread>(new_msg_e);
{ // by whom
auto& synced_by = reg.get_or_emplace<Message::Components::SyncedBy>(new_msg_e).list;
synced_by.emplace(self_c);
reg.get_or_emplace<Message::Components::SyncedBy>(new_msg_e).ts.emplace(self_c, ts);
}
_rmm.throwEventConstruct(reg, new_msg_e);