Skip to content

Commit

Permalink
Fix some nulls in relations
Browse files Browse the repository at this point in the history
  • Loading branch information
deepbluev7 committed Jan 8, 2021
1 parent e951968 commit cc9de7f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Olm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,13 +579,12 @@ encrypt_group_message(const std::string &room_id, const std::string &device_id,
mtx::common::RelatesTo r_relation;

// relations shouldn't be encrypted...
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");
if (body["content"].contains("m.relates_to")) {
if (body["content"]["m.relates_to"].contains("m.in_reply_to")) {
relation = body["content"]["m.relates_to"];
} else if (body["content"]["m.relates_to"].contains("event_id")) {
r_relation = body["content"]["m.relates_to"];
}
}

auto payload = olm::client()->encrypt_group_message(session.get(), body.dump());
Expand Down

0 comments on commit cc9de7f

Please sign in to comment.