aboutsummaryrefslogtreecommitdiff
path: root/examples/qmc-example.cpp
AgeCommit message (Collapse)Author
2018-06-02More reliable test state tracking; join/leave testsKitsune Ral
1. Instead of a single numeric semaphore, tests are first added to the `running` list and then transferred to `succeeded` or `failed`, depending on the outcome. 2. The test flow now starts with joining the test room and finishes with leaving it. Closes #209.
2018-04-05qmc-example: fix false negatives due to a missing returnKitsune Ral
2018-04-01Pass actual changes with Connection::directChatsListChanged()Kitsune Ral
Also: provide Connection::directChats() to get the whole direct chats map.
2018-03-25Direct chat (un)marking: update internal structure synchronouslyKitsune Ral
The asynchronous update first implemented was more verbose and caused more problems than provided solutions. The idea was that the internal directChats map would better reflect the server state if updated asynchronously. However, it also causes a local race condition; e.g., to quickly remove rooms from direct chats one after another becomes very non-trivial (one has to wait until the previous operation succeeds). So after some playing with the code, hitting pitfalls along the way, I decided to align the logic with the one for room tags; synchronously issued signals look uglyish but at least work predictably. And race conditions between several clients generally cannot be cleanly resolved anyway.
2018-03-24Test/example for direct chats markingKitsune Ral
Also: refactored to gather up code dealing with the semaphor.
2018-03-07qmc-example: Fix redaction test to work even if the synced message is ↵Kitsune Ral
already redacted
2018-03-07qmc-example: Remove no more needed deleteLaterKitsune Ral
Might help with autotest segfaulting on OSX.
2018-03-07qmc-example: Ensure prerequisites before running the tagging testKitsune Ral
2018-03-05qmc-example: Logging tweaksKitsune Ral
2018-03-05qmc-example: Rewritten with a QObject for clearer dispatchingKitsune Ral
2018-03-05qmc-example: tests for redaction and tagging; send origin in test messagesKitsune Ral
2018-02-26qmc-example: Temporarily comment out the code that uses uncommitted featuresKitsune Ral
2018-02-26qmc-example: Optionally send a test message; don't dump incoming messages to ↵Kitsune Ral
cout The room alias is the third parameter (after user and password).
2018-02-26qmc-example: Single-shot sync instead of continuous; room tags; code cleanupKitsune Ral
Single-shot sync is now used because with that qmc-example can be used as a crude auto-testing tool.
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-10Fixed compilation with older QtKitsune Ral
2017-12-10Process incoming redactionsKitsune Ral
This only applies to new messages; historical redaction events are just skipped because historical events are already redacted on the server side. Closes #117.
2017-10-19Introduce device_id and initial_device_name support; switch to generated ↵Kitsune Ral
LoginJob This is _almost_ a backwards-compatible change, except that connect*() and other relevant methods in Connection are no more virtual (that wasn't much useful anyway). Otherwise it's a matter of passing initial_device_name to connectToServer(), saving device_id (along with access_token) from the result of LoginJob and then passing device_id (along with access_token, again) to connectWithToken() upon the next run.
2017-05-22Refactored EventsKitsune Ral
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).
2017-03-21Fixed to work with older MinGWKitsune Ral
At least MinGW 4.8 (bundled with Qt 5.2.1 for Windows) crashes with internal error on lambdas-in-lambdas.
2017-03-20Added an example of libqmatrixclient usageKitsune Ral
Compile and run with your username and password as the first two arguments.