ignore too old messages

This commit is contained in:
Green Sky 2023-12-15 23:03:28 +01:00
parent 7a05a87e72
commit 465b253d81
No known key found for this signature in database

View File

@ -126,6 +126,13 @@ bool Bridge::onEvent(const Message::Events::MessageConstruct& e) {
return false; // how return false; // how
} }
if (e.e.all_of<Message::Components::Timestamp>()) {
int64_t time_diff = int64_t(Message::getTimeMS()) - int64_t(e.e.get<Message::Components::Timestamp>().ts);
if (time_diff > 5*1000*60) {
return false; // message too old
}
}
const auto contact_from = e.e.get<Message::Components::ContactFrom>().c; const auto contact_from = e.e.get<Message::Components::ContactFrom>().c;
if (_cr.any_of<Contact::Components::TagSelfStrong, Contact::Components::TagSelfWeak>(contact_from)) { if (_cr.any_of<Contact::Components::TagSelfStrong, Contact::Components::TagSelfWeak>(contact_from)) {
return false; // skip own messages return false; // skip own messages