diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-02-15 11:49:40 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-02-15 11:49:40 +0900 |
commit | f3ec748689db531df787d19bcfe76b0a40665b67 (patch) | |
tree | 5f223a3a5d5083f5ba658954143228e9c73af7ac | |
parent | 173cfceab7da61e85467658a2c320609485b1139 (diff) | |
download | libquotient-f3ec748689db531df787d19bcfe76b0a40665b67.tar.gz libquotient-f3ec748689db531df787d19bcfe76b0a40665b67.zip |
Room: version(), predecessorId(), successorId()
Use RoomCreateEvent and RoomTombstoneEvent in the backend, covering most
of #235.
-rw-r--r-- | lib/room.cpp | 19 | ||||
-rw-r--r-- | lib/room.h | 6 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index 60c61f2b..e1625478 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -30,6 +30,8 @@ #include "csapi/rooms.h" #include "csapi/tags.h" #include "events/simplestateevents.h" +#include "events/roomcreateevent.h" +#include "events/roomtombstoneevent.h" #include "events/roomavatarevent.h" #include "events/roommemberevent.h" #include "events/typingevent.h" @@ -315,6 +317,21 @@ const QString& Room::id() const return d->id; } +QString Room::version() const +{ + return d->getCurrentState<RoomCreateEvent>()->version(); +} + +QString Room::predecessorId() const +{ + return d->getCurrentState<RoomCreateEvent>()->predecessor().roomId; +} + +QString Room::successorId() const +{ + return d->getCurrentState<RoomTombstoneEvent>()->successorRoomId(); +} + const Room::Timeline& Room::messageEvents() const { return d->timeline; @@ -1807,7 +1824,7 @@ RoomEventPtr makeRedacted(const RoomEvent& target, std::vector<std::pair<Event::Type, QStringList>> keepContentKeysMap { { RoomMemberEvent::typeId(), { QStringLiteral("membership") } } -// , { RoomCreateEvent::typeId(), { QStringLiteral("creator") } } + , { RoomCreateEvent::typeId(), { QStringLiteral("creator") } } // , { RoomJoinRules::typeId(), { QStringLiteral("join_rule") } } // , { RoomPowerLevels::typeId(), // { QStringLiteral("ban"), QStringLiteral("events"), @@ -80,6 +80,9 @@ namespace QMatrixClient Q_PROPERTY(Connection* connection READ connection CONSTANT) Q_PROPERTY(User* localUser READ localUser CONSTANT) Q_PROPERTY(QString id READ id CONSTANT) + Q_PROPERTY(QString version READ version NOTIFY baseStateLoaded) + Q_PROPERTY(QString predecessorId READ predecessorId NOTIFY baseStateLoaded) + Q_PROPERTY(QString successorId READ successorId NOTIFY upgraded) Q_PROPERTY(QString name READ name NOTIFY namesChanged) Q_PROPERTY(QStringList aliases READ aliases NOTIFY namesChanged) Q_PROPERTY(QString canonicalAlias READ canonicalAlias NOTIFY namesChanged) @@ -143,6 +146,9 @@ namespace QMatrixClient Connection* connection() const; User* localUser() const; const QString& id() const; + QString version() const; + QString predecessorId() const; + QString successorId() const; QString name() const; QStringList aliases() const; QString canonicalAlias() const; |