aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.h
AgeCommit message (Collapse)Author
2022-05-16More work; Update olm pickle & timestamps in database; Remove TODOsTobias Fella
2022-05-16Save and load outgoing megolm sessionTobias Fella
2022-05-16Implement sending encrypted messagesTobias Fella
2022-05-14Cleanup across the boardAlexey Rusakov
Mainly driven by clang-tidy and SonarCloud warnings (sadly, SonarCloud doesn't store historical reports so no link can be provided here).
2022-04-09Prepare for MSC 3700Tobias Fella
2022-04-09Make sure devices are known before decrypting olm messagesTobias Fella
2022-03-07Store the device's ed25519 in the databaseTobias Fella
2022-02-26Add convenience functions for querying user devices and keys from cacheTobias Fella
2022-02-13Merge branch 'dev'Alexey Rusakov
The result is FTBFS as yet; next commits will fix that, along with a few other things.
2022-02-12Replace QPair with std::pairTobias Fella
2022-02-11Implement more suggestionsTobias Fella
2022-02-07Remove encryptionmanager and various fixesTobias Fella
2022-01-23Omittable: split out from util.h and refreshAlexey Rusakov
Improvements: - Quotient::lift() - a way to invoke a function on an optional (including Omittable) or a pointer if it's 'truthy'. Doesn't need enhanced function_traits<>, only the standard library; works on any number of arguments that can be dereferenced and casted to bool. - then() - the version of lift() as a member function. - edit() was renamed to ensure() (edit() might become a read-write counterpart of then() at some point). It's not really used across libQuotient codebase (or elsewhere) but is staying there just in case. It can also accept an initializer, removing the requirement of default-constructibility. - Quotient::merge() is simplified, with one universal implementation covering both Omittable/optional and plain values. - All that now lives in its dedicated pair of files, further decluttering util.h
2022-01-06Brush up SsoSession; document Connection::prepareForSsoAlexey Rusakov
Although parented to Connection, SsoSession was pretty leaky in that unsuccessful login attempts didn't delete the object and in some errors didn't even close the local HTTP socket (though new connections would no more be accepted). Also, without the documentation it wasn't clear who owns the object returned by Connection::prepareForSso(). Now it is. Unfortunately, it's not easy to cover SsoSession with tests. Basically, it takes a homeserver and a mock "SSO agent" that would check the SSO URL for validity and then both send the login authorisation to the homeserver as well as ping the callback given by SsoSession. Maybe for another time.
2022-01-02Add ImplPtr and makeImplAlexey Rusakov
The original (more complex and comprehensive) solution belongs to https://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html - this commit only provides a small wrapper for non-copyable Private class implementations common throughout libQuotient. Unlike the original, default initialisation is made explicit - you have to pass ZeroImpl<Private>() instead (and I firmly believe it's a good thing: normally pointers to Private should not remain nullptr). The reason ZeroImpl<> is not a template variable is quite simple: unique_ptr is non-copyable and so cannot be initialised from; while a template function will initialise the value in-place thanks to copy elision.
2022-01-02Manage symbols visibility for dynamic linkingAlexey Rusakov
2021-12-29Add QUOTIENT_API throughout non-generated codeAlexey Rusakov
This include all (hopefully) classes/structures and functions that have non-inline definitions, as well as namespaces with Q_NAMESPACE since those have non-inline (as of Qt 5.15) QMetaObject - for that a new macro, QUO_NAMESPACE, has been devised to accommodate the lack of Q_NAMESPACE_EXPORT in Qt before 5.14.
2021-12-28Convert struct LoginFlows to namespaceAlexey Rusakov
Because that's what it really is.
2021-12-27Connection: Simplify room/user factory codeAlexey Rusakov
There's no need to return lambdas where pointers to specialised function templates would work just fine.
2021-12-25Make canChangePassword available from QMLCarl Schwan
2021-12-10Use individual databases for each connectionTobias Fella
2021-12-07Rename "crypto" -> "e2ee"Tobias Fella
2021-12-01Apply more suggestionsTobias Fella
2021-12-01Add function to decrypt notificationsTobias Fella
2021-12-01Move non-cache data to a non-cache locationTobias Fella
2021-12-01Save olm account on shutdownTobias Fella
2021-12-01Add mxc protocol to the networkaccessmanagerTobias Fella
2021-12-01Implement download and decryption of encrypted filesTobias Fella
2021-12-01Store pickling key in qtkeychain and pickle encryptedTobias Fella
2021-12-01Fix build without E2EETobias Fella
2021-12-01Fix FTBFSTobias Fella
2021-12-01Fix everythingCarl Schwan
2021-12-01sslCarl Schwan
2021-12-01E2EE: initial port to internal olm wrapperAlexey Andreyev
Remove qtolm git module. Update CMakeLists.txt. Rename olm to crypto subdir to prevent disambiguation. Rename internal files accordingly. Comment out not ported E2EE API usage.
2021-10-13connection.h: more doc-commentsAlexey Rusakov
2021-09-10Move URL creation to Room/Connection; use query instead of fragmentAlexey Rusakov
The query is easier to manipulate; and the original mxc URL is not used for the real network request anyway.
2021-08-22Drop other stuff deprecated pre- or early 0.6Alexey Rusakov
BaseJob: StatusCode::JsonParseError Connection: resolved() and reconnected() signals; roomMap(); postReceipt() User: bridged() and rawName() ConnectionData: setHost() and setPort() StateEventBase: prev_content()
2021-07-18MembershipType -> Membership, also used for JoinStateAlexey Rusakov
Instead of being defined independently, JoinState now uses values from the Membership enumeration (former MemberEventContent::MembershipType) that was moved to quotient_common.h for that purpose. Both enumerations gained a Q_FLAG_NS decoration and operator<< overrides that strip "Quotient::" prefix when dumping member/join state values to the log - obviating toCString(JoinState) along the way. Quotient::MembershipType alias is deprecated from now.
2021-02-26Add public method to determine if we can change the user passwordCarl Schwan
2021-01-16Updated copyright statements upon Git auditKitsune Ral
After going through all the files and the history of commits on them it was clear that some copyright statements are obsolete (the code has been overwritten since) and some are missing. This commit tries best to remedy that, along with adding SPDX tags where they were still not used. Also, a minimal SPDX convention is documented for further contributions. Closes #426.
2021-01-15Merge pull request #428 from ognarb/licensingKitsune Ral
Port existing copyright statement to reuse using licensedigger
2020-12-28Connection: refactor the resolve/login codeKitsune Ral
1. resolveServer() now emits homeserverChanged() even when there's no .well-known file found. 2. checkAndConnect() entirely removed from the header file. 3. Sunny-day scenario for assumeIdentity() is now asynchronous, triggering a call to /whoami to double-check the user. 4. LoginFlow aliases is moved out from LoginFlows to Quotient namespace.
2020-12-28More comments/documentationKitsune Ral
Notably, recommend using loginFlowsChanged() rather than homeserverChanged() to detect when a Connection object is ready for a login sequence. Related: #427.
2020-12-26Port existing copyright statement to reuse using licensediggerCarl Schwan
2020-11-27Make it compile with QT_NO_KEYWORDSCarl Schwan
2020-09-04Fixes of clazy warningsKitsune Ral
2020-08-03CleanupKitsune Ral
2020-06-19Revert adding a pause between syncs, use sane timeout defaultsKitsune Ral
This reverts commit b1071cf34b86685c3cdb5004d6112881966a7ce6. Passing -1 to sync() and, respectively, to SyncJob does not add any timeout; however, careful reading of the spec reveals that the default value for the timeout (0) means to return as soon as possible, not as late as possible. As a consequence, syncLoop() without parameters initiates a sync polling frenzy, with the client sending a new request as soon as the previous returns, while the server returns the request as soon as it practically can, not as soon as another event for the client comes around. To fix this, the default value for syncLoop() is changed to 30 seconds. The recently added msecBetween parameter is abolished; we really don't want to steer people to classic polling from long polling.
2020-06-14quotient_common.h for common namespace thingsKitsune Ral
The two main cases for this header file are: * namespace QMatrixClient = Quotient should occur exactly once, to respect ODR. * Q_NAMESPACE for namespace Quotient (to enable Q_ENUM_NS, particularly) must be defined exactly once, for the same reason.
2020-06-12Connection::isLoggedIn() and more robust logout()Kitsune Ral
isLoggedIn() is just a wrapper around Connection::accessToken() that returns whether it's not empty. Now, Connection::accessToken() and Connection::logout() are changed in such a way that if there's a logout job ongoing Connection::accessToken() will return an empty value even though the access token is still stored in ConnectionData. This gives a hint to the rest of Connection and to the client code that the user is not quite authenticated anymore. Finally, syncLoop() and sync() have been altered to check isLoggedIn() before proceeding with their network request.