diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/Matrix.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 13c6f4f..02fce63 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -333,7 +333,8 @@ namespace QuickMedia { case DecryptState::DECRYPTING: { if(decrypt_job->decrypt_state == MatrixChatBodyDecryptJob::DecryptState::DECRYPTED || decrypt_job->decrypt_state == MatrixChatBodyDecryptJob::DecryptState::FAILED_TO_DECRYPT) { decrypt_state = DecryptState::DECRYPTED; - widgets.body_item->set_description(std::move(decrypt_job->text)); + if(!room || room->gpg_decrypt_message_id == gpg_decrypt_message_id) + widgets.body_item->set_description(std::move(decrypt_job->text)); decrypt_job.reset(); } break; @@ -928,6 +929,7 @@ namespace QuickMedia { return; if(last_unread_message) { + ++room->gpg_decrypt_message_id; bool is_window_focused = program->is_window_focused(); RoomData *current_room = program->get_current_chat_room(); Body *chat_body = chat_page ? chat_page->chat_body : nullptr; @@ -957,7 +959,7 @@ namespace QuickMedia { room->body_item->set_description(std::move(room_desc)); room->body_item->set_description_max_lines(3); if(should_message_by_decrypted(room->body_item->get_description())) - room->body_item->extra = std::make_shared<MatrixChatBodyItemData>(matrix, room->body_item->get_description()); + room->body_item->extra = std::make_shared<MatrixChatBodyItemData>(matrix, room->body_item->get_description(), room, room->gpg_decrypt_message_id); if(set_room_as_unread) room->body_item->set_title_color(get_theme().attention_alert_text_color, true); room->last_message_read = false; @@ -965,12 +967,13 @@ namespace QuickMedia { rooms_page->move_room_to_top(room); room_tags_page->move_room_to_top(room); } else if(last_new_message) { + ++room->gpg_decrypt_message_id; room->offset_to_latest_message_text = 0; room->body_item->set_description(extract_first_line_remove_newline_elipses(matrix->message_get_author_displayname(last_new_message.get()), AUTHOR_MAX_LENGTH) + ": " + message_to_room_description_text(matrix, last_new_message.get(), custom_emoji_max_size)); room->body_item->set_description_color(get_theme().faded_text_color); room->body_item->set_description_max_lines(3); if(should_message_by_decrypted(room->body_item->get_description())) - room->body_item->extra = std::make_shared<MatrixChatBodyItemData>(matrix, room->body_item->get_description()); + room->body_item->extra = std::make_shared<MatrixChatBodyItemData>(matrix, room->body_item->get_description(), room, room->gpg_decrypt_message_id); rooms_page->move_room_to_top(room); room_tags_page->move_room_to_top(room); |