Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Turns out it's been deprecated by -Wextra since before Quotient existed.
|
|
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.
|
|
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`.
|
|
After switching over to get_filename_component(PROGRAM) paths with
~ (home directory) were no more resolved. They are again.
|
|
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.
|
|
Implement the mxc protocol in the NetworkAccessManager
|
|
Allows images to be loaded using the NetworkAccessManager instead of an
ImageProvider
|
|
Also: drop olm from the LGTM build environment, it's of no use there
for now.
|
|
Also, refresh the documentation a bit.
|