diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-07-06 23:08:24 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-07-06 23:08:24 +0900 |
commit | 717f3bc6c91b14905f222e094e439b4cdcdab2c8 (patch) | |
tree | f3e43f5427e8b124b8aec4b6f437017fca65356b /lib/events/simplestateevents.h | |
parent | a4d1acb8e9e3f101c891f9089a07e214e5cc55f8 (diff) | |
parent | f58819e4e930ee66e790eccaedf551f807956d72 (diff) | |
download | libquotient-717f3bc6c91b14905f222e094e439b4cdcdab2c8.tar.gz libquotient-717f3bc6c91b14905f222e094e439b4cdcdab2c8.zip |
Merge branch 'master' into e2ee-enc-mng
Diffstat (limited to 'lib/events/simplestateevents.h')
-rw-r--r-- | lib/events/simplestateevents.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/events/simplestateevents.h b/lib/events/simplestateevents.h index 81401532..ef56c7b2 100644 --- a/lib/events/simplestateevents.h +++ b/lib/events/simplestateevents.h @@ -20,8 +20,6 @@ #include "stateevent.h" -#include "converters.h" - namespace QMatrixClient { namespace EventContent @@ -63,7 +61,7 @@ namespace QMatrixClient explicit _Name() : _Name(value_type()) { } \ template <typename T> \ explicit _Name(T&& value) \ - : StateEvent(typeId(), matrixTypeId(), \ + : StateEvent(typeId(), matrixTypeId(), QString(), \ QStringLiteral(#_ContentKey), \ std::forward<T>(value)) \ { } \ @@ -78,13 +76,27 @@ namespace QMatrixClient DEFINE_SIMPLE_STATE_EVENT(RoomNameEvent, "m.room.name", QString, name) DEFINE_EVENTTYPE_ALIAS(RoomName, RoomNameEvent) - DEFINE_SIMPLE_STATE_EVENT(RoomAliasesEvent, "m.room.aliases", - QStringList, aliases) - DEFINE_EVENTTYPE_ALIAS(RoomAliases, RoomAliasesEvent) DEFINE_SIMPLE_STATE_EVENT(RoomCanonicalAliasEvent, "m.room.canonical_alias", QString, alias) DEFINE_EVENTTYPE_ALIAS(RoomCanonicalAlias, RoomCanonicalAliasEvent) DEFINE_SIMPLE_STATE_EVENT(RoomTopicEvent, "m.room.topic", QString, topic) DEFINE_EVENTTYPE_ALIAS(RoomTopic, RoomTopicEvent) DEFINE_EVENTTYPE_ALIAS(RoomEncryption, EncryptionEvent) + + class RoomAliasesEvent + : public StateEvent<EventContent::SimpleContent<QStringList>> + { + public: + DEFINE_EVENT_TYPEID("m.room.aliases", RoomAliasesEvent) + explicit RoomAliasesEvent(const QJsonObject& obj) + : StateEvent(typeId(), obj, QStringLiteral("aliases")) + { } + RoomAliasesEvent(const QString& server, const QStringList& aliases) + : StateEvent(typeId(), matrixTypeId(), server, + QStringLiteral("aliases"), aliases) + { } + QString server() const { return stateKey(); } + QStringList aliases() const { return content().value; } + }; + REGISTER_EVENT_TYPE(RoomAliasesEvent) } // namespace QMatrixClient |