8 #include "events/stateevent.h"
12 constexpr inline auto UnreadNotificationsKey =
"unread_notifications"_L1;
13 constexpr inline auto PartiallyReadCountKey =
"x-quotient.since_fully_read_count"_L1;
14 constexpr inline auto NewUnreadCountKey =
"org.matrix.msc2654.unread_count"_L1;
15 constexpr inline auto HighlightCountKey =
"highlight_count"_L1;
25 std::optional<
int> joinedMemberCount;
26 std::optional<
int> invitedMemberCount;
27 std::optional<QStringList> heroes;
34 struct JsonObjectConverter<RoomSummary> {
35 static void dumpTo(QJsonObject& jo,
const RoomSummary& rs);
36 static void fillFrom(
const QJsonObject& jo, RoomSummary& rs);
52 QDebug operator<<(QDebug dhg,
const DevicesList& devicesList);
55 struct JsonObjectConverter<DevicesList> {
56 static void dumpTo(QJsonObject &jo,
const DevicesList &dev);
57 static void fillFrom(
const QJsonObject& jo, DevicesList& rs);
71 QString timelinePrevBatch;
72 std::optional<
int> partiallyReadCount;
73 std::optional<
int> unreadCount;
74 std::optional<
int> highlightCount;
76 SyncRoomData(QString roomId, JoinState joinState,
77 const QJsonObject& roomJson);
81 using SyncDataList = std::vector<SyncRoomData>;
86 explicit SyncData(
const QString& cacheFileName);
89 void parseJson(
const QJsonObject& json,
const QString& baseDir = {});
91 Events takePresenceData();
92 Events takeAccountData();
93 Events takeToDeviceEvents();
94 const QHash<QString,
int>& deviceOneTimeKeysCount()
const
96 return deviceOneTimeKeysCount_;
98 SyncDataList takeRoomData();
99 DevicesList takeDevicesList();
101 QString nextBatch()
const {
return nextBatch_; }
103 QStringList unresolvedRooms()
const {
return unresolvedRoomIds; }
105 static constexpr int MajorCacheVersion = 11;
106 static std::pair<
int,
int> cacheVersion();
107 static QString fileNameForRoom(QString roomId);
113 Events toDeviceEvents;
114 SyncDataList roomData;
115 QStringList unresolvedRoomIds;
116 QHash<QString,
int> deviceOneTimeKeysCount_;
117 DevicesList devicesList;