Implement decryption of images

It is a bit of a hack, but it works...
This commit is contained in:
Nicolas Werner 2019-12-03 23:34:16 +01:00
parent a689118d71
commit 5bfdaff778
6 changed files with 57 additions and 9 deletions

View file

@ -673,6 +673,19 @@ TimelineModel::internalAddEvents(
continue; // don't insert redaction into timeline
}
if (auto event =
boost::get<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(&e)) {
auto temp = decryptEvent(*event).event;
auto encInfo = boost::apply_visitor(
[](const auto &ev) -> boost::optional<mtx::crypto::EncryptedFile> {
return eventEncryptionInfo(ev);
},
temp);
if (encInfo)
emit newEncryptedImage(encInfo.value());
}
this->events.insert(id, e);
ids.push_back(id);
}