Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
QCoreApplication::processEvents() is well-known to be a _wrong_ solution
to the unresponsive UI problem; despite that, connection.cpp has long
had that call to let UI update itself while processing bulky room
updates (mainly from the initial sync). This commit finally fixes this,
after an (admittedly rare) race condition has been hit, as follows:
0. Pre-requisite: quotest runs all the tests and is about to leave
the room; there's an ongoing sync request.
1. Quotest calls /leave
2. Sync returns, with the batch of _several_ rooms (that's important)
3. The above code handles the first room in the batch
4. processEvents() is called, just in time for the /leave response.
5. The /leave response handler in quotest ends up calling
Connection::logout() (processEvents() still hasn't returned).
6. Connection::logout() calls abandon() on the ongoing SyncJob,
pulling the rug from under onSyncSuccess()/consumeRoomData().
7. processEvents() returns and the above code proceeds to the next
room - only to find that the roomDataList (that is a ref to
a structure owned by SyncJob), is now pointing to garbage.
Morals of the story:
1. processEvents() effectively makes code multi-threaded: one flow is
suspended and another one may run _on the same data_. After the first
flow is resumed, it cannot make any assumptions regarding which data
the second flow touched and/or changed.
2. The library had quite a few cases of using &&-refs, avoiding even
move operations but also leaving ownership of the data with the
original producer (SyncJob). If the lifetime of that producer ends
too soon, those refs become dangling.
The fix makes two important things, respectively:
2. Ownership of room data is now transfered to the processing side,
the moment it is scheduled (see below), in the form of moving
into a lambda capture.
1. Instead of processEvents(), processing of room data is scheduled
via QMetaObject::invokeMethod(), uncoupling the moment when the
data was received in SyncJob from the moment they are processed
in Room::updateData() (and all the numerous signal-slots it calls).
Also: Room::baseStateLoaded now causes Connection::loadedRoomState, not
the other way round - this is more natural and doesn't need Connection
to keep firstTimeRooms map around.
|
|
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.
|
|
|
|
|
|
Doesn't really help build times, instead breaking the build on older Qt.
|
|
Makes compilation a tad lighter.
|
|
Since MSC2654's unread count is counted from the m.read receipt, and
the course is to follow the spec's terminology and use "unread count"
for the number of notable events since m.read, this required to move
the existing number of notable events since m.fully_read to another
field, henceforth called partiallyReadCount. At the same time,
SyncData::notificationCount is dropped completely since MSC2654 claims
to supersede it.
Also: Room::resetNotificationCount() and Room::resetHighlightCount() are
deprecated, as these never worked properly overwriting values that can
be calculated or sourced from the server, only for these values to be
set back again the next time the room is updated from /sync.
|
|
|
|
Fixes #510.
|
|
The minor component is now updated in .cpp, not in .h.
|
|
Also: introduce a merge(T1&, const Omittable<T2>&) that does pretty much
the same as Omittable<T1>::merge(const Omittable<T2>&) except it works
on non-omittables as the left/first operand.
The change removes the need for a clumsy -2 fallback in unreadCount,
and makes the logic loading those counters cleaner along the way.
|
|
|
|
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.
|
|
|
|
...instead of a complicated explicit code converting from JSON
to varianthash to hash.
|
|
Qt 5.15 deprecates binary JSON format in favour of CBOR now used as
a backend for its JSON classes.
|
|
Signed-off-by: Alexey Andreev <aa13q@ya.ru>
|
|
That breaks API all over the place but:
1. The fixes are trivial.
2. More of std:: is used instead of home-baking the same stuff.
|
|
|
|
|
|
|
|
# Conflicts:
# CMakeLists.txt
# lib/avatar.cpp
# lib/connection.cpp
# lib/connection.h
# lib/connectiondata.cpp
# lib/csapi/account-data.cpp
# lib/csapi/account-data.h
# lib/csapi/capabilities.cpp
# lib/csapi/capabilities.h
# lib/csapi/content-repo.cpp
# lib/csapi/create_room.cpp
# lib/csapi/filter.cpp
# lib/csapi/joining.cpp
# lib/csapi/keys.cpp
# lib/csapi/list_joined_rooms.cpp
# lib/csapi/notifications.cpp
# lib/csapi/openid.cpp
# lib/csapi/presence.cpp
# lib/csapi/pushrules.cpp
# lib/csapi/registration.cpp
# lib/csapi/room_upgrades.cpp
# lib/csapi/room_upgrades.h
# lib/csapi/search.cpp
# lib/csapi/users.cpp
# lib/csapi/versions.cpp
# lib/csapi/whoami.cpp
# lib/csapi/{{base}}.cpp.mustache
# lib/events/accountdataevents.h
# lib/events/eventcontent.h
# lib/events/roommemberevent.cpp
# lib/events/stateevent.cpp
# lib/jobs/basejob.cpp
# lib/jobs/basejob.h
# lib/networkaccessmanager.cpp
# lib/networksettings.cpp
# lib/room.cpp
# lib/room.h
# lib/settings.cpp
# lib/settings.h
# lib/syncdata.cpp
# lib/user.cpp
# lib/user.h
# lib/util.cpp
|
|
|
|
|
|
The members of the summary can be omitted in the payload; this change fixes calculation
of the roomname from hero names passed in room summary. Also: RoomSummary can be dumped to QDebug now.
|
|
|
|
placeholder
Otherwise placeholder objects are confused with normal room JSON objects
when loading from the cache. Closes #257 (again).
|
|
Closes #257.
|
|
SyncData now resides in its own pair of files and is capable to load either from file or from JSON. There is also (yet untested) capability to load rooms from files if a file name stands is the value for a given room id. This allows to store the master cache file separately from cache files for each room, massively easing the problem of bulky accounts that can overflow the poor capacity of Qt's JSON engine.
|