aboutsummaryrefslogtreecommitdiff
path: root/jobs
AgeCommit message (Collapse)Author
2018-01-25BaseJob::checkReply: log job returned status more explicitlyKitsune Ral
2018-01-15DownloadFileJob: Be tolerant to request retriesKitsune Ral
2018-01-14DownloadFileJobKitsune Ral
Instead of exposing a QIODevice as GetContentJob does it gets a filename and saves the incoming payload into it.
2018-01-14BaseJob: afterStart(), beforeAbandon(), up/downloadProgress()Kitsune Ral
To support the upcoming DownloadFileJob
2018-01-14Drop extraneous #include <QString>Kitsune Ral
2018-01-14BaseJob::Data -> RequestData; support QIODevice* input/outputKitsune Ral
2018-01-14Merge branch 'master' into kitsune-content-repo-create-roomKitsune Ral
2018-01-12BaseJob::maxRetries: Align the type with that of JobTimeoutConfigKitsune Ral
Fixes some signedness warnings
2018-01-09MediaThumbnailJob: Rewire to GetContentThumbnailJob; decommission ThumbnailTypeKitsune Ral
"crop" thumbnail type didn't seem to be ever used. Once GTAD is able to generate enums, the respective code will show up in GetContentThumbnailJob and this parameter can be reintroduced in MediaThumbnailJob. As of now, just rely on the default "scale" value.
2018-01-09jobs/generated: content-repo.*, create_room.*Kitsune Ral
2018-01-09jobs: expect application/json by default; set query in constructor body; ↵Kitsune Ral
properly convert numbers to strings in query The query should be set in constructor body because there's no reason to pass non-required parameters into the query. As for numbers to strings conversion - there was an attempt to use QJsonValue(a).toString() for that. That doesn't work; QJsonValue does not turn numbers to strings.
2018-01-09jobs/generated: Use BaseJob::addExpectedContentType()Kitsune Ral
2018-01-09BaseJob: Provide a simplified constructorKitsune Ral
2018-01-09BaseJob, MediaThumbnailJob: Support request and response headersKitsune Ral
Enable specifying headers in the request and checking/using headers in the response.
2018-01-09jobs/generated: Polish formatting; other minor cleanupKitsune Ral
2018-01-09BaseJob: change initial job status from NoError to PendingKitsune Ral
Otherwise isJobRunning() is of no great use.
2018-01-09isJobRunning() facility functionKitsune Ral
2017-12-30BaseJob: do not suppress SSL errorsKitsune Ral
It is the application's responsibility to properly display the error and get confirmation from the user about it.
2017-12-28Switch from QPixmap to QImage; add convenience avatar() overloads to Room ↵Kitsune Ral
and User The switch is necessary because MediaThumbnailJob is supposed to return something that can be worked on in non-GUI threads (as is the case of QML image providers), and QPixmap is not supposed for usage out of the main thread.
2017-12-25BaseJob: further minor code cleanupKitsune Ral
2017-12-25BaseJob: consolidate job timeout configurationKitsune Ral
This prepares the backend to enable timeouts/retry intervals configurable from clients.
2017-12-14Declare SyncRoomData as C++-movableKitsune Ral
This fixes compilation with older compilers that try to instantiate a copy constructor (and fail because unique_ptr) but actually is more proper in general. Also: do not advertise the class as Q_MOVABLE_TYPE: this was useful for QList/QVector when SyncRoomData was copyable; now it isn't, and Qt containers can't deal with non-copyable classes at all.
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-07PasswordLogin: Fix the legacy job class to compile with new BaseJob::DataKitsune Ral
2017-12-07New generated jobs for: room directory, 3PIDs, redactions, typing ↵Kitsune Ral
notifications and others Closes #128 (the issue has the full list of jobs arriving herewith).
2017-12-07Make BaseJob::Data consume QByteArray as well, not only QJsonObjectKitsune Ral
This is needed to support cases of content-repo, where the request/response bodies are not JSON.
2017-12-07jobs/generated: don't rely on QString's COW; firmer formattingKitsune Ral
2017-12-07Generated jobs: Apply naming convention to parametersKitsune Ral
It's now camelCase everywhere, even if The Spec uses snake_case (it is not consistent in that respect).
2017-12-07Generated jobs: Don't dump empty strings to body parametersKitsune Ral
This is important for (soon to be added) LoginJob, since the server is sensitive to getting an (even empty) entity for "medium" as opposed to omitting it entirely. This cannot be addressed on the spec level; on the other hand, removing empty parameters from the payload reduces useless bytes getting on the wire.
2017-11-21Use QStringLiteral instead of bare QString constructors for string constantsKitsune Ral
For job endpoints, we should eventually move to QLatin1String or QByteArray instead. Maybe later.
2017-11-21Mitigate the mess with slashes between base URL and endpoint stringKitsune Ral
Closes #125
2017-11-16Simplify code that loads events from JSON arraysKitsune Ral
2017-11-01Move converters.h out of jobs/Kitsune Ral
Because they are applicable beyond jobs.
2017-10-27Put access token to headers instead of queryKitsune Ral
2017-10-25Fixed a typo in the logsKitsune Ral
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-10-17Avoid leaking access_token in the logsKitsune Ral
Closes #102.
2017-10-14Actually added generated/profile.* files, needed to change display nameKitsune Ral
2017-10-14LogoutJob is supplied by generated codeKitsune Ral
2017-10-14Leaving a room now uses a generated Job fileKitsune Ral
2017-10-14Make JoinState (de)serializable library-wideKitsune Ral
2017-10-14Cleanup around Room (potentially breaks API compatibility, beware)Kitsune Ral
Notably: * API for SendEventJob and SetRoomStateJob has been altered to accept references, not pointers. * Methods on Room that invoke requests to the server, have lost const, because they may be reflecting the changed state on the fly, within themselves
2017-10-13Support banning and unbanningKitsune Ral
Closes #38. Also rearranged #includes
2017-10-13Cleaner generated filesKitsune Ral
2017-10-13Extend the number of types supported by fromJson<>()Kitsune Ral
Template function cannot have partial specializations, and we need to deserialise QVector<> objects. So fromJson<>() is now a wrapper around FromJson<> template class that does all the dispatching stuff in its operator().
2017-10-13All jobs: Drop ConnectionData parameter from the constructorKitsune Ral
Having to pass ConnectionData to each and every job class was nothing but boilerplate since the very beginning. Removing it required to prepend BaseJob::start() with ConnectionData-setting code, and to provide a way to alter the request configuration depending on the (late-coming) ConnectionData object. This is a new responsibility of BaseJob::start(); the previous BaseJob::start() contents have moved to BaseJob::sendRequest() (which is now invoked on retries, instead of start()).
2017-09-22BaseJob: Log the sent request more nicelyKitsune Ral
2017-09-21jobs: SetRoomStateJob (with or without state key); setting room topicKitsune Ral
2017-09-21Merge branch 'master' into kitsune-invite-kickKitsune Ral
2017-09-20BaseJob: track the outcome of sendRequest() in the logsKitsune Ral
Also: no reason to start the job timer if the request is not running, so don't even bother.