aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
AgeCommit message (Collapse)Author
2022-05-16Expected<>Alexey Rusakov
This is a minimal implementation along the lines of `std::expected<>` introduced in C++23; once compilers catch up with C++23 support, it may become simply a typedef of std::expected. There are no tests as yet; but the following commits will introduce QOlmExpected that would replace the current `std::variant<T, QOlmError>` pattern used throughout `QOlm*` classes, automatically pulling Expected under the coverage of `QOlm*` unit tests.
2022-05-08toSnakeCase and EventContent::SingleKeyValueAlexey Rusakov
This is a rework of EventContent::SimpleContent previously defined in simplestateevents.h. Quite a few events (and not only state events) have just a single key-value pair in their content - this structure (which is really just a template wrapper around the value) and the accompanying JsonConverter<> specialisation encapsulate the concept to streamline definition of such events. This commit only has simplestateevents.h using it; further commits will use SingleKeyValue in other places. toSnakeCase is a facility function that converts camelCase used for C++ variables into snake_case used in JSON payloads. Combined with the preprocessor trick that makes a string literal from an identifier, this allows to reduce boilerplate code that repeats the same name for fields in C++ event classes and fields in JSON. SingleKeyValue uses it, and there are other cases for it coming.
2022-05-04CMakeLists.txt: add roomcanonicalaliasevent.hAlexey Rusakov
Yet another missing header from times when .h files weren't added to CMakeLists.
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-07Remove encryptionmanager and various fixesTobias Fella
2022-01-23Move away Omittable static tests to autotests/Alexey Rusakov
These are not required to build libQuotient, and omittable.cpp entirely consisted of them.
2022-01-23RoomStateViewAlexey Rusakov
This class is called to provide an arbitrary snapshot of a room state; as the first step, Room::currentState() returns an instance of this class that stores, well, the current state. Implelementation-wise it's the same hash map of two-part state event keys to const event pointers; however, RoomStateView provides additional operations: - get(), that deprecates Room::getCurrentState(), returns a pointer to a particular event if the current state has it. Unlike the original method, the pointer returned from this one can be nullptr; this is done to get rid of stubbed state events that have to be created everytime a "state miss" occurred (i.e., when getCurrentState() does not find an existing event in the current state). - eventsOfType() - this is a new place for Room::stateEventsOfType() introduced recently. - query() - this is a way to specify a piece of the state content that you need to retrieve by passing a member function or a function object that retrieves it. That is especially convenient with member functions of the event class; just pass the pointer to this member function, and query() will parse the event type it has to retrieve out of it and call that member function on the event object. Returns an Omittable<>; if the respective piece of state doesn't exist, you'll get `Quotient::none` (the same as `std::nullopt`). - queryOr() - the same but with the fallback value; instead of an Omittable<>, the fallback value will be returned if the needed event is not found.
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-21Merge: merge event relation structures into oneAlexey Rusakov
2022-01-21Redo EventRelation; deprecate RelatesToAlexey Rusakov
RelatesTo and EventRelation have been two means to the same end in two different contexts. (Modernised) EventRelation is the one used now both for ReactionEvent and EventContent::TextContent. The modernisation mostly boils down to using inline variables instead of functions to return relation types and switching to QLatin1String from const char* (because we know exactly that those constants are Latin-1 and QLatin1String is more efficient than const char* to compare/convert to QString).
2022-01-19CMakeLists: Bring back ARCHIVE DESTINATION in install()Alexey Rusakov
The older CMake used by LGTM is still unhappy without it. (See also recent changes to this file.)
2022-01-05CMakeLists: add install(TARGETS) components againAlexey Rusakov
Older CMake versions fail if they don't find those (LGTM uses CMake 3.13 and that one does, at least).
2022-01-01CMakeLists: Drop unneeded parts from install(TARGETS)Alexey Rusakov
Those DESTINATION specifications match precisely what CMake does by default (on Linux at least); what's worse is that they prevent CMake to install the DLL file on Windows.
2021-12-29CMakeLists.txt: apply -fvisibility=hiddenAlexey Rusakov
Also, -fvisibility-inlines-hidden is applied in a CMake-native way now. As can be expected, BUILDING_SHARED_QUOTIENT is set when a dynamic library is built while QUOTIENT_STATIC is set whenever static libQuotient is around (both for building it and for building with it).
2021-12-29Introduce quotient_export.hAlexey Rusakov
Instead of using CMake's generate_export_header macro, it's a bit easier to maintain a static file (that is not supposed to ever change) with necessary export/import/hidden visibility macros.
2021-12-24Apply suggestionsTobias Fella
2021-12-24Prune empty/ish call*event.cpp filesAlexey Rusakov
2021-12-24Find sql when using libquotientTobias Fella
2021-12-21Add event_loader.h to CMakeListsAlexey Rusakov
Another forgotten header file.
2021-12-09Ifdef all the thingsTobias Fella
2021-12-07Rename "crypto" -> "e2ee"Tobias Fella
2021-12-07Port E2EE to database instead of JSON filesTobias Fella
2021-12-03Add a couple of bare .h files to CMakeLists.txtAlexey Rusakov
These were missing from the commit introducing .h files to sources, highlighting the reason why .h files should be there...
2021-12-03Rely on GTAD 0.9 that calls clang-format itselfAlexey Rusakov
There was that ugly workaround in CMakeLists.txt to produce the list of files to be formatted and making a separate build target for clang-format. As GTAD 0.9 calls clang-format itself this workaround is no more necessary; generate-unformatted-api and format-api build targets are now gone, and clang-format is no more one-build-system-configuration behind GTAD on the list of files to handle.
2021-12-03CMakeLists.txt: add .h files to sourcesAlexey Rusakov
This is driven by the change in the way Qt Creator 6 works with CMake (see https://www.qt.io/blog/qt-creator-6-cmake-update) that basically requires you to explicitly add header files as source files. While this obviously added to the size of the source files list, it also drove dropping the repeated file(GLOB_RECURSE ... CONFIGURE_DEPENDS) call which added a considerable speedbump to the beginning of each build (now that call is just one).
2021-12-02Improve function_traits<>; split out from util.*Alexey Rusakov
Quotient::function_traits<> did not support member functions in a proper way (i.e. the way std::invoke_result<> treats them, with the function's owning class represented as the first parameter). Now that I gained the skill and understanding in function_traits<> somewhat wicked machinery, I could properly support member functions. Overloads and generic lambdas are not supported but maybe we'll get to those one day.
2021-12-01Fix compilationCarl Schwan
2021-12-01Store pickling key in qtkeychain and pickle encryptedTobias Fella
2021-12-01Only build the encryptionmanager when encryption is enabledTobias Fella
2021-12-01Implement key verification eventsCarl Schwan
2021-12-01Ifdef E2EE out at cmake levelTobias Fella
2021-12-01Fix cmake codeCarl Schwan
2021-12-01Key verificationCarl 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-12-01Move filesCarl Schwan
2021-12-01Fix CICarl Schwan
2021-12-01E2EE: Introduce session (WiP)Alexey Andreyev
2021-12-01Improve APICarl Schwan
2021-12-01Depends on OpenSSL for crypo randCarl Schwan
2021-12-01Implement outboundsessionCarl Schwan
2021-12-01Start implementing Qt olm bindingCarl Schwan
2021-11-28CMakeLists: drop obsolete -W from the warnings listAlexey Rusakov
Turns out it's been deprecated by -Wextra since before Quotient existed.
2021-11-21EventStats and Room::partiallyRead/unreadStats()Alexey Rusakov
This introduces a new API to count unread events that would allow to obtain those unread and highlight counts since either the fully read marker (Room::partiallyReadStats) or the last read receipt (Room::unreadStats). Element uses the read receipt as the anchor to count unread numbers, while Quaternion historically used the fully read marker for that (with the pre-0.7 library sticking the two markers to each other). From now on the meaning of "unread" in Quotient is aligned with that of the spec and Element, and "partially read" means events between the fully read marker and the local read receipt; the design allows client authors to use either or both counting strategies as they see fit. Respectively, Room::P::setFullyReadMarker() updates partially-read statistics, while Room::P::setLastReadReceipt(), when called on a local user, updates unread statistics. Room::notificationCount() and Room::highlightCount() maintain their previous meaning as the counters since the last read receipt; Room::notificationCount() counts unread events locally, falling back to the value from the above-mentioned key defined by MSC2654, and if that is not there, further to `unread_notifications/notification_count` defined in the current spec. Room::highlightCount(), however, is still taken from the homeserver, not from Room::unreadStats().highlightCount.
2021-11-19Make enum values logging more terse()Alexey Rusakov
By default enum class values are logged along with the qualifier; this may or may not be desirable in a given setting. For JoinState(s) and Membership(Mask) operator<< was overloaded to implicitly suppress qualification; however, this is both overly sweeping and uses Qt's internal API for the backend. Instead, a new QDebug manipulator, terse(), is introduced, that does the same as those operator<< overloads but on a per-invocation basis. This makes it slightly more verbose to log enums but makes the QDebug reconfiguration explicit and doesn't require to produce new overloads every time a new enum ends up in logs. And it's built entirely on the published Qt API, reusing the QDebugManip framework that Quotient already has. Also: operator<<(QDebug, QDebugManip) has been moved out of the namespace to fix lookup issues when there's no prior `using namespace Quotient`.
2021-10-13CMakeLists: more robust GTAD_PATH detectionAlexey Rusakov
After switching over to get_filename_component(PROGRAM) paths with ~ (home directory) were no more resolved. They are again.
2021-10-13CMakeLists: don't report that update-api is enabled when it's actually notAlexey Rusakov
add_feature_info() treats unset variable as "no change" rather than "false", which may lead to a confusing build configuration report when GTAD_PATH and/or MATRIX_DOC_PATH and/or CLANG_FORMAT have been there before but were removed since.
2021-09-12Merge pull request #499 from TobiasFella/mxcnamAlexey Rusakov
Implement the mxc protocol in the NetworkAccessManager
2021-09-05Implement the mxc protocol in the NetworkAccessManagerTobias Fella
Allows images to be loaded using the NetworkAccessManager instead of an ImageProvider
2021-09-03Tacitly allow CMake 3.13 to keep LGTM workingAlexey Rusakov
Also: drop olm from the LGTM build environment, it's of no use there for now.
2021-09-03Require CMake 3.16; drop qmake; use C++20 and newer compilersAlexey Rusakov
Also, refresh the documentation a bit.