summary refs log tree commit diff
path: root/src/timeline/TimelineModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-01-13 12:37:02 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2020-01-13 12:37:02 +0100
commit62f17dffbd30a3d2e69d5110359055eed0cdca5a (patch)
tree5c226113911e0af0a0acb3f95da0cd305c102777 /src/timeline/TimelineModel.cpp
parentAllow replying with an image (diff)
downloadnheko-62f17dffbd30a3d2e69d5110359055eed0cdca5a.tar.xz
Fix replies in encrypted rooms
The relation needs to be unencrypted...
Diffstat (limited to 'src/timeline/TimelineModel.cpp')
-rw-r--r--src/timeline/TimelineModel.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index a1367bf3..3064ab4a 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -734,6 +734,10 @@ TimelineModel::decryptEvent(const mtx::events::EncryptedEvent<mtx::events::msg:: body["origin_server_ts"] = e.origin_server_ts; body["unsigned"] = e.unsigned_data; + // relations are unencrypted in content... + if (json old_ev = e; old_ev["content"].count("m.relates_to") != 0) + body["content"]["m.relates_to"] = old_ev["content"]["m.relates_to"]; + json event_array = json::array(); event_array.push_back(body); @@ -843,13 +847,13 @@ TimelineModel::sendEncryptedMessage(const std::string &txn_id, nlohmann::json co using namespace mtx::events; using namespace mtx::identifiers; - json doc{{"type", "m.room.message"}, {"content", content}, {"room_id", room_id}}; + json doc = {{"type", "m.room.message"}, {"content", content}, {"room_id", room_id}}; try { // Check if we have already an outbound megolm session then we can use. if (cache::outboundMegolmSessionExists(room_id)) { - auto data = olm::encrypt_group_message( - room_id, http::client()->device_id(), doc.dump()); + auto data = + olm::encrypt_group_message(room_id, http::client()->device_id(), doc); http::client()->send_room_message<msg::Encrypted, EventType::RoomEncrypted>( room_id, @@ -902,7 +906,7 @@ TimelineModel::sendEncryptedMessage(const std::string &txn_id, nlohmann::json co std::make_shared<StateKeeper>([megolm_payload, room_id, doc, txn_id, this]() { try { auto data = olm::encrypt_group_message( - room_id, http::client()->device_id(), doc.dump()); + room_id, http::client()->device_id(), doc); http::client() ->send_room_message<msg::Encrypted, EventType::RoomEncrypted>(