diff options
-rw-r--r-- | lib/events/eventcontent.h | 2 | ||||
-rw-r--r-- | lib/events/roomavatarevent.h | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/events/eventcontent.h b/lib/events/eventcontent.h index e7656de5..0d4c047e 100644 --- a/lib/events/eventcontent.h +++ b/lib/events/eventcontent.h @@ -214,6 +214,8 @@ namespace EventContent { template <typename InfoT> class UrlWithThumbnailContent : public UrlBasedContent<InfoT> { public: + // NB: when using inherited constructors, thumbnail has to be + // initialised separately using UrlBasedContent<InfoT>::UrlBasedContent; explicit UrlWithThumbnailContent(const QJsonObject& json) : UrlBasedContent<InfoT>(json), thumbnail(InfoT::originalInfoJson) diff --git a/lib/events/roomavatarevent.h b/lib/events/roomavatarevent.h index 4013773c..c2100eaa 100644 --- a/lib/events/roomavatarevent.h +++ b/lib/events/roomavatarevent.h @@ -31,6 +31,18 @@ public: DEFINE_EVENT_TYPEID("m.room.avatar", RoomAvatarEvent) explicit RoomAvatarEvent(const QJsonObject& obj) : StateEvent(typeId(), obj) {} + explicit RoomAvatarEvent(const EventContent::ImageContent& avatar) + : StateEvent(typeId(), matrixTypeId(), QString(), avatar) + {} + // A replica of EventContent::ImageInfo constructor + explicit RoomAvatarEvent(const QUrl& u, qint64 fileSize = -1, + QMimeType mimeType = {}, + const QSize& imageSize = {}, + const QString& originalFilename = {}) + : RoomAvatarEvent(EventContent::ImageContent { + u, fileSize, mimeType, imageSize, originalFilename }) + {} + QUrl url() const { return content().url; } }; REGISTER_EVENT_TYPE(RoomAvatarEvent) |