aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roomcreateevent.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-15 11:11:47 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-15 11:11:47 +0900
commit6af5e93134065cd97644d2eee43b2852df549553 (patch)
treee2c6b1375a97f5b50381e23fd47eeae2f46d73db /lib/events/roomcreateevent.h
parenta8adbc1d3c8ba787321ebd558062a9c12b12324a (diff)
downloadlibquotient-6af5e93134065cd97644d2eee43b2852df549553.tar.gz
libquotient-6af5e93134065cd97644d2eee43b2852df549553.zip
Simplify RoomCreateEvent
Diffstat (limited to 'lib/events/roomcreateevent.h')
-rw-r--r--lib/events/roomcreateevent.h32
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/events/roomcreateevent.h b/lib/events/roomcreateevent.h
index d93668f9..0a8f27cc 100644
--- a/lib/events/roomcreateevent.h
+++ b/lib/events/roomcreateevent.h
@@ -22,30 +22,28 @@
namespace QMatrixClient
{
- class RoomCreateDetails
- {
- public:
- explicit RoomCreateDetails(const QJsonObject& json);
-
- bool federated;
- QString version;
- QString predRoomId;
- QString predEventId;
- };
-
- class RoomCreateEvent : public StateEvent<const RoomCreateDetails>
+ class RoomCreateEvent : public StateEventBase
{
public:
DEFINE_EVENT_TYPEID("m.room.create", RoomCreateEvent)
+ explicit RoomCreateEvent()
+ : StateEventBase(typeId(), matrixTypeId())
+ { }
explicit RoomCreateEvent(const QJsonObject& obj)
- : StateEvent(typeId(), obj)
+ : StateEventBase(typeId(), obj)
{ }
- bool isFederated() const { return content().federated; }
- QString version() const { return content().version; }
- std::pair<QString, QString> predecessor() const;
- bool isUpgrade() const { return !content().predRoomId.isEmpty(); }
+ struct Predecessor
+ {
+ QString roomId;
+ QString eventId;
+ };
+
+ bool isFederated() const;
+ QString version() const;
+ Predecessor predecessor() const;
+ bool isUpgrade() const;
};
REGISTER_EVENT_TYPE(RoomCreateEvent)
}