libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
syncdata.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2018 Kitsune Ral <kitsune-ral@users.sf.net>
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
7
8#include "events/stateevent.h"
9
10namespace Quotient {
11
12constexpr inline auto UnreadNotificationsKey = "unread_notifications"_L1;
13constexpr inline auto PartiallyReadCountKey = "x-quotient.since_fully_read_count"_L1;
14constexpr inline auto NewUnreadCountKey = "org.matrix.msc2654.unread_count"_L1;
15constexpr inline auto HighlightCountKey = "highlight_count"_L1;
16
17//! \brief Room summary, as defined in MSC688
18//!
19//! Every member of this structure is an optional; as per the MSC, only changed values are sent
20//! from the server so if nothing is in the payload the respective member will be omitted.
21//! In particular, `!heroes.has_value()` means that nothing has come from the server;
22//! `heroes.value().isEmpty()` means a peculiar but valid case of a room with the only member -
23//! the current user.
27 std::optional<QStringList> heroes; //!< mxids used to form the room name
28
29 bool isEmpty() const;
30};
32
33template <>
35 static void dumpTo(QJsonObject& jo, const RoomSummary& rs);
36 static void fillFrom(const QJsonObject& jo, RoomSummary& rs);
37};
38
39/// Information on e2e device updates. Note: only present on an
40/// incremental sync.
42 /// List of users who have updated their device identity keys, or who
43 /// now share an encrypted room with the client since the previous
44 /// sync response.
46
47 /// List of users with whom we do not share any encrypted rooms
48 /// any more since the previous sync response.
50};
51
52QDebug operator<<(QDebug dhg, const DevicesList& devicesList);
53
54template <>
55struct JsonObjectConverter<DevicesList> {
56 static void dumpTo(QJsonObject &jo, const DevicesList &dev);
57 static void fillFrom(const QJsonObject& jo, DevicesList& rs);
58};
59
61public:
69
75
77 const QJsonObject& roomJson);
78};
79
80// QVector cannot work with non-copyable objects, std::vector can.
82
84public:
85 SyncData() = default;
86 explicit SyncData(const QString& cacheFileName);
87 //! Parse sync response into room events
88 //! \param json response from /sync or a room state cache
89 void parseJson(const QJsonObject& json, const QString& baseDir = {});
90
95 {
97 }
100
101 QString nextBatch() const { return nextBatch_; }
102
104
105 static constexpr int MajorCacheVersion = 11;
106 static std::pair<int, int> cacheVersion();
108
109private:
118};
119} // namespace Quotient
constexpr auto PartiallyReadCountKey
Definition syncdata.h:13
constexpr auto HighlightCountKey
Definition syncdata.h:15
QDebug operator<<(QDebug dhg, const DevicesList &devicesList)
constexpr auto UnreadNotificationsKey
Definition syncdata.h:12
QUOTIENT_API QDebug operator<<(QDebug dbg, const EventStats &es)
constexpr auto NewUnreadCountKey
Definition syncdata.h:14
#define QUOTIENT_API
QStringList changed
Definition syncdata.h:45
QStringList left
Definition syncdata.h:49
Room summary, as defined in MSC688.
Definition syncdata.h:24