aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-12-16 21:13:38 +0100
committerdec05eba <dec05eba@protonmail.com>2022-12-16 21:47:06 +0100
commit442fc29582b5581111e3ffd286f4f3d282877f3c (patch)
treecfcc2a18381bded582f1054ac8072d448b523edf /src/plugins
parente47a34f3c4d9f892c002d0dce7fb43a3ca1b4f28 (diff)
Fix bug where image are not removed from loading when not visible
Matrix: fix invites not showing notification
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index fae8451..c93a22b 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -684,7 +684,7 @@ namespace QuickMedia {
if(silenced_invite)
body_item->add_reaction("Silenced", nullptr);
invites_page->add_body_item(std::move(body_item));
- if(invite.new_invite && !silenced_invite) {
+ if(!silenced_invite) {
show_notification("QuickMedia matrix - " + invite.room_name, "You were invited to " + invite.room_name + " by " + invited_by_display_name + " (" + invite.invited_by->user_id + ")");
}
}
@@ -1147,7 +1147,7 @@ namespace QuickMedia {
}
void MatrixInvitesPage::add_body_item(std::shared_ptr<BodyItem> body_item) {
- body->insert_item_by_timestamp(std::move(body_item));
+ body->insert_item_by_timestamp_reverse(std::move(body_item));
if(body->get_num_items() != prev_invite_count) {
prev_invite_count = body->get_num_items();
title = "Invites (" + std::to_string(body->get_num_items()) + ")";
@@ -1773,6 +1773,8 @@ namespace QuickMedia {
goto sync_end;
}
+ add_new_invites();
+
next_batch_json = &GetMember(json_root, "next_batch");
if(next_batch_json->IsString()) {
set_next_batch(next_batch_json->GetString(), true);
@@ -2037,6 +2039,14 @@ namespace QuickMedia {
}
}
+ void Matrix::add_new_invites() {
+ std::lock_guard<std::mutex> lock(invite_mutex);
+ for(auto &[room_id, invite] : invites) {
+ ui_thread_tasks.push([this, room_id{std::move(room_id)}, invite{std::move(invite)}]{ delegate->add_invite(room_id, std::move(invite)); });
+ }
+ invites.clear();
+ }
+
PluginResult Matrix::parse_sync_response(const rapidjson::Document &root, bool initial_sync) {
if(!root.IsObject())
return PluginResult::ERR;
@@ -3673,8 +3683,7 @@ namespace QuickMedia {
invite.timestamp = timestamp;
std::string room_id_str(room_id.GetString(), room_id.GetStringLength());
- if(set_invite(room_id_str, invite))
- ui_thread_tasks.push([this, room_id_str{std::move(room_id_str)}, invite{std::move(invite)}]{ delegate->add_invite(room_id_str, std::move(invite)); });
+ set_invite(room_id_str, invite);
break;
}
@@ -3918,6 +3927,16 @@ namespace QuickMedia {
case '\n':
case '\r':
case '\t':
+ case '?':
+ case ',':
+ case ')':
+ case '(':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ case '!':
+ case ';':
case '@': {
user_id_finished = true;
user_id_end = i;