aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 5c97c2d..ad6996a 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3673,7 +3673,7 @@ namespace QuickMedia {
bool initial_prev_messages_fetch = true;
auto fetch_more_previous_messages_if_needed = [this, &tabs, &current_room, &fetched_enough_messages, &previous_messages_future, &initial_prev_messages_fetch]() {
- if(!fetched_enough_messages && !previous_messages_future.ready()) {
+ if(!fetched_enough_messages && !previous_messages_future.valid()) {
bool fetch_latest_messages = !matrix->is_initial_sync_finished() && initial_prev_messages_fetch;
if(!tabs[MESSAGES_TAB_INDEX].body->is_body_full_with_items()) {
previous_messages_future = [this, &current_room, fetch_latest_messages]() {
@@ -3685,7 +3685,6 @@ namespace QuickMedia {
}
}
};
- fetch_more_previous_messages_if_needed();
sf::RectangleShape more_messages_below_rect;
more_messages_below_rect.setFillColor(sf::Color(128, 50, 50));
@@ -4383,7 +4382,6 @@ namespace QuickMedia {
//tabs[MESSAGES_TAB_INDEX].body->set_page_scroll(window_size.y);
}
}
- fetch_more_previous_messages_if_needed();
}
if(fetch_message_future.ready()) {
@@ -4574,6 +4572,8 @@ namespace QuickMedia {
window.display();
+ fetch_more_previous_messages_if_needed();
+
if(matrix_chat_page->should_clear_data) {
matrix_chat_page->should_clear_data = false;
@@ -4589,23 +4589,23 @@ namespace QuickMedia {
current_room = matrix->get_room_by_id(current_room->id);
if(current_room) {
- all_messages.clear();
+ //all_messages.clear();
tabs[MESSAGES_TAB_INDEX].body->clear_items();
- matrix->get_all_synced_room_messages(current_room, all_messages);
- for(auto &message : all_messages) {
+ Messages all_messages_new;
+ matrix->get_all_synced_room_messages(current_room, all_messages_new);
+ for(auto &message : all_messages_new) {
fetched_messages_set.insert(message->event_id);
}
+ all_messages.insert(all_messages.end(), all_messages_new.begin(), all_messages_new.end());
auto me = matrix->get_me(current_room);
- resolve_provisional_messages(all_messages);
- add_new_messages_to_current_room(all_messages);
- modify_related_messages_in_current_room(all_messages);
+ resolve_provisional_messages(all_messages_new);
+ add_new_messages_to_current_room(all_messages_new);
+ modify_related_messages_in_current_room(all_messages_new);
std::vector<std::string> pinned_events;
matrix->get_all_pinned_events(current_room, pinned_events);
process_pinned_events(std::move(pinned_events));
-
- fetch_more_previous_messages_if_needed();
} else {
go_to_previous_page = true;
}