Age | Commit message (Collapse) | Author |
|
For EncryptedFile:
- JSON converter bodies moved away to .cpp;
- instead of C-style casts, reinterpret_cast is used to convert from
(const) char* to (const) unsigned char*;
- the size for the target plain text takes into account the case where
the cipher block size can be larger than 1 (after reading
https://www.openssl.org/docs/man1.1.1/man3/EVP_DecryptUpdate.html).
- file decryption is wrapped in #ifdef Quotient_E2EE_ENABLED, to avoid
OpenSSL linking errors when compiling without E2EE.
|
|
The result is FTBFS as yet; next commits will fix that, along with a few
other things.
|
|
|
|
SyncData can load room objects out-of-line. This is only expected when
loading data from the cache (and since quite long ago, the cache always
saves room objects out of line, avoiding too large JSON payloads that
Qt parser chokes on). However, the code processed /sync response in
the same way; in particular, this meant that SyncData filled the vector
of unresolved room ids even when it came from /sync. SyncJob then looked
at this vector and entered an error state if it was not empty. Well,
payloads from the wire can be weird and it ultimately came to pass that
a homeserver returned a non-object against a given room key, triggering
the unresolved rooms branch in SyncJob - and stalling the whole sync
loop as a result (https://invent.kde.org/network/neochat/-/issues/500).
With this commit SyncData only fills unresolvedRoomIds when loading
rooms from the cache (with the implied fallback of discarding the cache
and loading from /sync anew instead). Respectively, SyncJob must never
end up with SyncData that has unresolved rooms (even if those occur
in the actual payload like in the mentioned issue, those rooms will be
completely empty instead); the added assertion only guards for internal
consistency.
|
|
|
|
- Templates and constexpr imply inline
- A function called from a single site better be inlined.
|
|
|
|
The original (more complex and comprehensive) solution belongs to
https://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html - this
commit only provides a small wrapper for non-copyable Private class
implementations common throughout libQuotient. Unlike the original,
default initialisation is made explicit - you have to pass
ZeroImpl<Private>() instead (and I firmly believe it's a good thing:
normally pointers to Private should not remain nullptr). The reason
ZeroImpl<> is not a template variable is quite simple: unique_ptr is
non-copyable and so cannot be initialised from; while a template
function will initialise the value in-place thanks to copy elision.
|
|
Once visibility kicks in, MSVC changes its ways and tries to instantiate
Private classes wrapped in smart pointers upon their occurence in the
header file - which leads to build breakage because of a missing
destructor. Usually making the outer class destructor out-of-line helps
to fix this (see RoomEvent, for one example).
|
|
This include all (hopefully) classes/structures and functions that have
non-inline definitions, as well as namespaces with Q_NAMESPACE since
those have non-inline (as of Qt 5.15) QMetaObject - for that a new
macro, QUO_NAMESPACE, has been devised to accommodate the lack of
Q_NAMESPACE_EXPORT in Qt before 5.14.
|
|
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
|
|
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
|
|
|
|
|
|
|
|
A handy macro that introduces an enumerator with a respective
Q_DECL_DEPRECATED_X recommending the substitution.
|
|
- BaseJob::prepareError() slightly updated to get the current status
instead of checking the returned value outside in gotReply()
- BaseJob::gotReply() no more reports on 429 Too Many Requests twice
(the first time with dubious "Too Many Requests: Unknown error")
|
|
|
|
This is meant to spare clients from having to percent-encode
room aliases, v3 event ids etc. that happen to hit the endpoint path.
It is unfair to expect clients to do that since they are not supposed
to care about the shape of CS API, which parameter should be encoded
in which way. The trick (together with the slightly updated GTAD
configuration) is to percent-encode parts that happen to be QStrings
and not `const char[]`'s while passing all constant parts as plain
C character literals. This also allows to make it more certain that
the path is correctly encoded by passing and storing QByteArray's
wherever the path is already encoded, and only use QStrings (next to
const char arrays) before that.
Since the change alters the API contract (even if that contract was
crappy), some crude detection of percent-encoded stuff on input is
inserted; if input is already percent-encoded, a warning is put to
the logs, alerting developers about the change.
|
|
To provide more room for internal changes in BaseJob.
|
|
Turned out it was broken, and I was looking the other way.
|
|
|
|
BaseJob: StatusCode::JsonParseError
Connection: resolved() and reconnected() signals; roomMap(); postReceipt()
User: bridged() and rawName()
ConnectionData: setHost() and setPort()
StateEventBase: prev_content()
|
|
|
|
The grand plan is to get rid of `BaseJob` and turn job invocations
to function calls returning `QFuture`. `RequestData` will stay though,
feeding data into those calls.
|
|
BaseJob::loadFromJson() does just fine without QStringViews.
[skip ci]
|
|
A previous incarnation, make_array, existed in basejob.cpp before.
The new direction taken by C++20 is to either deduce the array (but
the used Apple standard library doesn't have deduction guides yet) or
to use to_array() that converts a C array to std::array. This latter
option is taken here, with to_array() defined in quotient_common.h
until we move over to C++20.
|
|
As pointed out by one of users, thumbnail requests produce quite a bit
of logging traffic, so it's better to manage them separately.
|
|
It was a tiny wrapper around QUrlQuery to facilitate creation from
an initializer list - however, Mustache templates long changed to
not actually used that additional constructor.
|
|
The latter obsoleted the former since Qt 5.9, actually.
|
|
This fixes reliance on QIODevice being magically available for
std::unique_ptr<> by indirect inclusion. Since Qt 6 this inclusion no
more happens, time to #include <QIODevice> explicitly.
|
|
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.
|
|
|
|
Port existing copyright statement to reuse using licensedigger
|
|
|
|
To be very clear what this function checks. See also #437.
|
|
Fixes #437.
(cherry picked from commit 12e00b234e5c5f4ed57b5c400d06f780e71014f4)
|
|
(cherry picked from commit 4f06d46d6d6062d6d17f69eeaddb7810edac5bbf)
|
|
|
|
...to show the sunny-day case.
|
|
|
|
Usually QNetworkAccessManager expects the user to delete the replies, but when the QNetworkAccessManager itself is deleted it deletes all pending replies (https://code.woboq.org/qt5/qtbase/src/network/access/qnetworkaccessmanager.cpp.html#529).
This can lead to use-after-free crashes when d->reply is accessed. By putting the reply into a QPointer the exiting if(d->reply) checks can work properly.
|
|
|
|
(cherry picked from commit 0a2acd750a4155969092be674ed3dd9a71b2354f)
|
|
Since Status single-parameter constructor is (intentionally)
not explicit, comparisons may not do what's expected in cases like
the one fixed by 3ef036cd. This makes comparisons "do the right thing".
|
|
(cherry picked from commit 1a832ae9b6a0d679b551fd644136e4bc17e7db29)
|
|
Proxy servers may return arbitrary HTML, for one example; so don't
expect to find a valid JSON object in whatever non-empty payload
next to a non-2xx HTTP code. Fixes #421.
(cherry picked from commit 9ef83e044ed4f8409156b19d529dfc7e45f565c1)
|
|
DeleteDeviceJob requires authentication, but the JSON data is not added for DELETE requests.
Since QNetworkAccessManager::deleteResource does not support body data, we need to send a custom request.
|
|
|
|
* QT_NO_URL_CAST_FROM_STRING makes it clearer where QUrls are created
from QStrings (which incurs a parsing cost).
* QT_STRICT_ITERATORS helps detecting where begin()/end() is used
instead of cbegin()/cend(). KDE developers have verified that
the generated assembly code is identical.
|