aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp10
-rw-r--r--src/ResourceLoader.cpp2
-rw-r--r--src/plugins/Matrix.cpp8
3 files changed, 18 insertions, 2 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 0b91876..9a842dc 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3852,6 +3852,15 @@ namespace QuickMedia {
}
};
+ auto filter_provisional_messages = [](Messages &messages) {
+ for(auto it = messages.begin(); it != messages.end();) {
+ if((*it)->provisional)
+ it = messages.erase(it);
+ else
+ ++it;
+ }
+ };
+
auto add_new_messages_to_current_room = [&me, &tabs, &selected_tab, &current_room, &chat_state](Messages &messages) {
if(messages.empty())
return;
@@ -4449,6 +4458,7 @@ namespace QuickMedia {
all_messages.insert(all_messages.end(), sync_data.messages.begin(), sync_data.messages.end());
filter_existing_messages(sync_data.messages);
}
+ filter_provisional_messages(sync_data.messages);
add_new_messages_to_current_room(sync_data.messages);
modify_related_messages_in_current_room(sync_data.messages);
process_reactions(sync_data.messages);
diff --git a/src/ResourceLoader.cpp b/src/ResourceLoader.cpp
index 77ad675..1665e4d 100644
--- a/src/ResourceLoader.cpp
+++ b/src/ResourceLoader.cpp
@@ -54,8 +54,8 @@ namespace QuickMedia::FontLoader {
break;
}
+ font = new_font.get();
font_cache[(size_t)font_type] = std::move(new_font);
- font = font_cache[(size_t)font_type].get();
}
return font;
}
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index eeef477..c54a8f6 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -1750,11 +1750,12 @@ namespace QuickMedia {
if(!type_json.IsString())
return nullptr;
+ bool provisional = false;
const rapidjson::Value &unsigned_json = GetMember(event_item_json, "unsigned");
if(unsigned_json.IsObject()) {
const rapidjson::Value &transaction_id_json = GetMember(unsigned_json, "transaction_id");
if(transaction_id_json.IsString() && my_events_transaction_ids.find(transaction_id_json.GetString()) != my_events_transaction_ids.end())
- return nullptr;
+ provisional = true;
}
RelatedEventType related_event_type = RelatedEventType::NONE;
@@ -1784,6 +1785,7 @@ namespace QuickMedia {
message->related_event_id = relates_to_event_id_json.GetString();
message->related_event_type = RelatedEventType::REACTION;
message->timestamp = timestamp;
+ message->provisional = provisional;
return message;
}
}
@@ -1802,6 +1804,7 @@ namespace QuickMedia {
message->body = "Message deleted";
message->timestamp = timestamp;
message->related_event_type = RelatedEventType::REDACTION;
+ message->provisional = provisional;
const rapidjson::Value &reason_json = GetMember(*content_json, "reason");
if(reason_json.IsString()) {
@@ -1892,6 +1895,7 @@ namespace QuickMedia {
message->related_event_id = std::move(related_event_id);
message->related_event_type = related_event_type;
message->timestamp = timestamp;
+ message->provisional = provisional;
return message;
} else {
auto message = std::make_shared<Message>();
@@ -1902,6 +1906,7 @@ namespace QuickMedia {
message->related_event_id = std::move(related_event_id);
message->related_event_type = related_event_type;
message->timestamp = timestamp;
+ message->provisional = provisional;
return message;
}
@@ -1975,6 +1980,7 @@ namespace QuickMedia {
message->related_event_id = std::move(related_event_id);
message->related_event_type = related_event_type;
message->timestamp = timestamp;
+ message->provisional = provisional;
return message;
}