aboutsummaryrefslogtreecommitdiff
path: root/lib/events/accountdataevents.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-08 19:08:57 +0200
committerGitHub <noreply@github.com>2022-05-08 19:08:57 +0200
commit3458fdf7b416fe64b82ec9b99553c7b2aa299e4c (patch)
treeb3b1bce3ebf0631597aa6d8451e62d198a42c2be /lib/events/accountdataevents.h
parent272cb01b05529971ea38e09bf75d8d8f194a9dd8 (diff)
parentc42d268db0b40cdba06381fc64a6966a72c90709 (diff)
downloadlibquotient-3458fdf7b416fe64b82ec9b99553c7b2aa299e4c.tar.gz
libquotient-3458fdf7b416fe64b82ec9b99553c7b2aa299e4c.zip
Merge #548: Streamline usage of event types, part 1
Diffstat (limited to 'lib/events/accountdataevents.h')
-rw-r--r--lib/events/accountdataevents.h31
1 files changed, 9 insertions, 22 deletions
diff --git a/lib/events/accountdataevents.h b/lib/events/accountdataevents.h
index 12f1f00b..ec2f64e3 100644
--- a/lib/events/accountdataevents.h
+++ b/lib/events/accountdataevents.h
@@ -46,27 +46,14 @@ struct JsonObjectConverter<TagRecord> {
using TagsMap = QHash<QString, TagRecord>;
-#define DEFINE_SIMPLE_EVENT(_Name, _TypeId, _ContentType, _ContentKey) \
- class QUOTIENT_API _Name : public Event { \
- public: \
- using content_type = _ContentType; \
- DEFINE_EVENT_TYPEID(_TypeId, _Name) \
- explicit _Name(const QJsonObject& obj) : Event(typeId(), obj) {} \
- explicit _Name(const content_type& content) \
- : Event(typeId(), matrixTypeId(), \
- QJsonObject { \
- { QStringLiteral(#_ContentKey), toJson(content) } }) \
- {} \
- auto _ContentKey() const \
- { \
- return contentPart<content_type>(#_ContentKey##_ls); \
- } \
- }; \
- REGISTER_EVENT_TYPE(_Name) \
- // End of macro
-
-DEFINE_SIMPLE_EVENT(TagEvent, "m.tag", TagsMap, tags)
-DEFINE_SIMPLE_EVENT(ReadMarkerEvent, "m.fully_read", QString, event_id)
-DEFINE_SIMPLE_EVENT(IgnoredUsersEvent, "m.ignored_user_list", QSet<QString>,
+DEFINE_SIMPLE_EVENT(TagEvent, Event, "m.tag", TagsMap, tags)
+DEFINE_SIMPLE_EVENT(ReadMarkerEventImpl, Event, "m.fully_read", QString, eventId)
+class ReadMarkerEvent : public ReadMarkerEventImpl {
+public:
+ using ReadMarkerEventImpl::ReadMarkerEventImpl;
+ [[deprecated("Use ReadMarkerEvent::eventId() instead")]]
+ QString event_id() const { return eventId(); }
+};
+DEFINE_SIMPLE_EVENT(IgnoredUsersEvent, Event, "m.ignored_user_list", QSet<QString>,
ignored_users)
} // namespace Quotient