diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-11-01 18:19:56 +0300 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-11-01 18:19:56 +0300 |
commit | a275ef911b3f4d0334df0628324aee0081dd3a65 (patch) | |
tree | 87d9b2bbbc67ceeb9c39d5c09f242b1776de8460 /room.cpp | |
parent | 64c0b7e045d9e8d58d91f252219a5579d4ba9441 (diff) | |
download | libquotient-a275ef911b3f4d0334df0628324aee0081dd3a65.tar.gz libquotient-a275ef911b3f4d0334df0628324aee0081dd3a65.zip |
StateEvent; EventContent::SimpleContent; event types refactoring
* StateEvent<> is a new class template for all state events. It provides a uniform interface to the state content, as well as a means to serialize the content back to JSON. In addition, StateEvent now parses the "prev_content" JSON object, so one can refer to the previous state now (a notable step to proper reflection of state changes in the displayed timeline in clients).
* EventContent::SimpleContent, together with StateEvent<>, forms a generalisation for simple state events, such as room name, topic, aliases etc. that boil down to a single key-value pair. DECLARE_SIMPLE_STATE_EVENT is a macro defined to streamline creation of events based on SimpleContent, providing API back-compatibility for events defined so far. As a result, a very concise simplestateevents.h replaces all those room*event.* files.
* Event/RoomEvent::fromJson() code is squeezed down to plain type lists passed to makeIfMatches() "chained factory" function template. TypeId is mandatory for an event type to be included into that factory.
* Event::toTimestamp() and Event::toStringList are completely superseded by respective fromJson<>() converters.
Diffstat (limited to 'room.cpp')
-rw-r--r-- | room.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -23,10 +23,7 @@ #include "jobs/generated/banning.h" #include "jobs/generated/leaving.h" #include "jobs/setroomstatejob.h" -#include "events/roomnameevent.h" -#include "events/roomaliasesevent.h" -#include "events/roomcanonicalaliasevent.h" -#include "events/roomtopicevent.h" +#include "events/simplestateevents.h" #include "events/roomavatarevent.h" #include "events/roommemberevent.h" #include "events/typingevent.h" |