aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roomavatarevent.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-07-26 09:26:19 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-07-26 09:26:19 +0200
commit176b260bfaf8f575560bfe3fb520ee3fa0ad3a7a (patch)
tree82fc4851e6a3704527756434877fbbe2dde895a4 /lib/events/roomavatarevent.h
parent55d8d9c073b732e296c72bc8a747bbd691931209 (diff)
downloadlibquotient-176b260bfaf8f575560bfe3fb520ee3fa0ad3a7a.tar.gz
libquotient-176b260bfaf8f575560bfe3fb520ee3fa0ad3a7a.zip
RoomAvatarEvent: add constructors from content
So that room avatar events could also be sent, not only received.
Diffstat (limited to 'lib/events/roomavatarevent.h')
-rw-r--r--lib/events/roomavatarevent.h12
1 files changed, 12 insertions, 0 deletions
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)