aboutsummaryrefslogtreecommitdiff
path: root/events/event.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-02-25 17:24:59 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-02-26 09:06:37 +0900
commit7c10807549b2a73527bd594789d0e5b9ab58c874 (patch)
treeed624b2af356ac0e148862a3cee736d9fd894268 /events/event.cpp
parenta2f991555bec7b317606093e95ec2b5684b0005a (diff)
downloadlibquotient-7c10807549b2a73527bd594789d0e5b9ab58c874.tar.gz
libquotient-7c10807549b2a73527bd594789d0e5b9ab58c874.zip
TagEvent: m.tag events parsing
Using them in rooms and connection comes in the next commit.
Diffstat (limited to 'events/event.cpp')
-rw-r--r--events/event.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/events/event.cpp b/events/event.cpp
index 366aa858..b55c44c4 100644
--- a/events/event.cpp
+++ b/events/event.cpp
@@ -24,6 +24,7 @@
#include "roomavatarevent.h"
#include "typingevent.h"
#include "receiptevent.h"
+#include "tagevent.h"
#include "redactionevent.h"
#include "logging.h"
@@ -44,6 +45,11 @@ Event::Event(Type type, const QJsonObject& rep)
Event::~Event() = default;
+QString Event::jsonType() const
+{
+ return originalJsonObject().value("type").toString();
+}
+
QByteArray Event::originalJson() const
{
return QJsonDocument(_originalJson).toJson();
@@ -82,7 +88,7 @@ EventPtr _impl::doMakeEvent<Event>(const QJsonObject& obj)
return EventPtr(move(e));
return EventPtr { makeIfMatches<Event,
- TypingEvent, ReceiptEvent>(obj, obj["type"].toString()) };
+ TypingEvent, ReceiptEvent, TagEvent>(obj, obj["type"].toString()) };
}
RoomEvent::RoomEvent(Event::Type type) : Event(type) { }