File indexing completed on 2024-04-28 16:10:07

0001 // SPDX-FileCopyrightText: 2022 Tobias Fella <tobias.fella@kde.org>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 #pragma once
0005 
0006 #include <Quotient/events/roomevent.h>
0007 
0008 namespace Quotient
0009 {
0010 /**
0011  * @class PollStartEvent
0012  *
0013  * Class to define a poll start event.
0014  *
0015  * See MSC3381 for full details on polls in the matrix spec
0016  * https://github.com/matrix-org/matrix-spec-proposals/blob/travis/msc/polls/proposals/3381-polls.md.
0017  *
0018  * @sa Quotient::RoomEvent
0019  */
0020 class PollStartEvent : public RoomEvent
0021 {
0022 public:
0023     QUO_EVENT(PollStartEvent, "org.matrix.msc3381.poll.start");
0024     explicit PollStartEvent(const QJsonObject &obj);
0025 
0026     /**
0027      * @brief The maximum number of options a user can select in a poll.
0028      */
0029     int maxSelections() const;
0030 
0031     /**
0032      * @brief The question being asked in the poll.
0033      */
0034     QString question() const;
0035 };
0036 
0037 /**
0038  * @class PollResponseEvent
0039  *
0040  * Class to define a poll response event.
0041  *
0042  * See MSC3381 for full details on polls in the matrix spec
0043  * https://github.com/matrix-org/matrix-spec-proposals/blob/travis/msc/polls/proposals/3381-polls.md.
0044  *
0045  * @sa Quotient::RoomEvent
0046  */
0047 class PollResponseEvent : public RoomEvent
0048 {
0049 public:
0050     QUO_EVENT(PollResponseEvent, "org.matrix.msc3381.poll.response");
0051     explicit PollResponseEvent(const QJsonObject &obj);
0052     explicit PollResponseEvent(const QString &pollStartEventId, QStringList responses);
0053 };
0054 
0055 /**
0056  * @class PollEndEvent
0057  *
0058  * Class to define a poll end event.
0059  *
0060  * See MSC3381 for full details on polls in the matrix spec
0061  * https://github.com/matrix-org/matrix-spec-proposals/blob/travis/msc/polls/proposals/3381-polls.md.
0062  *
0063  * @sa Quotient::RoomEvent
0064  */
0065 class PollEndEvent : public RoomEvent
0066 {
0067 public:
0068     QUO_EVENT(PollEndEvent, "org.matrix.msc3381.poll.end");
0069     explicit PollEndEvent(const QJsonObject &obj);
0070 };
0071 }