Age | Commit message (Collapse) | Author |
|
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.
|
|
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
|
|
|
|
...meaning, clients have to compile in C++20 mode too from now.
|
|
|
|
Load and store accounts in the keychain
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
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.
|
|
Yet another missing header from times when .h files weren't added to
CMakeLists.
|
|
The result is FTBFS as yet; next commits will fix that, along with a few
other things.
|
|
|
|
These are not required to build libQuotient, and omittable.cpp entirely
consisted of them.
|
|
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.
|
|
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
|
|
|
|
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).
|
|
The older CMake used by LGTM is still unhappy without it. (See also
recent changes to this file.)
|
|
Older CMake versions fail if they don't find those (LGTM uses CMake 3.13
and that one does, at least).
|
|
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.
|
|
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).
|
|
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.
|
|
|
|
|
|
|
|
Another forgotten header file.
|
|
|
|
|
|
|
|
These were missing from the commit introducing .h files to sources,
highlighting the reason why .h files should be there...
|
|
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.
|
|
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).
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|