aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs
AgeCommit message (Collapse)Author
2018-12-24Clarify doc-comment for BaseJob::finished a bitKitsune Ral
[skip ci]
2018-12-08SyncJob: accept Filter instead of QString for the filterKitsune Ral
2018-11-20SyncJob::parseJson: fix a validation mistakeKitsune Ral
2018-11-20Make SyncData more self-contained and prepare for cache splittingKitsune Ral
SyncData now resides in its own pair of files and is capable to load either from file or from JSON. There is also (yet untested) capability to load rooms from files if a file name stands is the value for a given room id. This allows to store the master cache file separately from cache files for each room, massively easing the problem of bulky accounts that can overflow the poor capacity of Qt's JSON engine.
2018-11-19BaseJob::rawDataSample()Kitsune Ral
A new recommended (and localisable) way of getting a piece of raw response to display next to error messages as "details". BaseJob::rawData() returns exactly the trimmed piece of data, no "truncated" suffix there anymore.
2018-11-04Profiler logging fixes and improvementsKitsune Ral
2018-11-03MediaThumbnailJob: minor code polishingKitsune Ral
2018-10-10add http2 and pipelining for all JobsKrombel
2018-09-16BaseJob::rawData: only add "truncated" when actually truncatedKitsune Ral
2018-08-30SyncJob: Add account_data to left roomsKitsune Ral
Closes #240.
2018-07-27Initial support for local echoKitsune Ral
The Room class has gained a new internal container, unsyncedEvents, storing locally-created Event objects that are about to be sent or are sent but not yet synced. These objects are supposed to be complete enough to be displayed by clients in a usual way; access to them is provided by Room::pendingEvents() accessor. A set of pendingEvent* signals has been added to notify clients about changes in this container (adding, removal, status update). Yet unsent events don't have Event::id() at all; sent but yet unsynced ones have Event::id() but have almost nothing else except the content for now (probably a sender and an (at least local) timestamp are worth adding). Also: SendEventJob is removed in favor of GTAD-generated SendMessageJob.
2018-07-16Fix a clazy warningKitsune Ral
2018-07-04Break down event.* into smaller filesKitsune Ral
We now have event.*, roomevent.*, stateevent.* and eventloader.h. If you only use event leaf-classes (such as RoomMemberEvent) you shouldn't notice anything.
2018-07-04Use QStringLiteral() and operator"" _ls() in network jobsKitsune Ral
2018-07-04Event types system remade to be extensibleKitsune Ral
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.
2018-07-04Connection: Trim raw data in emitted signalsKitsune Ral
If the payload is too large, an attempt to allocate a QString out of QByteArray may end with qBadAlloc(). So by default the data emitted in case of error are trimmed to 64KiB, and this can be overridden to a different value (or switched off entirely with <n>=0) by adding - DTRIM_RAW_DATA=<n> to CPP_FLAGS.
2018-07-03Roll various switch case fallthrough markers into a macroKitsune Ral
2018-07-03SyncJob: log sync data statistics betterKitsune Ral
2018-07-01CleanupKitsune Ral
2018-06-11BaseJob: Drop 'error' from methods that work in normal job state tooKitsune Ral
2018-06-08SyncJob: Support receiving to_device and presence eventsKitsune Ral
2018-06-03csapi/content-repo.*: jobs return results in data() instead of content() nowKitsune Ral
Because GTAD has been updated to use a different default name for returned properties.
2018-06-02BaseJob: fix error handling for M_CONSENT_NOT_GIVENKitsune Ral
2018-05-30BaseJob::setStatus: Don't try to remove access token if it's emptyKitsune Ral
Closes #210.
2018-05-29BaseJob: Treat M_CONSENT_NOT_GIVEN separately from other content access errorsKitsune Ral
Closes #207.
2018-05-29BaseJob: "background" switch; more extensive error reportingKitsune Ral
Running a request in background, aside from some tweaks on the network layer (see QNetworkRequest::BackgroundRequestAttribute), allows to distinguish jobs not immediately caused by user interaction (such as fetching thumbnails). This can be used to show or not show certain notifications in UI of clients. Error reporting has been extended with more methods: errorCaption() - a human-readable phrase calculated from the status code; intended to be shown as a dialog caption and in similar situations. errorRawData() - former errorDetails(), returns the raw response from the server. errorUrl() - returns a URL that may be useful with the error (e.g. for the upcoming "consent not given" error, this will have the policy URL). Connection::resultFailed() - a new signal emitted when _any_ BaseJob::failure() is emitted (enables centralised error handling across all network requests in clients). As a part of matching changes in Connection, callApi has an overload that allows to specify the policy; a custom enum instead of bool has been chosen for the parameter type, to avoid clashes with (arbitrary) types of job parameters.
2018-05-28BaseJob: support status trackingKitsune Ral
The newly introduced statusChanged() signal allows clients to be notified about the job state transitions.
2018-05-28BaseJob: refresh rotten comments about kill()Kitsune Ral
There is no more BaseJob::kill() for a very long time; we have abandon() instead, with a bit different meaning. Which, by the way, now emits finished() because that's what finished() has been for.
2018-05-23BaseJob: more careful error handling; unify and extend error signals in ↵Kitsune Ral
Connection (Note: this commit breaks back-compatibility.) BaseJob::gotReply() had a bold assumption that whenever there's no reasonable JSON body in case of error, that meant IncorrectRequestError (which of course was incorrect). This led to syncs dying in Quaternion because it (correctly) considered IncorrectRequestError to be grave enough to not retry. Closes #206. Also: don't dump the whole payload to logs, limit with initial 500 characters (closes #205)
2018-05-06Remove unused job classes.Kitsune Ral
2018-05-06Optimise #includes, eliminate some excess blank lines in lib/csapiKitsune Ral
2018-05-04New home for the generated code - lib/csapiKitsune Ral
2018-05-04gtad.yaml: CleanupKitsune Ral
2018-05-04gtad.yaml: Even more concise type stubbingKitsune Ral
With most recent GTAD.
2018-05-04Connection, jobs/generated: Use QStringList instead of QVector<QString>Kitsune Ral
QStringList's API is richer, after all.
2018-05-04gtad.yaml: Use QStringList instead of QVector<QString>Kitsune Ral
QStringList's API is richer, after all.
2018-05-04jobs/generated: code ordering, more commentsKitsune Ral
2018-05-04gtad.yaml: Support maps of eventsKitsune Ral
Use std::unordered_map<> (now supported by GTAD and converters.h) for that.
2018-05-04{{base}}.h.mustache: better code ordering, more commentsKitsune Ral
2018-05-04SendToDeviceJob: use a map-of-maps for messages instead of an opaque QJsonObjectKitsune Ral
2018-05-04gtad.yaml: Support OpenAPI value maps (aka additionalProperties)Kitsune Ral
This is useful for things like tags map in m.tags event, or the map-of-maps-of-messages in SendToDeviceJob (coming in the next commit). Requires GTAD 0.4.9 or later.
2018-05-04Preempt job/setroomstatejob.* with jobs/generated/room_state.*Kitsune Ral
The template part (not exposed in the auto-generated class) goes to Room::Private::requestSetState(). Also, Room::setMemberState() to interface with User class.
2018-05-04EvT::TypeId: Use a member function instead of a variableKitsune Ral
The latter one causes linkage errors when used from a template method (but not from a template class, puzzlingly).
2018-05-03gtad.yaml: Update regexes to match string partsKitsune Ral
According to KitsuneRal/gtad#31.
2018-05-03Preempt jobs/joinroomjob.* with jobs/generated/joining.*Kitsune Ral
Enables responding to third-party invites.
2018-05-03jobs/generated: Drop unused codeKitsune Ral
2018-05-03GetRoomEventsJob (replaces RoomMessagesJob) + refactoringKitsune Ral
1. Updates in this commit (see further) allow to generate and build GetRoomEventsJob from message_pagination.yaml; this job completely preempts RoomMessagesJob. 2. EventsBatch<> is no more a thing; there's EventsArray<> to replace it but it's loaded from a JSON array rather than an event batch (a JSON array inside another JSON object). SyncJob that used it extensively has been moved to "conventional" containers (Events, RoomEvents and the newly introduced StateEvents). RoomMessagesJob that also used EventsBatch<> is decommissioned (see above). 3. RoomEventsRange is now an alias for Range<RoomEvents>, defined in util.h (otherwise almost the same). 4. Connection::getMessages() is no more. Use Room::getPreviousContent() and Connection::callApi<GetRooMEventsJob>() instead. 5. Moving things around in Room, since SyncJob now supplies state events in more specific StateEvents, rather than RoomEvents.
2018-05-03GTAD: Use QMatrixClient::Event-derived classes in generated jobs + Mustache ↵Kitsune Ral
cleanup This should make generated jobs buildable across the whole CS API (sync.yaml is disabled as the manual implementation is still considerably better).
2018-05-01Merge branch 'master' into kitsune-gtadKitsune Ral
2018-05-01jobs/generated: use std::move in baseURL; type updates from the API filesKitsune Ral
The type updates are a matter of pending PR to matrix-doc yet.