diff options
Diffstat (limited to 'events/event.h')
-rw-r--r-- | events/event.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/events/event.h b/events/event.h index 00dc4d5c..319c3443 100644 --- a/events/event.h +++ b/events/event.h @@ -240,8 +240,23 @@ namespace QMatrixClient RoomEvents::iterator end() { return to; } }; + class StateEventBase: public RoomEvent + { + public: + explicit StateEventBase(Type type, const QJsonObject& obj) + : RoomEvent(obj.contains("state_key") ? type : Type::Unknown, + obj) + { } + explicit StateEventBase(Type type) + : RoomEvent(type) + { } + ~StateEventBase() override = 0; + + virtual bool repeatsState() const; + }; + template <typename ContentT> - class StateEvent: public RoomEvent + class StateEvent: public StateEventBase { public: using content_type = ContentT; @@ -249,8 +264,7 @@ namespace QMatrixClient template <typename... ContentParamTs> explicit StateEvent(Type type, const QJsonObject& obj, ContentParamTs&&... contentParams) - : RoomEvent(obj.contains("state_key") ? type : Type::Unknown, - obj) + : StateEventBase(type, obj) , _content(contentJson(), std::forward<ContentParamTs>(contentParams)...) { @@ -262,7 +276,7 @@ namespace QMatrixClient } template <typename... ContentParamTs> explicit StateEvent(Type type, ContentParamTs&&... contentParams) - : RoomEvent(type) + : StateEventBase(type) , _content(std::forward<ContentParamTs>(contentParams)...) { } |