aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2022-06-08Save connection state while QCoreApplication is still thereAlexey Rusakov
This reimplements #558 in a more reliable way. Deconstruction of AccountRegistry may (or may not, yay for static initialisation) occur after deconstruction of QCoreApplication, in which case an attempt to determine the directory for the state fails because it depends on the application object existence.
2022-06-06Regenerate API filesAlexey Rusakov
This only updates 3 files affected by the change in the previous commit.
2022-06-04Address Sonar warningsAlexey Rusakov
2022-06-02Merge pull request #560 from TobiasFella/createnewsessionwhenuserleavesAlexey Rusakov
2022-06-01Immediately create a new megolm session when user leaves instead ofTobias Fella
deferring until sending event
2022-06-01Merge pull request #559 from TobiasFella/removeaccountsloadingAlexey Rusakov
2022-06-01#554: Fix update-api jobsAlexey Rusakov
2022-06-01Fix FTBFS after the mergeAlexey Rusakov
2022-05-31Remove accounts from accountsLoading when they're no longer loadingTobias Fella
2022-05-31Merge branch 'dev' into update-api-updateAlexey Rusakov
2022-05-31Fix Room::getPreviousContent() to match new CS APIAlexey Rusakov
There was a fairly nasty change where `from` parameter in /messages became optional and that led to two QString parameters (`from` and `dir) switching positions. Because they have the same type, the problem only shows at runtime. This commit fixes Room::getPreviousContent() to pass the parameters at right positions; client code won't feel anything (unless it uses GetRoomEventsJob directly).
2022-05-31Tweak QOlmAccount and data structures aroundAlexey Rusakov
This is mainly to plug the definition of a string-to-variant map for one-time keys (see https://spec.matrix.org/v1.2/client-server-api/#key-algorithms) into the CS API generated code (see the "shortcut OneTimeKeys" commit for gtad.yaml); but along with it came considerable streamlining of code in qolmaccount.cpp. Using std::variant to store that map also warranted converters.h to gain support for that type (even wider than toJson() that is already in dev - a non-trivial merge from dev is in order).
2022-05-31Regenerate API files (FTBFS; see the next commit)Alexey Rusakov
2022-05-31#558: Save connection state when destructing accountregistryAlexey Rusakov
2022-05-31AccountRegistry: fix dropping an inexistent ConnectionAlexey Rusakov
On Debug builds this would lead to an assertion failure inside Qt.
2022-05-31Save connection state when destructing accountregistryTobias Fella
2022-05-30Cleanup and reformattingAlexey Rusakov
2022-05-30Emit loggedOut() after the access token is goneAlexey Rusakov
...not before.
2022-05-30Merge pull request #555 from TobiasFella/accountskeychainAlexey Rusakov
Load and store accounts in the keychain
2022-05-29Also reemit resolveErrorTobias Fella
2022-05-29Error handlingTobias Fella
2022-05-29Apply suggestions from code reviewTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-05-29Move some Meg/Olm session logic from Room::Private to Connection::PrivateAlexey Rusakov
Functions (Room::Private::)createOlmSession, payloadForUserDevice and sendRoomKeyToDevices don't have a lot to do with the given Room object but deal with quite a few things stored in Connection. This commit moves them to Connection::Private, exposing sendSessionKeyToDevices (the new name for sendRoomKeyToDevices) in Connection so that Room could call it from Room::P::sendMegolmSession(). While moving these over, a few additional things were adjusted: - more functions marked as const - a few functions could be moved now from Connection to Connection::Private - false slots in Connection (such as picklingMode) are moved out of the slots block - keys.yml in Matrix CS API definitions has been adjusted to match the real structure of `/claim` response (see quotient-im/matrix-spec repo); csapi/keys.h has been regenerated accordingly.
2022-05-29Refactor creation of Megolm sessions in RoomAlexey Rusakov
Notably, replace a multi-level hash map with QMultiHash and factor out Room::P::createOlmSession().
2022-05-29Cleanup and address Sonar warningsAlexey Rusakov
2022-05-29DownloadFileJob: refactor file decryptionAlexey Rusakov
2022-05-29Move encryptFile/decryptFile out of EncryptedFileMetadataAlexey Rusakov
These are not operations on EncryptedFileMetadata but rather on a combination of EncryptedFileMetadata and ciphertext. If C++ had multimethods these could be bound to such a combination.
2022-05-29Cleanup and fix Sonar warningsAlexey Rusakov
2022-05-29Refactor EncryptedFile and EC::FileInfo::fileAlexey Rusakov
Besides having a misleading name (and it goes back to the spec), EncryptedFile under `file` key preempts the `url` (or `thumbnail_url`) string value so only one of the two should exist. This is a case for using std::variant<> - despite its clumsy syntax, it can actually simplify and streamline code when all the necessary bits are in place (such as conversion to JSON and getting the common piece - the URL - out of it). This commit replaces `FileInfo::url` and `FileInfo::file` with a common field `source` of type `FileSourceInfo` that is an alias for a variant type covering both underlying types; and `url()` is reintroduced as a function instead, to allow simplified access to whichever URL is available inside the variant. Oh, and EncryptedFile is EncryptedFileMetadata now, to clarify that it does not represent the file payload itself but rather the data necessary to obtain that payload.
2022-05-27Load and store accounts in the keychainTobias Fella
2022-05-20Merge pull request #553 from TobiasFella/work/fixencryptionAlexey Rusakov
Truncate ciphertext buffer to actual size during file encryption
2022-05-20Apply suggestions from code reviewTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-05-20Truncate ciphertext buffer to actual size during file encryptionTobias Fella
The ciphertext for AES CTR is exactly as large as the plaintext (not necessarily a multiple of the blocksize!). By truncating the ciphertext, we do not send bytes that will be decrypted to gibberish. As a side node, we probably do not need to initialize the ciphertext buffer larger than the plaintext size at all, but the OpenSSL docs are a bit vague about that.
2022-05-19Add function to check if e2ee is supportedTobias Fella
2022-05-19Fix cipher text buffer initializationTobias Fella
2022-05-19Fix FTBFS without E2EEAlexey Rusakov
2022-05-19Document devices tupleTobias Fella
2022-05-19Apply suggestionsTobias Fella
2022-05-19Apply SuggestionsTobias Fella
2022-05-19Update lib/room.cppTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-05-19Use list of 3-tuple instead of mapTobias Fella
2022-05-18Make database independent of {Room, User, Connection}Tobias Fella
2022-05-18Update lib/events/encryptedevent.cppTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-05-18Apply suggestions from code reviewTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-05-16Fix build failuresTobias Fella
2022-05-16FixesTobias Fella
2022-05-16Add database migrationTobias Fella
2022-05-16Update lib/events/encryptedfile.hTobias Fella
2022-05-16More work; Update olm pickle & timestamps in database; Remove TODOsTobias Fella
2022-05-16Properly create encrypted editsTobias Fella