diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-01-05 13:58:47 +0100 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-05-08 17:43:58 +0200 |
commit | 4070706fcc91cd46054b00c5f3a267a9d8c44fb7 (patch) | |
tree | 982d14ed069580596af9b690d83b950b8700781e /lib/events/roommemberevent.h | |
parent | d271a171dbec4068e43e8f711d5d2e966a2072ac (diff) | |
download | libquotient-4070706fcc91cd46054b00c5f3a267a9d8c44fb7.tar.gz libquotient-4070706fcc91cd46054b00c5f3a267a9d8c44fb7.zip |
Event content: provide toJson() instead of deriving from EC::Base
EventContent::Base has been made primarily for the sake of dynamic
polymorphism needed within RoomMessageEvent content (arguably, it might
not be really needed even there, but that's a bigger matter for another
time). When that polymorphism is not needed, it's easier for reading
and maintenance to have toJson() member function (or even specialise
JsonConverter<> outside of the content structure) instead of deriving
from EC::Base and then still having fillJson() member function. This
commit removes EventContent::Base dependency where it's not beneficial.
Diffstat (limited to 'lib/events/roommemberevent.h')
-rw-r--r-- | lib/events/roommemberevent.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/events/roommemberevent.h b/lib/events/roommemberevent.h index afbaf825..dd33ea6b 100644 --- a/lib/events/roommemberevent.h +++ b/lib/events/roommemberevent.h @@ -5,18 +5,18 @@ #pragma once -#include "eventcontent.h" #include "stateevent.h" #include "quotient_common.h" namespace Quotient { -class QUOTIENT_API MemberEventContent : public EventContent::Base { +class QUOTIENT_API MemberEventContent { public: using MembershipType [[deprecated("Use Quotient::Membership instead")]] = Membership; QUO_IMPLICIT MemberEventContent(Membership ms) : membership(ms) {} explicit MemberEventContent(const QJsonObject& json); + QJsonObject toJson() const; Membership membership; /// (Only for invites) Whether the invite is to a direct chat @@ -24,9 +24,6 @@ public: Omittable<QString> displayName; Omittable<QUrl> avatarUrl; QString reason; - -protected: - void fillJson(QJsonObject& o) const override; }; using MembershipType [[deprecated("Use Membership instead")]] = Membership; |