File indexing completed on 2024-09-29 04:28:03

0001 // SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 #pragma once
0005 
0006 #include <Quotient/events/stateevent.h>
0007 
0008 namespace Quotient
0009 {
0010 /**
0011  * @class JoinRulesEvent
0012  *
0013  * Class to define a join rule state event.
0014  *
0015  * @sa Quotient::StateEvent
0016  */
0017 class JoinRulesEvent : public StateEvent
0018 {
0019 public:
0020     QUO_EVENT(JoinRulesEvent, "m.room.join_rules")
0021 
0022     explicit JoinRulesEvent(const QJsonObject &obj)
0023         : StateEvent(obj)
0024     {
0025     }
0026 
0027     /**
0028      * @brief The join rule for the room.
0029      *
0030      * see https://spec.matrix.org/latest/client-server-api/#mroomjoin_rules for
0031      * the available join rules for a room.
0032      */
0033     QString joinRule() const;
0034 
0035     /**
0036      * @brief The allow rule for restricted rooms.
0037      *
0038      * see https://spec.matrix.org/latest/client-server-api/#mroomjoin_rules for
0039      * full details on allow rules.
0040      */
0041     QJsonArray allow() const;
0042 };
0043 REGISTER_EVENT_TYPE(JoinRulesEvent)
0044 }