1 files changed, 12 insertions, 6 deletions
diff --git a/src/Olm.cpp b/src/Olm.cpp
index ff6ea2f4..48439fa3 100644
--- a/src/Olm.cpp
+++ b/src/Olm.cpp
@@ -211,10 +211,15 @@ encrypt_group_message(const std::string &room_id, const std::string &device_id,
// relations shouldn't be encrypted...
mtx::common::ReplyRelatesTo relation;
+ mtx::common::ReactionRelatesTo r_relation;
+
if (body["content"].contains("m.relates_to") &&
body["content"]["m.relates_to"].contains("m.in_reply_to")) {
relation = body["content"]["m.relates_to"];
body["content"].erase("m.relates_to");
+ } else if (body["content"]["m.relates_to"].contains("event_id")) {
+ r_relation = body["content"]["m.relates_to"];
+ body["content"].erase("m.relates_to");
}
// Always check before for existence.
@@ -223,12 +228,13 @@ encrypt_group_message(const std::string &room_id, const std::string &device_id,
// Prepare the m.room.encrypted event.
msg::Encrypted data;
- data.ciphertext = std::string((char *)payload.data(), payload.size());
- data.sender_key = olm::client()->identity_keys().curve25519;
- data.session_id = res.data.session_id;
- data.device_id = device_id;
- data.algorithm = MEGOLM_ALGO;
- data.relates_to = relation;
+ data.ciphertext = std::string((char *)payload.data(), payload.size());
+ data.sender_key = olm::client()->identity_keys().curve25519;
+ data.session_id = res.data.session_id;
+ data.device_id = device_id;
+ data.algorithm = MEGOLM_ALGO;
+ data.relates_to = relation;
+ data.r_relates_to = r_relation;
auto message_index = olm_outbound_group_session_message_index(res.session);
nhlog::crypto()->debug("next message_index {}", message_index);
|