recieve state and syncedby changes
This commit is contained in:
parent
427bac722b
commit
5227731ed3
@ -271,13 +271,14 @@ bool ZoxNGCHistorySync::onEvent(const Events::ZoxNGC_ngch_request& e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reg.all_of<Message::Components::SyncedBy>(e)) {
|
if (reg.all_of<Message::Components::SyncedBy>(e)) {
|
||||||
const auto& list = reg.get<Message::Components::SyncedBy>(e).list;
|
const auto& list = reg.get<Message::Components::SyncedBy>(e).ts;
|
||||||
|
// TODO: optimize with list.contains(self);
|
||||||
if (
|
if (
|
||||||
std::find_if(
|
std::find_if(
|
||||||
list.cbegin(), list.cend(),
|
list.cbegin(), list.cend(),
|
||||||
[this](const auto& it) {
|
[this](const auto&& it) {
|
||||||
// TODO: add weak self
|
// TODO: add weak self
|
||||||
return _cr.all_of<Contact::Components::TagSelfStrong>(it);
|
return _cr.all_of<Contact::Components::TagSelfStrong>(it.first);
|
||||||
}
|
}
|
||||||
) == list.cend()
|
) == list.cend()
|
||||||
) {
|
) {
|
||||||
@ -383,14 +384,10 @@ bool ZoxNGCHistorySync::onEvent(const Events::ZoxNGC_ngch_syncmsg& e) {
|
|||||||
msg_ts_w.ts = sync_ts;
|
msg_ts_w.ts = sync_ts;
|
||||||
reg.emplace_or_replace<Message::Components::Timestamp>(matching_e, sync_ts);
|
reg.emplace_or_replace<Message::Components::Timestamp>(matching_e, sync_ts);
|
||||||
|
|
||||||
// TODO: resort
|
|
||||||
//_rmm.resort({ContactGroupEphemeral{e.group_number}});
|
|
||||||
_rmm.throwEventUpdate(reg, matching_e);
|
_rmm.throwEventUpdate(reg, matching_e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: actually, dont do anything?
|
// TODO: actually, dont do anything?
|
||||||
// TODO: resort
|
|
||||||
//_rmm.resort({ContactGroupEphemeral{e.group_number}});
|
|
||||||
_rmm.throwEventUpdate(reg, matching_e);
|
_rmm.throwEventUpdate(reg, matching_e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -410,14 +407,20 @@ bool ZoxNGCHistorySync::onEvent(const Events::ZoxNGC_ngch_syncmsg& e) {
|
|||||||
|
|
||||||
reg.emplace<Message::Components::TagUnread>(matching_e);
|
reg.emplace<Message::Components::TagUnread>(matching_e);
|
||||||
|
|
||||||
// TODO: resort
|
|
||||||
//_rmm.resort({ContactGroupEphemeral{e.group_number}});
|
|
||||||
_rmm.throwEventConstruct(reg, matching_e);
|
_rmm.throwEventConstruct(reg, matching_e);
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // by whom
|
{ // by whom
|
||||||
auto& synced_by = reg.get_or_emplace<Message::Components::SyncedBy>(matching_e).list;
|
auto& synced_by = reg.get_or_emplace<Message::Components::SyncedBy>(matching_e).ts;
|
||||||
synced_by.emplace(sync_by_c);
|
// dont overwrite
|
||||||
|
synced_by.try_emplace(sync_by_c, now_ts);
|
||||||
|
// TODO: throw update?
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // now we also know they got the message
|
||||||
|
auto& list = reg.get_or_emplace<Message::Components::Remote::TimestampReceived>(matching_e).ts;
|
||||||
|
// dont overwrite
|
||||||
|
list.try_emplace(sync_by_c, now_ts);
|
||||||
// TODO: throw update?
|
// TODO: throw update?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user