Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
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.
|
|
This makes updating display name and emission of necessary signals
including Room::changed() more systematic when it has to occur outside
of updateData() flow - e.g. when loading all members.
|
|
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.
|
|
Room::isEventNotable has been moved out from Room::Private and made
compliant with MSC2654.
The concept of Room::checkForNotifications is taken from Quaternion
where a method with the same name has been in QuaternionRoom for a long
time - however, actual body is a stub for now, always returning
{ Notification::None } (Quaternion's implementation is too crude to be
taken to the library). Now we really need a pushrules processor to fill
this method with something reasonably good. Internally the library now
calls checkForNotifications() on every event added to the timeline,
filling up the events-to-notifications map because it is anticipated
that calculation of notifications can be rather resource-intensive and
should only be done once for a given event.
Finally, Room::notificationsFor is an accessor into the mentioned map,
standing next to isEventNotable (but unlike isEventNotable, it's not
virtual; checkForNotifications is).
|
|
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`.
|
|
This enumeration sees very limited (if any) use outside Quotient; and
though this change will surely break code using it the fix is very
straightforward and quick.
|
|
|
|
# Conflicts:
# lib/room.cpp
|
|
To simplify retrieval of the local m.read receipt and the marker for it.
|
|
This reduces the surface interacting with the User class that eventually
will be split into LocalUser (most part) and RoomMember (a tiny wrapper
around the member data in a given room, used almost everywhere in Room
where User currently is).
Also: dropped a log message when the new receipt is at or behind
the old one as it causes a lot of noise in the logs.
|
|
Port away from implicit 'this' captures in lambdas
|
|
Deprecated with C++20
|
|
|
|
Makes the Room::P::toJson() code more readable.
|
|
It didn't like using QT_IGNORE_DEPRECATIONS inside a statement.
|
|
|
|
|
|
These usually don't affect the room outlooks in the room list in any
way; so can be merged into OtherChange instead.
Also: OtherChanges synonym has been added, implying that there might
be more than one change behind a single "Other" flag.
|
|
|
|
This fixes the `q->readMarker() != historyEdge()` assertion failure
occuring in recalculateUnreadCount() when new events from sync arrive
to a room with no read marker and all history loaded.
|
|
|
|
|
|
|
|
Add convenience function for activating encryption
|
|
Implement the mxc protocol in the NetworkAccessManager
|
|
EncryptionEvent constructor
|
|
The query is easier to manipulate; and the original mxc URL is not used
for the real network request anyway.
|
|
There was a mess with fileTransferCancelled(); it was only emitted when
a download (but not an upload) was cancelled; besides, in case of
downloads a file transfer info structure was getting deleted whereas
uploads left a file transfer in Cancelled status. This all now converges
on:
- fileTransferFailed() for both failures and cancellations (to simplify
slot connection, and also to follow the practice in, e.g., Qt Network).
- the file transfer info structure is kept around in Cancelled status,
following the logic used for failures. There's no particular cleanup
which may become a problem if one uploads and cancels many times
(download file transfers are keyed to event ids, mitigating
the problem); this will be fixed in another commit.
Closes #503. Closes #504.
|
|
This is useful for cases when the room display name is returned to QML
that doesn't have an equivalent of QString::toHtmlEscaped().
|
|
Room::memberJoinState() was only used to check if the user has joined
the room (it couldn't be used for anything else), meaning that its best
replacement is actually not memberState() but isMember() introduced
hereby. It's also better to pass user ids instead of User objects to
memberState() and isMember() since that is enough to check membership.
# Conflicts:
# lib/room.cpp
# lib/room.h
|
|
This still works with older moc yet produces actual warnings when
compiling C++ code.
|
|
Move Room::sync/historyEdge() implementation to Room::Private, so that
internal logic could use the same readable shortcuts without q->
prefixes, instead of timeline.crend() and timeline.cend() that are much
less readable.
|
|
Closes #489.
|
|
Read receipts are entangled with counting unread messages, and saving
them also helps in not sending receipts for too old events. Other users'
read receipts are still treated as truly ephemeral.
|
|
|
|
|
|
|
|
It's now possible to get receipts along with their timestamps by calling
Room::lastReadReceipt(). Together this new method, fullyReadMarker(),
and lastFullyReadEventId() deprecate readMarker() overloads and
readMarkerEventId() respectively.
lastFullyReadEventId is also a Q_PROPERTY (deprecating
readMarkerEventId); readMarkerMoved() signal is deprecated by
fullyReadMarkerMoved(), while readMarkerForUserMoved() is deprecated
in favour of existing lastReadEventChanged().
|
|
|
|
Namely memberCount(), localAliases(), remoteAliases(), timelineEdge().
|
|
This turns the design changes laid out in #464 comments to code, as of
0.6.x branch (0.7 API will be introduced separately):
- readMarker() now returns the fully read marker, unlike
readMarker(User*) that returns a read receipt, even when called for
the local user.
- Private::setLastReadEvent() -> setLastReadReceipt(), incorporating
the "promotion" logic from promoteReadReceipt().
- The above makes promoteReadReceipt() unneeded; the remaining piece
of logic that recalculates the number of unread messages is put to
its own method - Private::recalculateUnreadCount().
- Private::updateUnreadCount() is only slightly refreshed, continues
to use the fully read marker position (as it used to).
- Now that read receipts and fully read markers are managed separately,
Private::setLastReadReceipt() has got its counterpart,
Private::setFullyReadMarker(); both only update their respective
markers locally (emitting signals as needed), without interaction
with the homeserver.
- Private::markMessagesAsRead() now delegates updating the fully read
marker to setFullyReadMarker() and on top of that sends the new
fully read marker to the homeserver.
- Private::serverReadMarker -> fullyReadUntilEventId (to be really clear
what it stores).
- The hand-written PostReadMarkersJob is replaced with the generated
SetReadMarkerJob that does the same thing (and can update the read
receipt on top).
|
|
While slightly more complex for updating, this allows COW to kick in in
the read accessor; using QSet instead of QList also provides better
consistency guarantees. For QML both are converted to an Array-like
collection since Qt 5.15; Qt 5.12 turns QSet<> in a QVariantList,
according to the documentation, which is quite reasonable too.
|
|
|
|
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.
|
|
Instead of being defined independently, JoinState now uses values from
the Membership enumeration (former MemberEventContent::MembershipType)
that was moved to quotient_common.h for that purpose. Both enumerations
gained a Q_FLAG_NS decoration and operator<< overrides that strip
"Quotient::" prefix when dumping member/join state values to the log -
obviating toCString(JoinState) along the way. Quotient::MembershipType
alias is deprecated from now.
|
|
9a5fa623 dropped one of RoomMessageEvent constructors for Qt 6 in order
to address #483 - breaking the build with Qt 6 along the way, as
Room::postFile() relied on that constructor. This commit changes
Room::postFile() in turn, deprecating the current signature and adding
a new one that accepts an EventContent object rather than a path to
a file. In order to achieve that, FileInfo and ImageInfo classes have
gained new constructors that accept QFileInfo instead of the legacy
series of parameters, streamlining usage of EventContent structures.
|
|
(cherry picked from commit 7b65051e959968fe538f40c975d85757cfcc7df7)
(cherry picked from commit 9edfefe9b209583d18ce92e7ffd73e8aa1f3ef1e)
|