aboutsummaryrefslogtreecommitdiff
path: root/connection.cpp
AgeCommit message (Collapse)Author
2017-12-29Use std::unique_ptr instead of bare pointers; cleanup stale declarationsKitsune Ral
2017-12-25Connection: Be more accurate with lambda capturesKitsune Ral
2017-12-21Connection::logout: supply receiver to connect(job,...)Kitsune Ral
2017-12-20Connection::accessToken - return QByteArray instead of QStringKitsune Ral
Because that's what it really is.
2017-12-19Don't use LoginJob::homeServer() anymoreKitsune Ral
Because the respective parameter in /login result is deprecated. Closes #137.
2017-12-16Connection: proactively create a Room object upon joining a roomKitsune Ral
So that clients could start using this object without waiting for the next sync.
2017-12-10Use the generated PostReceiptJob; don't compile unused job classesKitsune Ral
Rewire Connection::postReceipt() to the generated job too; this call is still deprecated though.
2017-12-10Log room creation only onceKitsune Ral
2017-12-10Fix setting the homeserver hostname (not URL) coming from /loginKitsune Ral
2017-12-07Connection: no more default to matrix.org; update HS URL from /login responseKitsune 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-11-26Make connectToServer/connectWithToken auto-resolve HS if neededKitsune Ral
"Needed" means when the current HS URL is invalid even by its outlooks. If it is just inaccessible, no attempt to fix things will be made. This breaks compatibility with previous library behaviour because connectWithToken historically has been fully synchronous and clients depend on that. connectWithToken _may_ work synchronously if HS URL is good enough; but this is no more guaranteed. Moreover, in the future the server will be probed via /versions before working, so connectWithToken will become entirely asynchronous.
2017-11-25Make Connection::resolveServer() work as it shouldKitsune Ral
Closes #119; many thanks to @r0kk3rz for prodding me into that.
2017-11-22Use unique_ptr for connectionDataKitsune Ral
2017-11-16Require state_key to be present in all state eventsKitsune Ral
This impacts the cache as well, as we don't save state_keys for most state events.
2017-11-16Automate cache resetsKitsune Ral
The idea is simple: store a version in the cache; if, upon the next load, the (major) version is too old, the cache is discarded. The currently used version values (0.0) do not discard the cache; but the next commit will bump the (major) version.
2017-11-02Document room transitions in .h instead of .cppKitsune Ral
The original comment got a bit rotten, so refresh it as well.
2017-10-31Fix Connection::deviceId(): Q_INVOKABLE is incompatible with referencesKitsune Ral
2017-10-27Put access token to headers instead of queryKitsune 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-15Connection::forgetRoom(): Minor fixesKitsune Ral
2017-10-14LogoutJob is supplied by generated codeKitsune Ral
2017-10-14Connection::forgetRoom()Kitsune 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-09-21Merge branch 'master' into kitsune-invite-kickKitsune Ral
2017-09-19Merge branch 'master' into cache-state-to-jsonKitsune Ral
2017-09-19Connection::cacheState property, load/saveState() tweaks and fixesKitsune Ral
The property controls whether or not the rooms state is cached: if it's off, loadState() and saveState() become no-ops. Other changes: * loadState/saveState properly deal with rooms in Invite state (this is not quite relevant to the current branch but very much is in the light of a concurrent kitsune-invite-kick PR); * Profile loadState/saveState (because dumping and especially parsing JSON takes time); * Use QJsonDocument::Compact layout, it's about 3 times smaller and quicker to parse than Indented, and we really don't care about the cache being human-friendly; * Have a default path for the state cache, based on the connection's user id.
2017-09-16provideRoom: Added invitedRoom() signal; fixed issues with some transitionsKitsune Ral
Notably: * setJoinState() invocation has been missing from the previous code * processing invites did not take into account that a Leave state may already exist, thereby forcing clients that display left rooms to look through their records just in case they have to replace a Leave with Invite. * joinedRoom() was emitted even when the room is not newly joined.
2017-09-16Better API for clients to catch up on room list changesKitsune Ral
joinedRoom() and leftRoom() now pass the preempted Invite state of the room as well; roomMap() only returns Invite and Join rooms, not Leave.
2017-09-09Kicking, inviting, exposing rooms in Invite stateKitsune Ral
Kicking and inviting use generated job classes. Rooms in Invite state are stored separately in the hash from those in Join/Leave state because The Spec says so. For clients, this means that the same room may appear twice in the rooms map if it's been left and then the user was again invited to it. The code in Quaternion that properly processes this will arrive shortly.
2017-09-08Connection: Room and User factories are std::functions nowKitsune Ral
Instead of createUser() and createRoom() virtual functions, use std::function<> to store predefined lambdas that would create respective descendants from User and Room, respectively. No more need QuaternionConnection just for the sake of creating a QuaternionRoom.
2017-09-04Use move on SyncDataRoman Plášil
2017-09-04Use SyncJob::SyncData as a plain memberRoman Plášil
2017-09-03More fixesRoman Plášil
2017-09-01Add Connection::leftRoom signalJosip Delic
2017-09-02Use status return type for parseJsonRoman Plášil
2017-08-27Remove saveStateFile property and just use an argument.Roman Plášil
2017-08-27Use QJsonObject.insert and QStringLiteralRoman Plášil
2017-08-23Use QUrl for state save file, create directory if it doesn't existRoman Plášil
2017-08-18Fix compilation for Qt 5.2.1Roman Plášil
2017-08-16Implement saving save to enable incremental sync even after shutdownRoman Plášil
2017-08-16WIP saving intermediate state to JSONRoman Plášil
2017-06-27Enable sending RoomMessageEventsKitsune Ral
1. PostMessageJob is now SendEventJob, which reflects two things: first, it's a PUT instead of a POST (POST for /send is not supported by the latest spec anyway), so that we could enable tracking transaction ids for local echo in the near future; second, it's no more just about messages, the job can support sending any room events (topic changes etc.). 2. Room::postMessage() now uses the new RoomMessageEvent API to send m.room.message events.
2017-06-22Connection is now able to generate transaction idsKitsune Ral
The generation algorithm doesn't support several Quaternions using the same accessToken, as of yet.
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-05-13More code cleanup and tweaks; fine-tuning logs; performance improvementsKitsune Ral
After adding some profiling it became clear that to recalculate the room name and emit namesChanged() upon each member event is a waste, especially when there are thousands of those coming at initial sync (*cough* Matrix HQ room). So the room name is recalculated only once and unconditionally (in most cases this will boil down to checking whether name/canonicalAlias changed after processing the events batch), and namesChanged is only emitted once per batch, if any name or alias changed.
2017-05-09LeaveRoomJob now accepts a roomId, not a Room object; Room::leaveRoom() ↵Kitsune Ral
introduced; Connection and Room cleanup Helps to better encapsulate Room
2017-05-09Code cleanup and tweaking (partially driven by clang-tidy)Kitsune Ral
Mainly it's about const-ification (in particular, passing const-refs instead of values) and deleting unneeded declarations/#includes. Since the changes alter the external interface, this is submitted as a PR for peer review. One of unneeded declarations/definitions is a virtual destructor in BaseJob descendants. Since a job object should be deleted through QObject::deleteLater() anyway (and it's the only correct way of disposing of the object), all deletions will call the stack of destructors through virtual QObject::~QObject(). Therefore even BaseJob could get on with a non-virtual destructor but for the sake of clarity BaseJob::~BaseJob() is still declared virtual.
2017-04-30Port to categorized loggingElvis Angelaccio
This greatly reduces the noise made by quaternion. To enable full logging, export the following variable: QT_LOGGING_RULES="libqmatrixclient.*.debug=true"
2017-03-25Split connectionError into networkError and syncErrorKitsune Ral
When SyncJob retries, networkError is emitted; if it fails entirely, either loginError or syncError, depending on the kind of failure.