ignore too old messages
This commit is contained in:
parent
7a05a87e72
commit
465b253d81
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user