aboutsummaryrefslogtreecommitdiff
path: root/lib/events
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-01-28 21:28:47 +0100
committerGitHub <noreply@github.com>2022-01-28 21:28:47 +0100
commitb39b70bf90d816377b2873a5c2506bd256c0a00e (patch)
treed3ab6da61f0bd7d69bd66a63e450a6f4d85895f0 /lib/events
parentcc9908e5159ed93a18eda9f9794a7c9fc7f67f27 (diff)
parent1747575321cda4fc11f90c2ffb2148a69d0d9946 (diff)
downloadlibquotient-b39b70bf90d816377b2873a5c2506bd256c0a00e.tar.gz
libquotient-b39b70bf90d816377b2873a5c2506bd256c0a00e.zip
Merge pull request #525 from quotient-im/kitsune/query-current-state
Move out current room state to its own class
Diffstat (limited to 'lib/events')
-rw-r--r--lib/events/encryptionevent.h21
-rw-r--r--lib/events/eventcontent.cpp1
-rw-r--r--lib/events/receiptevent.cpp1
-rw-r--r--lib/events/roomcreateevent.h1
-rw-r--r--lib/events/roomevent.cpp1
-rw-r--r--lib/events/roommemberevent.cpp1
-rw-r--r--lib/events/roommemberevent.h10
-rw-r--r--lib/events/roompowerlevelsevent.h4
-rw-r--r--lib/events/roomtombstoneevent.h1
-rw-r--r--lib/events/simplestateevents.h1
10 files changed, 19 insertions, 23 deletions
diff --git a/lib/events/encryptionevent.h b/lib/events/encryptionevent.h
index dfb28b2f..124ced33 100644
--- a/lib/events/encryptionevent.h
+++ b/lib/events/encryptionevent.h
@@ -6,13 +6,18 @@
#include "eventcontent.h"
#include "stateevent.h"
+#include "quotient_common.h"
namespace Quotient {
class QUOTIENT_API EncryptionEventContent : public EventContent::Base {
public:
enum EncryptionType : size_t { MegolmV1AesSha2 = 0, Undefined };
- explicit EncryptionEventContent(EncryptionType et = Undefined);
+ QUO_IMPLICIT EncryptionEventContent(EncryptionType et);
+ [[deprecated("This constructor will require explicit EncryptionType soon")]] //
+ explicit EncryptionEventContent()
+ : EncryptionEventContent(Undefined)
+ {}
explicit EncryptionEventContent(const QJsonObject& json);
EncryptionType encryption;
@@ -34,15 +39,15 @@ public:
using EncryptionType = EncryptionEventContent::EncryptionType;
Q_ENUM(EncryptionType)
- explicit EncryptionEvent(const QJsonObject& obj = {}) // TODO: apropriate
- // default value
+ explicit EncryptionEvent(const QJsonObject& obj)
: StateEvent(typeId(), obj)
{}
- EncryptionEvent(EncryptionEvent&&) = delete;
- template <typename... ArgTs>
- EncryptionEvent(ArgTs&&... contentArgs)
- : StateEvent(typeId(), matrixTypeId(), QString(),
- std::forward<ArgTs>(contentArgs)...)
+ [[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; }
diff --git a/lib/events/eventcontent.cpp b/lib/events/eventcontent.cpp
index 22878d4c..4ce130a6 100644
--- a/lib/events/eventcontent.cpp
+++ b/lib/events/eventcontent.cpp
@@ -4,7 +4,6 @@
#include "eventcontent.h"
#include "converters.h"
-#include "util.h"
#include "logging.h"
#include <QtCore/QMimeDatabase>
diff --git a/lib/events/receiptevent.cpp b/lib/events/receiptevent.cpp
index 72dbf2e3..7f06d99f 100644
--- a/lib/events/receiptevent.cpp
+++ b/lib/events/receiptevent.cpp
@@ -20,7 +20,6 @@ Example of a Receipt Event:
#include "receiptevent.h"
-#include "converters.h"
#include "logging.h"
using namespace Quotient;
diff --git a/lib/events/roomcreateevent.h b/lib/events/roomcreateevent.h
index 016855b9..989030ac 100644
--- a/lib/events/roomcreateevent.h
+++ b/lib/events/roomcreateevent.h
@@ -11,7 +11,6 @@ class QUOTIENT_API RoomCreateEvent : public StateEventBase {
public:
DEFINE_EVENT_TYPEID("m.room.create", RoomCreateEvent)
- explicit RoomCreateEvent() : StateEventBase(typeId(), matrixTypeId()) {}
explicit RoomCreateEvent(const QJsonObject& obj)
: StateEventBase(typeId(), obj)
{}
diff --git a/lib/events/roomevent.cpp b/lib/events/roomevent.cpp
index b728e0bf..3502e3f7 100644
--- a/lib/events/roomevent.cpp
+++ b/lib/events/roomevent.cpp
@@ -3,7 +3,6 @@
#include "roomevent.h"
-#include "converters.h"
#include "logging.h"
#include "redactionevent.h"
diff --git a/lib/events/roommemberevent.cpp b/lib/events/roommemberevent.cpp
index 3141f6b5..b4770224 100644
--- a/lib/events/roommemberevent.cpp
+++ b/lib/events/roommemberevent.cpp
@@ -4,7 +4,6 @@
#include "roommemberevent.h"
-#include "converters.h"
#include "logging.h"
#include <QtCore/QtAlgorithms>
diff --git a/lib/events/roommemberevent.h b/lib/events/roommemberevent.h
index 5e446dbe..ceb7826b 100644
--- a/lib/events/roommemberevent.h
+++ b/lib/events/roommemberevent.h
@@ -15,9 +15,7 @@ public:
using MembershipType
[[deprecated("Use Quotient::Membership instead")]] = Membership;
- explicit MemberEventContent(Membership ms = Membership::Join)
- : membership(ms)
- {}
+ QUO_IMPLICIT MemberEventContent(Membership ms) : membership(ms) {}
explicit MemberEventContent(const QJsonObject& json);
Membership membership;
@@ -43,10 +41,8 @@ public:
explicit RoomMemberEvent(const QJsonObject& obj) : StateEvent(typeId(), obj)
{}
- template <typename... ArgTs>
- RoomMemberEvent(const QString& userId, ArgTs&&... contentArgs)
- : StateEvent(typeId(), matrixTypeId(), userId,
- std::forward<ArgTs>(contentArgs)...)
+ RoomMemberEvent(const QString& userId, MemberEventContent&& content)
+ : StateEvent(typeId(), matrixTypeId(), userId, std::move(content))
{}
//! \brief A special constructor to create unknown RoomMemberEvents
diff --git a/lib/events/roompowerlevelsevent.h b/lib/events/roompowerlevelsevent.h
index 80e27048..415cc814 100644
--- a/lib/events/roompowerlevelsevent.h
+++ b/lib/events/roompowerlevelsevent.h
@@ -36,10 +36,12 @@ protected:
class QUOTIENT_API RoomPowerLevelsEvent
: public StateEvent<PowerLevelsEventContent> {
- Q_GADGET
public:
DEFINE_EVENT_TYPEID("m.room.power_levels", RoomPowerLevelsEvent)
+ explicit RoomPowerLevelsEvent(PowerLevelsEventContent&& content)
+ : StateEvent(typeId(), matrixTypeId(), QString(), std::move(content))
+ {}
explicit RoomPowerLevelsEvent(const QJsonObject& obj)
: StateEvent(typeId(), obj)
{}
diff --git a/lib/events/roomtombstoneevent.h b/lib/events/roomtombstoneevent.h
index e336c448..15d26923 100644
--- a/lib/events/roomtombstoneevent.h
+++ b/lib/events/roomtombstoneevent.h
@@ -10,7 +10,6 @@ class QUOTIENT_API RoomTombstoneEvent : public StateEventBase {
public:
DEFINE_EVENT_TYPEID("m.room.tombstone", RoomTombstoneEvent)
- explicit RoomTombstoneEvent() : StateEventBase(typeId(), matrixTypeId()) {}
explicit RoomTombstoneEvent(const QJsonObject& obj)
: StateEventBase(typeId(), obj)
{}
diff --git a/lib/events/simplestateevents.h b/lib/events/simplestateevents.h
index e6c05880..9610574b 100644
--- a/lib/events/simplestateevents.h
+++ b/lib/events/simplestateevents.h
@@ -35,7 +35,6 @@ namespace EventContent {
public: \
using value_type = content_type::value_type; \
DEFINE_EVENT_TYPEID(_TypeId, _Name) \
- explicit _Name() : _Name(value_type()) {} \
template <typename T> \
explicit _Name(T&& value) \
: StateEvent(typeId(), matrixTypeId(), QString(), \