aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-07-08Use clang-format 12; update CONTRIBUTING.md wrt code formattingAlexey Rusakov
[skip ci]
2022-07-08Merge remote-tracking branch 'origin/kitsune/c++20-galore' into devAlexey Rusakov
2022-07-08Adjust Synapse image for testsAlexey Rusakov
:latest stopped working for some reason.
2022-07-08CI: use GCC 11 and (therefore) ubuntu-22.04Alexey Rusakov
GCC 10 ICE's[1] in qt_connection_util.h code; and ubuntu-20.04 doesn't have GCC 11. Also: patch a Qt 5.15 header when compiling with GCC because a combination of Qt 5.15 and GCC 11 in turn triggers QTBUG-91909/90568... Which in turn required moving Qt setup before the build environment setup. Life's fun. [1] Internal Compiler Error
2022-07-07Avoid std::derived_from and std::bind_frontAlexey Rusakov
Apple Clang doesn't have those yet.
2022-07-03Shorten switchOnType, function_traits and connect*Alexey Rusakov
...thanks to C++20 awesomeness. A notable change is that wrap_in_function() (and respectively function_traits<>::function_type) and fn_return_t alias are gone. The former are no more needed because connectUntil/connectSingleShot no more use std::function. The latter has been relatively underused and with the optimisation of switchOnType hereby, could be completely replaced with std::invoke_result_t. Rewriting connect* functions using constexpr and auto parameters made the implementation 30% more compact and much easier to understand (though still with a couple of - now thoroughly commented - tricky places). Dropping std::function<> from it may also bring some (quite modest, likely) performance benefits.
2022-06-24Make EventContent::Base() move constructor noexceptAlexey Rusakov
2022-06-24Fix the just introduced Sonar warningAlexey Rusakov
Too many parameters of the same type in a row.
2022-06-24Start using C++20's designated initializersAlexey Rusakov
2022-06-24Code cleanup and reformattingAlexey Rusakov
2022-06-24Rework SignedOneTimeKey as a QJsonObject wrapperAlexey Rusakov
Since this object has to be verified against a signature it also carries there's a rather specific procedure described in The Spec for that. That procedure basically assumes handling the signed one-time key object as a JSON object, not as a C++ object. And originally Quotient E2EE code was exactly like that (obtaining the right QJsonObject from the job result and handling it as specced) but then one enthusiastic developer (me) decided it's better to use a proper C++ structure - breaking the verification logic along the way. After a couple attempts to fix it, here we are again: SignedOneTimeKey is a proper QJsonObject, and even provides a method returning its JSON in the form prepared for verification (according to the spec).
2022-06-24Fix copy-pasta in signed one-time key JSON dumperAlexey Rusakov
2022-06-23Streamline Room::P::shouldRotateMegolmSession()Alexey Rusakov
Now there's only 1 instead of 5 lookups of the same EncryptionEvent, and the code is shorter.
2022-06-23Use QUO_CONTENT_GETTERAlexey Rusakov
In keyverificationevent.*, this massively shortens repetitive getter definitions; the remaining few non-trivial ones are moved to keyverificationevent.h, dropping the respective .cpp file and therefore the dedicated translation unit. In roomkeyevent.h, it's just shorter.
2022-06-23Drop QUOTIENT_API where it's undueAlexey Rusakov
2022-06-22Fix signature verificationAlexey Rusakov
toJson(SignedOneTimeKey) incorrectly generated a "signatures" key mapped to an empty object when no signatures were in the C++ value. Also: fallback keys have an additional flag that also has to be taken into account when verifying signatures.
2022-06-22.clang-tidy: drop another rather useless warningAlexey Rusakov
'performance-no-automatic-move' triggers on code where copy elision normally takes place anyway. In fact, all cases it triggered on were also subject to named return value optimisation (NRVO). [skip ci]
2022-06-22RoomSummary::merge(): explicitly cast between int and boolAlexey Rusakov
Honestly, it was quite intuitive even without that, but in reality there are implicit conversion under the wraps. This commit makes them explicit, for clarity.
2022-06-22Streamline RoomPowerLevelsEvent backoffice codeAlexey Rusakov
Also: leave a link at the place in the spec with power level defaults to make it clear they are not invented out of thin air.
2022-06-22Address a few more Sonar warningsAlexey Rusakov
2022-06-22Clean up RequestData from Sonar warningsAlexey Rusakov
Also: make ImplPtr more flexible.
2022-06-22Use fixed width types for enumsAlexey Rusakov
2022-06-22More .clang-tidy tweaksAlexey Rusakov
2022-06-21Fix a few clang-tidy/GCC warningsAlexey Rusakov
2022-06-21CMakeLists: suppress subobject-linkage warningsAlexey Rusakov
GCC (even 12.x) doesn't like when a template parameter is of a pointer/reference type and dumps this warning. See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90670
2022-06-21.clang-tidy: drop some dubious noisy warningsAlexey Rusakov
2022-06-21Move out Overloads to util.hAlexey Rusakov
...instead of tucking the template in filesourceinfo.cpp where it surely will be forgotten.
2022-06-21room.cpp: replace two signal connections with oneAlexey Rusakov
2022-06-19Add a missing #includeAlexey Rusakov
2022-06-19CI: fix macos-10.15 leftoverAlexey Rusakov
2022-06-18CI: switch to macos-11 imageAlexey Rusakov
2022-06-18Move C++-only macros to util.hAlexey Rusakov
This pertains to QUO_IMPLICIT and DECL_DEPRECATED_ENUMERATOR - both can be used with no connection to Qt meta-type system (which is what quotient_common.h is for).
2022-06-18Drop make_array(); use std::to_array() where neededAlexey Rusakov
make_array() has been introduced to cover for shortcomings on macOS and Windows. These shortcomings are no more there, so we can just use the standardrlibrary.
2022-06-18Drop pre-Qt 5.15 codeAlexey Rusakov
2022-06-18Regenerate API files upon the previous commitAlexey Rusakov
2022-06-18operation.cpp.mustache: streamline RequestData constructionAlexey Rusakov
That `std::move(_data)` never worked because the passed object is a precursor to RequestData, and RequestData always takes things by const-ref or by value, never by rvalue. Also, explicit mention of RequestData is unnecessary, as its constructors are implicit by design.
2022-06-18Replace LGTM badge with GHA/SonarAlexey Rusakov
Also: add a Matrix chat badge. [skip ci]
2022-06-17Merge #562: Build with Qt 5.15 and Qt 6Alexey Rusakov
2022-06-17CMakeLists and elsewhere: require Qt 5.15Alexey Rusakov
2022-06-17Further fix building with Qt 6Alexey Rusakov
Also: build with Qt 6 first, so that it fails sooner.
2022-06-17Make Connection::sendToDevices() an actual slotAlexey Rusakov
Although Qt 5 didn't complain about that, you could never really use sendToDevices() in its slot (or even invocable) capacity because Qt's meta-type system could not handle move-only UsersToDevicesToEvents. Qt 6 is more stringent; the build fails at trying to instantiate QMetaType for that type (with a rather unhelpful error message thrown by Clang, and more helpful but very verbose diagnostic from MSVC) because it does not provide a copy constructor. However, sendToDevice doesn't really need to have full-blown events in that parameter; just the content of the event is equally fine. This commit does exactly that: replaces UsersToDevicesToEvents with UsersToDevicesToContent that contains QJsonObject's instead of EventPtr's. The code around is updated accordingly. Also: factor out the key event JSON creation from makeMessageEventForSessionKey() because it's the same JSON for each target device; the function therefore is called encryptSessionKeyEvent() now.
2022-06-15Rearrange CI jobs to spend time more efficientlyAlexey Rusakov
- CodeQL analysis was executed on every job that ran Clang, humping the total execution time by 10+ minutes alone. Now it only runs on a single job. - libolm is no more compiled but installed from the repo, along with libssl-dev; and both are installed in the same transaction as ninja and valgrind, shaving out one apt transaction - One more Windows job has been added to test building with Qt 6.3.1 on that OS. - Qt version is pushed earlier in the job matrix, as it becomes more significant than the compiler for a given platform.
2022-06-14CI: Switch to Qt 5.15 and introduce Qt 6 optionsAlexey Rusakov
Qt 6 builds are allowed to fail for now.
2022-06-14CI: bump used versions for GitHub ActionsAlexey Rusakov
Also, use MSVC 2019 on Windows.
2022-06-14Stop using LGTM.comAlexey Rusakov
Its platform has been lagging behind most of the time; but more importantly, the value from its analysis is almost non-existent, with just one considerable issue being identified over the recent year if not more. These days we have clang-tidy and Sonar that are much better at static code analysis. [skip ci]
2022-06-14Add .clang-tidy fileAlexey Rusakov
[skip ci]
2022-06-13Refresh documentationAlexey Rusakov
CONTRIBUTING.md got bitrotten in quite a few places. [skip ci]
2022-06-12Merge branch 'kitsune/more-gtad-fixes' into devAlexey Rusakov
2022-06-12Reduce the number of CI jobsAlexey Rusakov
It takes well over an hour to build the whole lineup for now; while the single right fix for that is making quotest capable of running in parallel, a few GCC jobs can be safely dropped for now (and we'll see if they should be brought back when parallel quotest unleashes the CI).
2022-06-12Require CMake 3.16; extend C++20 to headersAlexey Rusakov
...meaning, clients have to compile in C++20 mode too from now.