aboutsummaryrefslogtreecommitdiff
path: root/jobs
AgeCommit message (Collapse)Author
2017-04-02Renamed JobHttpType to more fitting HttpVerb; removed Job from enum valuesKitsune Ral
2017-04-02Rotten comments fixesKitsune Ral
2017-03-27Map QNetworkReply::UnknownContentError to BaseJob::IncorrectRequestErrorKitsune Ral
This is what /join returns if I supply garbage for the alias.
2017-03-25Jobs retry on network and timeout errorsKitsune Ral
As of now, the retry logic (see BaseJob::finishJob() method) invokes the same network request several times with increasing timeouts and retry intervals. Some additional signals and accessors are also provided to control the behaviour from inheriting classes (see a notable example with SyncJob in the same commit) and clients (support of retries in Quaternion comes in a respective commit shortly).
2017-03-24BaseJob: Add more error statesKitsune Ral
This should help to provide more reasonable error messages when a particular resource is not found or entered data are outright incorrect.
2017-03-16Log RoomMessagesJob's parametersKitsune Ral
2017-03-08Connection::callApi<>, a factory for all API call jobsKitsune Ral
This call (intended to only be used within the lib) creates a job object of the passed type and passes a ConnectionData pointer to its constructor. This allows to avoid making a switchboard of methods on Connection for the whole API, leaving only those that naturally belong there - e.g. joinRoom() or sync() - and moving, e.g., postMessage() to where it belongs - Room. PostMessageJob and RoomMessagesJob were updated along the way, to unbind from the Room class (which they really don't and won't need).
2017-02-28Room: Make sure an event with the same id isn't added twice to the timeline; ↵Kitsune Ral
forbid empty event id's Added assertions and enhanced debug messages along the way
2017-02-28Renamed logging_util.h to util.h and moved (improved) Owning<> and lookup() ↵Kitsune Ral
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).
2016-11-26CleanupKitsune Ral
2016-11-14Merge branch 'pragma-once'Kitsune Ral
2016-11-14Removed no more used filesKitsune Ral
2016-11-06Use #pragma once everywhereMalte Brandy
2016-11-01Removed unused codeKitsune Ral
These parts are either deprecated or just unlikely to be reused in the current form. Breaks Quaternion master as of now (it #includes logmessage.h).
2016-11-01Removed unused #includesKitsune Ral
2016-10-31Code cleanup upon inspection in CLionKitsune Ral
These changes are most harmless; a no more used Private class removed, and an incorrect signal specification in connect() fixed. Also, one explicit #include has been added, just in case.
2016-10-21Fixed building on VS2013Kitsune Ral
QJsonObject stock constructors are boring anyway - using QJsonObject::QJsonObject wasn't really necessary.
2016-10-17Changed the order of arguments in SyncJob::SyncJob()Kitsune Ral
2016-10-15BaseJob: Use saved parameters instead of overriding apiPath(), query() and ↵Kitsune Ral
data() in each job class
2016-10-14MediaThumbnailJob: Use QSize instead of two separate int's for sizeKitsune Ral
Connection::getThumbnail() is now overloaded to provide compatibility with the previous interface.
2016-10-11Merge pull request #32 from Fxrh/kitsune-memory-careFelix Rohrbach
Event objects leaks plugged
2016-10-11Removed long obsolete initialsyncjob.* files (fixes #37)Kitsune Ral
2016-10-07Fix building with VS2013Kitsune Ral
2016-10-07Fixed massive leaks of Event objectsKitsune Ral
2016-09-11Explicitly stop the timer in finishJob()Kitsune Ral
This should avoid timeout event catching up on a not-yet-deleted-but- already-invalid job object.
2016-09-08Fix MediaThumbnailJobFelix Rohrbach
As the url-path seems to start with a slash, we had two slashes in the request. This broke the feature for some servers, especially when fetching icons from other servers.
2016-09-06Connection: homeserver(); Connection and ConnectionData: accessToken(); ↵Kitsune Ral
accessors de-virtualized Details: - New: Connection::homeserver(), returns the homeserver URL from inside ConnectionData - New/Modify: Connection::accessToken() and ConnectionData::accessToken() - because we will also have refresh tokens eventually; deprecate token() for the same reason - Modify: Connection::user(), token(), accessToken() are no more virtual (they should have never been, these are plain accessors, after all)
2016-08-31QList<Event*> -> using Events=QVector<Event*>Kitsune Ral
2016-08-23Merge pull request #18 from Fxrh/kitsune-use-qvector-with-nonpointersFelix Rohrbach
Replaced QList<> with QVector<> where appropriate + minor code cleanup
2016-08-23CheckAuthMethods: fixed parseJson() to return some valueKitsune Ral
It's been a warning with GCC/Clang but an error with Visual Studio.
2016-08-23Merge pull request #15 from Fxrh/kitsune-dropped-kcoreaddonsKitsuneRal
Upon discussion with @Fxrh in #quaternion, this now comes in master,
2016-08-22Replaced QList<> with QVector<> where appropriate + minor code cleanupKitsune Ral
See https://marcmutz.wordpress.com/effective-qt/containers/ for the background and http://lists.qt-project.org/pipermail/development/2015-July/022283.html for the relevant flamewar in Qt dev mailing list.
2016-07-28CleanupKitsune Ral
Removed unused #includes, fixed incorrect #endif comment.
2016-07-28Fixed double-emission of signal(s) on job timeout + general cleanupKitsune Ral
2016-07-27Introduce Status class + BaseJob::{checkReply,parseReply,parseJson} now ↵Kitsune Ral
return it This better fixes the contract for derived job classes and simplifies error reporting. Methods error() and errorString() are kept for back-compatibility; status() returns a combination of them, conveniently packed into a Status object. For a quick status check, Status::good() is provided.
2016-07-26Split BaseJob::gotReply into checkReply and parseReply + internal tweaks to ↵Kitsune Ral
BaseJob 1. The externally (for derived classes) visible additions are checkReply() and parseReply() virtual methods, with gotReply becoming a mere dispatcher (and therefore a private method). Splitting gotReply() in that way allowed to remove boilerplate code from MediaThumbnailJob. 2. The internal tweak is using QScopedPointer<> to store pointers both to the Private object and to a QNetworkReply (with a special deleter that aborts the reply before destructing the object). This allows to remove desperate attempts to call reply->abort() wherever it's no more needed (and not aborting the in-flight replies seems to be a/the culprit of Quaternion after-exit hangs).
2016-07-26Rewritten BaseJob to not depend on KJob.Kitsune Ral
Some parts of the code were copied from the KCoreAddons sources - surprisingly few, in fact, mostly API with comments. With this commit, libqmatrixclient doesn't depend on KCoreAddons.
2016-07-26Added a missing #include.Kitsune Ral
2016-07-26Log creation/deletion of jobs (especially SyncJob)Kitsune Ral
Due to signal-slot processing it's not obvious when exactly each job object is deleted.
2016-07-22Introduced LogoutJobKitsune Ral
The job calls the /logout endpoint of CS API that invalidates the passed access_token; a respective Connection::logout() method and Connection::loggedOut() signal are added for use in clients.
2016-07-22Separate errors of access denial kind to a different BaseJob error code as ↵Kitsune Ral
well + stability fixes 1. Introduce ContentAccessDenied error code to BaseJob to allow clients to treat access denial errors differently from other network errors. 2. Since parseJson() overrides are responsible for calling emitResult(), the "default" BaseJob::parseJson() should call emitResult() as well. 3. Make sure BaseJob::fail() doesn't crash in absence of QNetworkReply.
2016-07-22Removed unneeded Q_OBJECT macros (slots don't require Q_OBJECT to work).Kitsune Ral
2016-06-02Merge pull request #10 from ilpianista/masterKitsuneRal
Relax the Qt requirements down to 5.2.0
2016-05-30Require Qt 5.2.0Andrea Scarpino
2016-05-27Use 'override' keyword throughout job classes; constify apiPath(), query(), ↵Kitsune Ral
data() Thanks to CLang model.
2016-05-27Set the object name for each job, to make it clear which job has failedKitsune Ral
And we don't need two log lines for timeouts.
2016-05-27Use nullptrKitsune Ral
2016-05-27Don't assign the token twiceKitsune Ral
In a case when authentication doesn't even happen, PasswordLogin job won't run. The better place to assign (and log) the token is in Connection::connectWithToken(), therefore.
2016-05-26Load a different set of event lists depending on the join state (and ↵Kitsune Ral
actually introduce EventList class) This makes loading of room events more compliant with the spec, not trying to load from keys that are not supposed to be there. As a result of refactoring along the way, a dedicated QList<Event*> subclass is made that remembers the JSON key it should load from and actually load itself from a QJsonArray.
2016-05-26Introducing EventList class + minor fixKitsune Ral
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.