aboutsummaryrefslogtreecommitdiff
path: root/lib/events/encryptionevent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events/encryptionevent.cpp')
-rw-r--r--lib/events/encryptionevent.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/events/encryptionevent.cpp b/lib/events/encryptionevent.cpp
index ee6c92b1..073303b0 100644
--- a/lib/events/encryptionevent.cpp
+++ b/lib/events/encryptionevent.cpp
@@ -6,47 +6,47 @@
#include "encryptionevent.h"
#include "converters.h"
-#include "logging.h"
#include "e2ee.h"
+#include "logging.h"
#include <array>
-static const std::array<QString, 1> encryptionStrings = { {
- QMatrixClient::MegolmV1AesSha2AlgoKey
-} };
+static const std::array<QString, 1> encryptionStrings = {
+ { Quotient::MegolmV1AesSha2AlgoKey }
+};
-namespace QMatrixClient {
- template <>
- struct JsonConverter<EncryptionType>
+namespace Quotient {
+template <>
+struct JsonConverter<EncryptionType> {
+ static EncryptionType load(const QJsonValue& jv)
{
- static EncryptionType load(const QJsonValue& jv)
- {
- const auto& encryptionString = jv.toString();
- for (auto it = encryptionStrings.begin();
- it != encryptionStrings.end(); ++it)
- if (encryptionString == *it)
- return EncryptionType(it - encryptionStrings.begin());
-
- qCWarning(EVENTS) << "Unknown EncryptionType: " << encryptionString;
- return EncryptionType::Undefined;
- }
- };
-}
+ const auto& encryptionString = jv.toString();
+ for (auto it = encryptionStrings.begin(); it != encryptionStrings.end();
+ ++it)
+ if (encryptionString == *it)
+ return EncryptionType(it - encryptionStrings.begin());
+
+ qCWarning(EVENTS) << "Unknown EncryptionType: " << encryptionString;
+ return EncryptionType::Undefined;
+ }
+};
+} // namespace Quotient
-using namespace QMatrixClient;
+using namespace Quotient;
EncryptionEventContent::EncryptionEventContent(const QJsonObject& json)
: encryption(fromJson<EncryptionType>(json["algorithm"_ls]))
, algorithm(sanitized(json[AlgorithmKeyL].toString()))
, rotationPeriodMs(json[RotationPeriodMsKeyL].toInt(604800000))
, rotationPeriodMsgs(json[RotationPeriodMsgsKeyL].toInt(100))
-{ }
+{}
void EncryptionEventContent::fillJson(QJsonObject* o) const
{
Q_ASSERT(o);
- Q_ASSERT_X(encryption != EncryptionType::Undefined, __FUNCTION__,
- "The key 'algorithm' must be explicit in EncryptionEventContent");
+ Q_ASSERT_X(
+ encryption != EncryptionType::Undefined, __FUNCTION__,
+ "The key 'algorithm' must be explicit in EncryptionEventContent");
if (encryption != EncryptionType::Undefined)
o->insert(AlgorithmKey, algorithm);
o->insert(RotationPeriodMsKey, rotationPeriodMs);