Show events that couldn't be decrypted (#57)

This commit is contained in:
Ulyssa 2023-03-13 15:18:53 -07:00
parent 61897ea6f2
commit 7c1c62897a
No known key found for this signature in database
GPG key ID: 1B3965A3D18B9B64
4 changed files with 36 additions and 0 deletions

View file

@ -14,6 +14,7 @@ use matrix_sdk::{
ruma::{
events::{
reaction::ReactionEvent,
room::encrypted::RoomEncryptedEvent,
room::message::{
OriginalRoomMessageEvent,
Relation,
@ -484,6 +485,9 @@ impl RoomInfo {
};
match &mut msg.event {
MessageEvent::Encrypted(_) => {
return;
},
MessageEvent::Original(orig) => {
orig.content = *new_content;
},
@ -498,6 +502,15 @@ impl RoomInfo {
msg.html = msg.event.html();
}
/// Inserts events that couldn't be decrypted into the scrollback.
pub fn insert_encrypted(&mut self, msg: RoomEncryptedEvent) {
let event_id = msg.event_id().to_owned();
let key = (msg.origin_server_ts().into(), event_id.clone());
self.keys.insert(event_id, EventLocation::Message(key.clone()));
self.messages.insert(key, msg.into());
}
pub fn insert_message(&mut self, msg: RoomMessageEvent) {
let event_id = msg.event_id().to_owned();
let key = (msg.origin_server_ts().into(), event_id.clone());