summary refs log tree commit diff
path: root/src/timeline/TimelineModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-12-03 23:34:16 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2019-12-03 23:34:16 +0100
commit5bfdaff7780bc4299c3edab85c688eebf21f7d4e (patch)
treecf558f40eb7953a890cb03df98bcecc52d288e6c /src/timeline/TimelineModel.cpp
parentlint (diff)
downloadnheko-5bfdaff7780bc4299c3edab85c688eebf21f7d4e.tar.xz
Implement decryption of images
It is a bit of a hack, but it works...
Diffstat (limited to 'src/timeline/TimelineModel.cpp')
-rw-r--r--src/timeline/TimelineModel.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index f606b603..2c58e2f5 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -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); }