diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-09-04 00:30:06 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-09-04 00:30:06 +0200 |
commit | dd4573e05cdfa2d9b99ef7a49c99e27c201da3e9 (patch) | |
tree | 6499b368a168b7a61c33b3588696c253ce5c9a34 /src/Body.cpp | |
parent | 3f0421bea6b37d81d2d66c001b0fac2df91dd702 (diff) |
Matrix: fix messages that dont mention us being added to notifications list. Also fix read status for notifications
Diffstat (limited to 'src/Body.cpp')
-rw-r--r-- | src/Body.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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<BodyItem> 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<BodyItem> body_item) { apply_search_filter_for_item(body_item.get()); |