aboutsummaryrefslogtreecommitdiff
path: root/lib/events/reactionevent.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-02-13 19:25:24 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-02-13 19:25:24 +0100
commit044ae4a029b710571420f830a497647f7a54698a (patch)
tree14d50ba0eb1a5cfac995f13cd6059aed74e506b2 /lib/events/reactionevent.h
parentb0aef4af9cbf00755c7b70c71d77f0bf7ce0d200 (diff)
parent10ac7c13cdcd62b62af6e89cb726376cfbc53302 (diff)
downloadlibquotient-044ae4a029b710571420f830a497647f7a54698a.tar.gz
libquotient-044ae4a029b710571420f830a497647f7a54698a.zip
Merge branch 'dev'
The result is FTBFS as yet; next commits will fix that, along with a few other things.
Diffstat (limited to 'lib/events/reactionevent.h')
-rw-r--r--lib/events/reactionevent.h34
1 files changed, 3 insertions, 31 deletions
diff --git a/lib/events/reactionevent.h b/lib/events/reactionevent.h
index 5a2b98c4..b3cb3ca7 100644
--- a/lib/events/reactionevent.h
+++ b/lib/events/reactionevent.h
@@ -4,39 +4,11 @@
#pragma once
#include "roomevent.h"
+#include "eventrelation.h"
namespace Quotient {
-struct EventRelation {
- using reltypeid_t = const char*;
- static constexpr reltypeid_t Reply() { return "m.in_reply_to"; }
- static constexpr reltypeid_t Annotation() { return "m.annotation"; }
- static constexpr reltypeid_t Replacement() { return "m.replace"; }
-
- QString type;
- QString eventId;
- QString key = {}; // Only used for m.annotation for now
-
- static EventRelation replyTo(QString eventId)
- {
- return { Reply(), std::move(eventId) };
- }
- static EventRelation annotate(QString eventId, QString key)
- {
- return { Annotation(), std::move(eventId), std::move(key) };
- }
- static EventRelation replace(QString eventId)
- {
- return { Replacement(), std::move(eventId) };
- }
-};
-template <>
-struct JsonObjectConverter<EventRelation> {
- static void dumpTo(QJsonObject& jo, const EventRelation& pod);
- static void fillFrom(const QJsonObject& jo, EventRelation& pod);
-};
-
-class ReactionEvent : public RoomEvent {
+class QUOTIENT_API ReactionEvent : public RoomEvent {
public:
DEFINE_EVENT_TYPEID("m.reaction", ReactionEvent)
@@ -47,7 +19,7 @@ public:
explicit ReactionEvent(const QJsonObject& obj) : RoomEvent(typeId(), obj) {}
EventRelation relation() const
{
- return contentPart<EventRelation>("m.relates_to"_ls);
+ return contentPart<EventRelation>(RelatesToKey);
}
};
REGISTER_EVENT_TYPE(ReactionEvent)