aboutsummaryrefslogtreecommitdiff
path: root/lib/events
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-09-12 10:04:21 +0200
committerGitHub <noreply@github.com>2021-09-12 10:04:21 +0200
commita76ed82eb298d30c7b654c74378f93a9a35580a6 (patch)
tree9359d204c59561f0c9ba12810c7b7fae88eaae07 /lib/events
parent41944ac3ee76029201c2108a063ae2b6354f6a22 (diff)
parent0209be8305aa38722a3d25593ae71fbb3ac05e52 (diff)
downloadlibquotient-a76ed82eb298d30c7b654c74378f93a9a35580a6.tar.gz
libquotient-a76ed82eb298d30c7b654c74378f93a9a35580a6.zip
Merge pull request #506 from TobiasFella/activateencryption
Add convenience function for activating encryption
Diffstat (limited to 'lib/events')
-rw-r--r--lib/events/encryptionevent.cpp8
-rw-r--r--lib/events/encryptionevent.h4
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/events/encryptionevent.cpp b/lib/events/encryptionevent.cpp
index 490a5e8a..aa05a96e 100644
--- a/lib/events/encryptionevent.cpp
+++ b/lib/events/encryptionevent.cpp
@@ -39,6 +39,14 @@ EncryptionEventContent::EncryptionEventContent(const QJsonObject& json)
, rotationPeriodMsgs(json[RotationPeriodMsgsKeyL].toInt(100))
{}
+EncryptionEventContent::EncryptionEventContent(EncryptionType et)
+ : encryption(et)
+{
+ if(encryption != Undefined) {
+ algorithm = encryptionStrings[encryption];
+ }
+}
+
void EncryptionEventContent::fillJson(QJsonObject* o) const
{
Q_ASSERT(o);
diff --git a/lib/events/encryptionevent.h b/lib/events/encryptionevent.h
index 65ee4187..14439fcc 100644
--- a/lib/events/encryptionevent.h
+++ b/lib/events/encryptionevent.h
@@ -12,9 +12,7 @@ class EncryptionEventContent : public EventContent::Base {
public:
enum EncryptionType : size_t { MegolmV1AesSha2 = 0, Undefined };
- explicit EncryptionEventContent(EncryptionType et = Undefined)
- : encryption(et)
- {}
+ explicit EncryptionEventContent(EncryptionType et = Undefined);
explicit EncryptionEventContent(const QJsonObject& json);
EncryptionType encryption;