Age | Commit message (Collapse) | Author |
|
fromJson() is generalised to accept any JSON-like type while passing
QJsonObject to JsonConverter<>::load (instead of doLoad). This allows to
(still) rely on JsonConverter<> as a customisation point while providing
an opportunity to overload fromJson for custom types in a pointed way
(specifically, by providing the overload for
`fromJson(const QJsonObject&)`), instead of having to go with full-blown
JsonConverter<> specialisation. This will be used in a further commit
to simplify ReceiptEvent definition.
Using if constexpr in combination with constraints (`requires()`) -
the first such case in Quotient codebase - allowed to put the entire
logic in a single JsonConverter<>::load() body instead of having a
facility JsonExporter<> class for SFINAE.
Aside from that, fromJson<QJsonValue, QJsonValue> is entirely dropped
because it's not supposed to be used that way (it's no-op after all);
reflecting that, Event::unsignedPart() and Event::contentPart() no more
default to QJsonValue as the expected return type, you have to
explicitly provide the type instead (and as one can see from the changes
in the commit, it's actually better that way since it's better
to validate the value inside JSON - e.g. check QString or QJsonObject
for emptiness - than the QJsonValue envelope which may still wrap
an empty value).
toJson() is also generalised, replacing 3 functions with one that has
a constexpr if to discern between two kinds of types.
|
|
|
|
Not that it was very important, as the two are basically the same thing
(and matrixTypeId() is about to be obsoleted); but formally basicJson()
is supposed to get the former, not the latter.
|
|
This makes it easier and more intuitive to build a minimal JSON payload
for a given event type. A common basicJson() call point is also
convenient in template contexts (see next commits).
|
|
The result is FTBFS as yet; next commits will fix that, along with a few
other things.
|
|
|
|
Objects derived from Event are not room events (in the spec sense) and
never occur in the same arrays as room events; therefore this chaining
has always been superfluous.
|
|
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
|
|
|
|
|
|
Similar to contentPart() - apparently there are enough places across
the code that would benefit from it.
|
|
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.
|
|
|
|
In particular: removed unnecessary #includes, deprecated and no more
used constructs, replaced stored members with dynamic generation
from JSON (TypingEvent and, especially promising for performance,
ReceiptEvent)
|
|
|
|
The override adds the event's origin timestamp
|
|
The previous name is still available but deprecated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
It's already logged in Room - actually, several times at different
stages.
|
|
Call events no more store deserialised values; instead they deserialise
values on the fly, same as all other events. They are no more treated as
state events (The Spec doesn't define them as state events in the first
place). A common base class, CallEventBase, is introduced that defines
data pieces common to all call events (call id and version).
|
|
|
|
It's present on the vast minority of events so better be embedded into
JSON instead.
|
|
The Room class has gained a new internal container, unsyncedEvents, storing
locally-created Event objects that are about to be sent or are sent but not yet synced.
These objects are supposed to be complete enough to be displayed by clients
in a usual way; access to them is provided by Room::pendingEvents() accessor.
A set of pendingEvent* signals has been added to notify clients about changes
in this container (adding, removal, status update). Yet unsent events don't
have Event::id() at all; sent but yet unsynced ones have Event::id() but have
almost nothing else except the content for now (probably a sender and an
(at least local) timestamp are worth adding).
Also: SendEventJob is removed in favor of GTAD-generated SendMessageJob.
|
|
We now have event.*, roomevent.*, stateevent.* and eventloader.h. If you only use event leaf-classes (such as RoomMemberEvent) you shouldn't notice anything.
|