aboutsummaryrefslogtreecommitdiff
path: root/lib/events/encryptionevent.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events/encryptionevent.h')
-rw-r--r--lib/events/encryptionevent.h35
1 files changed, 14 insertions, 21 deletions
diff --git a/lib/events/encryptionevent.h b/lib/events/encryptionevent.h
index 945b17e7..91452c3f 100644
--- a/lib/events/encryptionevent.h
+++ b/lib/events/encryptionevent.h
@@ -4,51 +4,44 @@
#pragma once
+#include "quotient_common.h"
#include "stateevent.h"
namespace Quotient {
class QUOTIENT_API EncryptionEventContent {
public:
- enum EncryptionType : size_t { MegolmV1AesSha2 = 0, Undefined };
+ using EncryptionType
+ [[deprecated("Use Quotient::EncryptionType instead")]] =
+ Quotient::EncryptionType;
- QUO_IMPLICIT EncryptionEventContent(EncryptionType et);
- [[deprecated("This constructor will require explicit EncryptionType soon")]] //
- explicit EncryptionEventContent()
- : EncryptionEventContent(Undefined)
- {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
+ QUO_IMPLICIT EncryptionEventContent(Quotient::EncryptionType et);
explicit EncryptionEventContent(const QJsonObject& json);
QJsonObject toJson() const;
- EncryptionType encryption;
- QString algorithm;
- int rotationPeriodMs;
- int rotationPeriodMsgs;
+ Quotient::EncryptionType encryption;
+ QString algorithm {};
+ int rotationPeriodMs = 604'800'000;
+ int rotationPeriodMsgs = 100;
};
-using EncryptionType = EncryptionEventContent::EncryptionType;
-
class QUOTIENT_API EncryptionEvent : public StateEvent<EncryptionEventContent> {
- Q_GADGET
public:
DEFINE_EVENT_TYPEID("m.room.encryption", EncryptionEvent)
- using EncryptionType = EncryptionEventContent::EncryptionType;
- Q_ENUM(EncryptionType)
+ using EncryptionType
+ [[deprecated("Use Quotient::EncryptionType instead")]] =
+ Quotient::EncryptionType;
explicit EncryptionEvent(const QJsonObject& obj)
: StateEvent(typeId(), obj)
{}
- [[deprecated("This constructor will require an explicit parameter soon")]] //
-// explicit EncryptionEvent()
-// : EncryptionEvent(QJsonObject())
-// {}
explicit EncryptionEvent(EncryptionEventContent&& content)
: StateEvent(typeId(), matrixTypeId(), QString(), std::move(content))
{}
- EncryptionType encryption() const { return content().encryption; }
-
+ Quotient::EncryptionType encryption() const { return content().encryption; }
QString algorithm() const { return content().algorithm; }
int rotationPeriodMs() const { return content().rotationPeriodMs; }
int rotationPeriodMsgs() const { return content().rotationPeriodMsgs; }