From f1ffe1e7a3e81c07a07a8416ce307e4413ec8fbc Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 1 Jul 2018 22:48:38 +0900 Subject: Event types system remade to be extensible There were two common points that had to be updated every time a new event is introduced: the EventType enumeration and one of 3 doMakeEvent<> specialisations. The new code has a template class, EventFactory<>, that uses a list of static factory methods to create events instead of typelists used in doMakeEvent<>(); the EventType enumeration is replaced with a namespace populated with constants as necessary. In general, EventType is considered a deprecated mechanism altogether; instead, a set of facilities is provided: is<>() to check if an event has a certain type (to replace comparison against an EventType value) and visit<>() to execute actions based on the event type (replacing switch statements over EventType values). Closes #129. --- lib/jobs/sendeventjob.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/jobs/sendeventjob.h') diff --git a/lib/jobs/sendeventjob.h b/lib/jobs/sendeventjob.h index a3e9a291..af81ae26 100644 --- a/lib/jobs/sendeventjob.h +++ b/lib/jobs/sendeventjob.h @@ -32,9 +32,9 @@ namespace QMatrixClient SendEventJob(const QString& roomId, const EvT& event) : BaseJob(HttpVerb::Put, QStringLiteral("SendEventJob"), QStringLiteral("_matrix/client/r0/rooms/%1/send/%2/") - .arg(roomId, EvT::typeId()), // See also beforeStart() + .arg(roomId, EvT::matrixTypeId()), // See also beforeStart() Query(), - Data(event.toJson())) + Data(event.contentJson())) { } /** -- cgit v1.2.3