aboutsummaryrefslogtreecommitdiff
path: root/events
AgeCommit message (Collapse)Author
2018-03-31Move source files to a separate folderKitsune Ral
It's been long overdue to separate them from the rest of the stuff (docs etc.). Also, this allows installing to a directory within the checked out git tree (say, ./install/, similar to ./build/).
2018-03-24Introduce DirectChatEvent (parse only, no processing yet)Kitsune Ral
2018-03-24MemberEventContent/RoomMemberEvent: parse and expose is_directKitsune Ral
2018-03-05Support server-side read marker (m.full_read)Kitsune Ral
Closes #183. There's also the m.read part but it can be done sometime later, as it's pure optimisation.
2018-03-05Room: addTag() and removeTag()Kitsune Ral
Slightly changed TagRecord constructors to match.
2018-03-05ReadMarkerEvent; TagEvent remade with less boilerplate codeKitsune Ral
tagevent.h -> accountdataevents.h now has a macro to define more simplistic events along the lines of simplestateevents.h but inheriting from Event instead. TagEvent and ReadMarkerEvent(m.fully_read) are defined using this macro. ReadMarkerEvent is also wired through event.* (but not further yet).
2018-03-05simplestateevents.h: minor tweaksKitsune Ral
2018-03-03Improve compatibility with gcc 4.9 to be able to build for Android with ↵Roman Plášil
QtCreator
2018-03-01Fix tags saving/restoring (finally)Kitsune Ral
Closes #134.
2018-02-26TagEvent: drop unneeded methods; add a license block to the .cpp fileKitsune Ral
Those methods are more appropriate for Room.
2018-02-26Deal with memory more carefullyKitsune Ral
Plugs some memory leaks reported by Valgrind.
2018-02-26TagEvent: m.tag events parsingKitsune Ral
Using them in rooms and connection comes in the next commit.
2018-02-25ReceiptEvent: code cleanupKitsune Ral
2018-02-24Don't copy event content in accessorsKitsune Ral
2018-02-23RoomMemberEvent: make it sendableKitsune Ral
To do that, both RoomMemberEvent and MemberEventContent got respective constructors. Also: the fallback value for unknown _received_ membership types is now Undefined; it's not allowed in member events for sending (will fail on assertion now) because the server requires membership to be explicitly set.
2018-02-19Fix a typo in the previous commitKitsune Ral
A symptom that you suffered from it is you don't see any usernames whatsoever, and after restarting room names are also gone (to fix that, delete cache files).
2018-02-07RoomEvent/RoomMemberEvent: do not store what can be calculated on the flyKitsune Ral
Basically, segments of originalJsonObject() are used as-you-go instead of parsing them upon event creation.
2018-02-03thumbnailInfo() for event content classes and RoomMessageEvent: hasThumbnailKitsune Ral
2018-01-25StateEvent<>: introduce Prev structure and prevSenderId() accessorKitsune Ral
Also switch prev_content() from accidental snake case to camel case (old name still provided for compatibility).
2018-01-20RoomMessageEvent::hasTextContent()Kitsune Ral
Similar to hasFileContent(), allows to ascertain that an event has TextContent without checking against all possible msgtypes.
2018-01-16EventContent: inject mediaThumbnailId into content original JSONKitsune Ral
For QML to easily make URLs to thumbnails.
2018-01-15EventContent: provide mediaId in the top-level JSON, not in "info" subobjectKitsune Ral
Given that it's a sidedoor anyway, it should at least be straightforward to use.
2018-01-15EventContent: rewrite without mixinsKitsune Ral
MSVC is not good at dealing with type parameter packs of member functions, which is what the whole mixin magic in UrlBasedContent<> relied on. So it's one more level of inheritance instead of mixins now.
2018-01-14Refactor EventContent; allow to easily check files out of message eventsKitsune Ral
The whole inheritance/templating structure has been considerably simplified by using a trick with mixin classes; thanks to that, *Info classes are no more templated, they are just mixed together by the almighty UrlBasedContent<> template (but the same can easily be done outside of it, as LocationContent implementation shows). RoomMessageEvent has gained hasFileContent(); it's also possible to easily get a FileInfo core object just by calling msgEvent->content()->fileInfo().
2018-01-12Event/RoomEvent: use Q_DECLARE_METATYPE properlyKitsune Ral
2017-12-27Introduce StateEventBase - a non-template base for StateEvent<>Kitsune Ral
This will hold common logic for all state events, including the newly introduced repeatsState() that returns true when prev_content repeats content. This will be used to address QMatrixClient/Quaternion#245.
2017-12-27StateEvent<>: Look for prev_content in unsigned, not top-levelKitsune Ral
2017-12-25ReceiptEvent: use QVector instead of std::vectorKitsune Ral
Because we should practice what we preach in CONTRIBUTING.md.
2017-12-25Code cleanupKitsune Ral
2017-12-16Fix an assertion failure when redacting an unknown eventKitsune Ral
Closes #135.
2017-12-14One more fix for older compilersKitsune Ral
2017-12-14That virtual ~Event() mentioned in the previous commit messageKitsune Ral
2017-12-14Move all internal event pointers to std::unique_ptr<>Kitsune Ral
This causes the following changes along the way: - Owning<> template is decommissioned. - event.h has been rearranged, and Event/RoomEvent::fromJson static methods have been replaced with an external makeEvent<> function template. A side effect of that is that one cannot use a factory with a type other than the one it's defined for (i.e. you cannot call makeEvent<TypingEvent>) but that feature has been out of use for long anyway. - Room::doAddNewMessageEvents() and Room::doAddHistoricalMessageEvents() have been removed, giving place to Room::onAddNewTimelineEvents() and Room::onAddHistoricalTimelineEvents(). The most important difference is that all code that must be executed now resides in addNewMessageEvents() (it moved from Room to Room::Private) and classes inheriting from Room are not obliged to call the overridden function from the overriding function (they can do it but those functions have empty bodies in Room). This was a long overdue change, and owning pointers simply mandated it. Room::onAddNewTimelineEvents/onAddHistoricalTimelineEvents should not do anything with the passed range in terms of ownership, it's just a way to allow the derived class to update his data in due course. - Room::Private::dropDuplicateEvents() and Room::Private::insertEvents(), notably, have been updated to work with owning pointers. insertEvents() move()s pointers to the timeline, while dropDuplicateEvents uses remove_if instead of stable_partition and doesn't explicitly delete event objects. Also, a bugfix: Event accidentally had not virtual destructor for quite a long time. According to the standard, deleting an object through a pointer to a base class without a virtual destructor leads to UB. So the fact that libqmatrixclient clients even worked all these months is mere coincidence and compiler authors good will :-D
2017-12-13EventsBatch: document the classKitsune Ral
2017-12-12Fix a compiler warningKitsune Ral
2017-12-11Whitelist origin_server_ts in redaction logicKitsune Ral
The Spec doesn't mention it but both Synapse and Riot act as if origin_server_ts was whitelisted, and it was also confirmed in #matrix-dev to be reasonable behaviour.
2017-12-10RedactionEvent and RoomEvent::redactedBecause()Kitsune Ral
A RoomEvent now has an optional pointer to a RedactionEvent that is non-null if the room event is redacted. transactionId and serverTimestamp are only filled if the event is not redacted. There's no way to construct a redacted event as of yet.
2017-12-10Introduce RoomEventsViewKitsune Ral
Will be used in Room to work with ranges of events.
2017-12-10EventType: Add more enumeration valuesKitsune Ral
2017-11-16Simplify code that loads events from JSON arraysKitsune Ral
2017-11-16Require state_key to be present in all state eventsKitsune Ral
This impacts the cache as well, as we don't save state_keys for most state events.
2017-11-02Fix AppVeyor CIKitsune Ral
2017-11-02Fixed CIKitsune Ral
2017-11-01Imbue RoomMemberEvent with EventContentKitsune Ral
It now allows to check what exactly has happened to the member (display name change, joining, avatar update), fixing #105.
2017-11-01Event::isStateEvent(); fixed StateEvent::_prev always being initialisedKitsune Ral
Event::isStateEvent() is an easier way to make checking an event kind (instead of enumerating through all types corresponding to state changes). StateEvent::_prev (accessible through prev_content) should only be initialised if there's a previous state in the original JSON.
2017-11-01StateEvent; EventContent::SimpleContent; event types refactoringKitsune Ral
* 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.
2017-11-01Add TypeId to more eventsKitsune Ral
2017-11-01ReceiptEvent: Use fromJson<>() from converters.h; add TypeIdKitsune Ral
Event::toTimestamp() duplicates fromJson<>() code, so it should go.
2017-11-01Drop UnknownEvent files from the source treeKitsune Ral
We don't use them for several months already.
2017-10-31Streamline EventContent hierarchyKitsune Ral
Two changes to make EventContent hierarchy easier to understand and use: - InfoBase is unbound from Base, and downstream classes use multiple inheritance to work "info" objects - MIME types are separated from Base into a separate TypedBase class because MIME typing is not common to all content kinds.