// SPDX-FileCopyrightText: 2021-2023 Tobias Fella // SPDX-License-Identifier: LGPL-2.0-or-later #pragma once #include #include #include namespace Quotient { /** * @class ImagePackEventContent * * A class to define the content of an image pack event. * * See Matrix MSC2545 for more details. * https://github.com/Sorunome/matrix-doc/blob/soru/emotes/proposals/2545-emotes.md * * @sa ImagePackEvent */ class ImagePackEventContent { public: /** * @brief Defines the properties of an image pack. */ struct Pack { Quotient::Omittable displayName; /**< The display name of the pack. */ Quotient::Omittable avatarUrl; /**< The source mxc URL for the pack avatar. */ Quotient::Omittable usage; /**< An array of the usages for this pack. Possible usages are "emoticon" and "sticker". */ Quotient::Omittable attribution; /**< The attribution for the pack author(s). */ }; /** * @brief Defines the properties of an image pack image. */ struct ImagePackImage { QString shortcode; /**< The shortcode for the image. */ QUrl url; /**< The mxc URL for this image. */ Quotient::Omittable body; /**< An optional text body for this image. */ Quotient::Omittable info; /**< The ImageInfo object used for the info block of m.sticker events. */ /** * @brief An array of the usages for this image. * * The possible values match those of the usage key of a pack object. */ Quotient::Omittable usage; }; /** * @brief Return the pack properties. * * @sa Pack */ Quotient::Omittable pack; /** * @brief Return a vector of images in the pack. * * @sa ImagePackImage */ QVector images; explicit ImagePackEventContent(const QJsonObject &o); /** * @brief The definition of how to convert the content to Json. * * This is a specialization of the standard fillJson function from libQuotient. * * @sa Quotient::converters */ void fillJson(QJsonObject *o) const; }; /** * @class ImagePackEvent * * Class to define an image pack state event. * * The event content is ImagePackEventContent. * * @sa Quotient::StateEvent, ImagePackEventContent */ class ImagePackEvent : public KeyedStateEventBase { public: QUO_EVENT(ImagePackEvent, "im.ponies.room_emotes") using KeyedStateEventBase::KeyedStateEventBase; }; REGISTER_EVENT_TYPE(ImagePackEvent) }