From dd4573e05cdfa2d9b99ef7a49c99e27c201da3e9 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 4 Sep 2021 00:30:06 +0200 Subject: Matrix: fix messages that dont mention us being added to notifications list. Also fix read status for notifications --- src/Body.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index 1762ba5..afa1dae 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -315,6 +315,18 @@ namespace QuickMedia { items.insert(items.begin() + dst_index - 1, std::move(item_to_move)); } + size_t Body::insert_item_by_timestamp_reverse(std::shared_ptr body_item) { + apply_search_filter_for_item(body_item.get()); + for(size_t i = 0; i < items.size(); ++i) { + if(body_item->get_timestamp() > items[i]->get_timestamp()) { + items.insert(items.begin() + i, std::move(body_item)); + return i; + } + } + items.insert(items.begin(), std::move(body_item)); + return 0; + } + // TODO: Binary search and use hint to start search from start or end (for example when adding "previous" items or "next" items) size_t Body::insert_item_by_timestamp(std::shared_ptr body_item) { apply_search_filter_for_item(body_item.get()); -- cgit v1.2.3