aboutsummaryrefslogtreecommitdiff
path: root/lib/events/encryptedevent.cpp
AgeCommit message (Collapse)Author
2022-07-12fromJson()/toJson() refactoringAlexey Rusakov
fromJson() is generalised to accept any JSON-like type while passing QJsonObject to JsonConverter<>::load (instead of doLoad). This allows to (still) rely on JsonConverter<> as a customisation point while providing an opportunity to overload fromJson for custom types in a pointed way (specifically, by providing the overload for `fromJson(const QJsonObject&)`), instead of having to go with full-blown JsonConverter<> specialisation. This will be used in a further commit to simplify ReceiptEvent definition. Using if constexpr in combination with constraints (`requires()`) - the first such case in Quotient codebase - allowed to put the entire logic in a single JsonConverter<>::load() body instead of having a facility JsonExporter<> class for SFINAE. Aside from that, fromJson<QJsonValue, QJsonValue> is entirely dropped because it's not supposed to be used that way (it's no-op after all); reflecting that, Event::unsignedPart() and Event::contentPart() no more default to QJsonValue as the expected return type, you have to explicitly provide the type instead (and as one can see from the changes in the commit, it's actually better that way since it's better to validate the value inside JSON - e.g. check QString or QJsonObject for emptiness - than the QJsonValue envelope which may still wrap an empty value). toJson() is also generalised, replacing 3 functions with one that has a constexpr if to discern between two kinds of types.
2022-05-18Update lib/events/encryptedevent.cppTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-05-16Properly create encrypted editsTobias Fella
2022-02-16isSupportedAlgorithm()Alexey Rusakov
That's a better primitive than just exposing SupportedAlgorithms list.
2022-02-16CleanupAlexey Rusakov
A note on switching to QLatin1String for JSON key constants - this is more concise and barely affects (if at all) runtime performance (padding each QChar with zeros is trivial for assignment; and comparison can be done directly with the same performance as for two QStrings).
2021-12-07Port E2EE to database instead of JSON filesTobias Fella
2021-12-01Apply suggestions from code reviewTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2021-12-01Apply even more suggestionsTobias Fella
2021-11-26Revert "Drop #include "logging.h" from event.h"Alexey Rusakov
Doesn't really help build times, instead breaking the build on older Qt.
2021-11-26Drop #include "logging.h" from event.hAlexey Rusakov
Makes compilation a tad lighter.
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.
2020-12-27more :)Carl Schwan
2020-11-15Cleanup across event classesKitsune Ral
In particular: removed unnecessary #includes, deprecated and no more used constructs, replaced stored members with dynamic generation from JSON (TypingEvent and, especially promising for performance, ReceiptEvent)
2020-02-25E2EE: EncryptedEvent constructor debug messageAlexey Andreyev
Signed-off-by: Alexey Andreev <aa13q@ya.ru>
2019-08-11CleanupKitsune Ral
[skip ci]
2019-08-02Merge branch 'master' into use-clang-formatKitsune Ral
2019-07-27E2EE: introduce EncryptedEventAlexey Andreyev