diff options
Diffstat (limited to 'events/roomavatarevent.h')
-rw-r--r-- | events/roomavatarevent.h | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/events/roomavatarevent.h b/events/roomavatarevent.h index 411de4e8..ccfe8fbf 100644 --- a/events/roomavatarevent.h +++ b/events/roomavatarevent.h @@ -26,28 +26,18 @@ namespace QMatrixClient { - class RoomAvatarEvent: public RoomEvent + class RoomAvatarEvent: public StateEvent<EventContent::ImageContent> { + // It's a bit of an overkill to use a full-fledged ImageContent + // because in reality m.room.avatar usually only has a single URL, + // without a thumbnail. But The Spec says there be thumbnails, and + // we follow The Spec. public: - explicit RoomAvatarEvent(EventContent::ImageContent avatar) - : RoomEvent(Type::RoomAvatar), _avatar(std::move(avatar)) - { } explicit RoomAvatarEvent(const QJsonObject& obj) - : RoomEvent(Type::RoomAvatar, obj), _avatar(contentJson()) + : StateEvent(Type::RoomAvatar, obj) { } - const EventContent::ImageContent& content() const { return _avatar; } - - QJsonObject toJson() const { return _avatar.toJson(); } - static constexpr const char* TypeId = "m.room.avatar"; - - private: - // It's a bit of an overkill to use a full-fledged ImageContent - // because in reality m.room.avatar usually only has a single URL, - // without a thumbnail. But The Spec says there be thumbnails, and - // we follow The Spec. - EventContent::ImageContent _avatar; }; } // namespace QMatrixClient |