Age | Commit message (Collapse) | Author |
|
|
|
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).
|
|
Plugs some memory leaks reported by Valgrind.
|
|
Using them in rooms and connection comes in the next commit.
|
|
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).
|
|
Basically, segments of originalJsonObject() are used as-you-go instead of parsing them upon event creation.
|
|
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.
|
|
Closes #135.
|
|
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
|
|
|
|
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.
|
|
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.
|
|
* 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.
|
|
The events are detected in /sync output, and avatars for rooms are loaded from respective URLs. Clients can use Room::avatar() method to request a pixmap of a certain size, and react to avatarChanged() in order to update the UI when new pixmaps/avatars arrive. avatarChanged() signal is overloaded with two tasks - the first firing merely indicates that a new avatar is available (without actual pixmap yet available) while the second firing means that an actual pixmap has arrived (all this is entirely transparent for clients, they just should update their pixmaps from Room::avatar() every time when Room::avatarChanged() is emitted).
|
|
This allows to detect if a room has been encrypted (no room state, just
an event as of yet). Closes #84.
|
|
* Event::originalJsonObject() exposes the original JSON for the event without converting it to QByteArray. This is useful to quickly dump an event into a bigger JSON without reconstructing a JSON object.
* Validations in RoomEvent::RoomEvent() do more harm than good. The rest of the library tolerates absence of those attributes pretty well (it wouldn't be able to do much with that anyway); at the same time, dumping JSON to logs turns out to be pretty heavy, and throwing many invalid events at a client is a good way to hit its performance.
|
|
|
|
|
|
This includes RoomEvent gaining transactionId property and addId() method so that it could gain ids when being/having been sent.
|
|
The biggest change is we have no pimpls in Event objects anymore - because it's two new's instead of one per Event, and we have thousands and even more of Events created during initial sync. The other big change is introduction of RoomEvent, so that now the structure of events almost precisely reflects the CS API spec. The refactoring made UnknownEvent unnecessary as a separate class; a respective base class (either RoomEvent or Event) is used for this purpose now. All the other changes are consequences of these (mostly of RoomEvent introduction).
|
|
The Dispatch<> template and dispatch(), a facility function for it, simplify dispatching to functions that have different signatures that still can be converted to the same std::function<> type. The case in point is in event.cpp; Event::fromJson calls make() that always returns the type we need; however, once we have several possible base types (Event, RoomEvent, StateEvent), we'd have to either write a specific make() incarnation for each of them, or mess with function return type conversions. Dispatch<> helps to keep the code clean.
REGISTER_ENUM is a cross-Qt versions approach to dumping enumeration values to qDebug() and the likes.
|
|
logging.h/logging.cpp is now a full-fledged pair for all things logging. Two more categories added, EPHEMERAL and SYNCJOB, that control logging for ephemeral events and SyncJob, respectively (in particular, switching off EPHEMERAL greatly reduces the logspam about moving read markers and how many users have read up to which event).
|
|
This greatly reduces the noise made by quaternion.
To enable full logging, export the following variable:
QT_LOGGING_RULES="libqmatrixclient.*.debug=true"
|
|
there
Because these fall outside of SyncJob and Event context, respectively. In addition, Owning<> has gained a move assignment operator (because we have a move constructor) and assign() convenience method to take ownership over an existing container; also, Owning<>::release() is done the right way now (the previous version was copying the return value to a new container instead of releasing the old container).
|
|
This is not quite correct because only room events are guaranteed by the spec to have an id and a timestamp. But we don't parse all room events as of yet, so that's a way to at least make those attributes universally available for even unknown room events. It matters, because read receipts can refer to any room event id and because we'll use event id's to filter out duplicate events in further commits; and missing timestamps used to break the timeline display (showing <> instead of <valid timestamps>).
|
|
Because it's supposed to exist in (at least) all events from /sync.
|
|
|
|
Feel free to use whenever you need to convert another JSON key to some C++ object, or dispatch anything based on a JSON key.
|
|
That might be not as efficient as a solution on variadic templates; but
arguably easier to understand. Doesn't have the typo bug the previous version of this commit had.
|
|
breaks highlighting
This reverts commit 0fe83d59d76cd8f9c8f92d40cc58d9f5b082a84a.
|
|
|
|
That might be not as efficient as a solution on variadic templates; but
arguably easier to understand.
|
|
1. Introduce QDebug manipulators and formatJson manipulator in particular - this allows to accommodate some changes in Qt's debug printing behaviour between versions.
2. Show JSON for some questionable objects (UnknownEvents, events with no event_id etc.)
3. Log the list of typing users and the user id when getting an avatar.
|
|
Now you can parse a JSON array into a list of events with a one-liner.
Also, fromMSecsSinceEpoch accepts a qint64, not quint64 - fixed the respective cast.
|
|
|