events: Add method on RoomMessageEventContent to apply a replacement

This commit is contained in:
Kévin Commaille 2023-09-04 13:46:27 +02:00 committed by Kévin Commaille
parent f29317f9d7
commit b4853aa8fa

View File

@ -420,6 +420,13 @@ impl RoomMessageEventContent {
self.msgtype.body()
}
/// Apply the given new content from a [`Replacement`] to this message.
pub fn apply_replacement(&mut self, new_content: RoomMessageEventContentWithoutRelation) {
let RoomMessageEventContentWithoutRelation { msgtype, mentions } = new_content;
self.msgtype = msgtype;
self.mentions = mentions;
}
/// Sanitize this message.
///
/// If this message contains HTML, this removes the [tags and attributes] that are not listed in