aboutsummaryrefslogtreecommitdiff
path: root/lib/syncdata.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-21 06:03:49 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-21 07:07:00 +0100
commit96f3daf7a2c4ec875904c11350c93612265e2eed (patch)
treec53404fd7c888ec5bd14fd51fabe18c8eb1ba8d6 /lib/syncdata.h
parentbf5f209d2d237301c65cc0973f1707b9386f3110 (diff)
downloadlibquotient-96f3daf7a2c4ec875904c11350c93612265e2eed.tar.gz
libquotient-96f3daf7a2c4ec875904c11350c93612265e2eed.zip
SyncData: support MSC2654; partiallyReadCount
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.
Diffstat (limited to 'lib/syncdata.h')
-rw-r--r--lib/syncdata.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/syncdata.h b/lib/syncdata.h
index b869a541..36d2e0bf 100644
--- a/lib/syncdata.h
+++ b/lib/syncdata.h
@@ -8,6 +8,12 @@
#include "events/stateevent.h"
namespace Quotient {
+
+constexpr auto UnreadNotificationsKey = "unread_notifications"_ls;
+constexpr auto PartiallyReadCountKey = "x-quotient.since_fully_read_count"_ls;
+constexpr auto NewUnreadCountKey = "org.matrix.msc2654.unread_count"_ls;
+constexpr auto HighlightCountKey = "highlight_count"_ls;
+
/// Room summary, as defined in MSC688
/**
* Every member of this structure is an Omittable; as per the MSC, only
@@ -29,7 +35,6 @@ struct RoomSummary {
};
QDebug operator<<(QDebug dbg, const RoomSummary& rs);
-
template <>
struct JsonObjectConverter<RoomSummary> {
static void dumpTo(QJsonObject& jo, const RoomSummary& rs);
@@ -48,16 +53,14 @@ public:
bool timelineLimited;
QString timelinePrevBatch;
+ Omittable<int> partiallyReadCount;
Omittable<int> unreadCount;
Omittable<int> highlightCount;
- Omittable<int> notificationCount;
- SyncRoomData(const QString& roomId, JoinState joinState_,
- const QJsonObject& room_);
+ SyncRoomData(QString roomId, JoinState joinState,
+ const QJsonObject& roomJson);
SyncRoomData(SyncRoomData&&) = default;
SyncRoomData& operator=(SyncRoomData&&) = default;
-
- static const QString UnreadCountKey;
};
// QVector cannot work with non-copyable objects, std::vector can.