aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-08-03 17:29:52 +0900
committerGitHub <noreply@github.com>2019-08-03 17:29:52 +0900
commit66e116b7b1e848e80577a0229c8995db0a54932e (patch)
tree763340439a0f4034e9c829d76cb1ffe9766b83c5 /lib/csapi/definitions
parent5b236dfe895c7766002559570aa29c9033009228 (diff)
parentc05ade838f0fce81f2bbe80a3295618a8a26ff52 (diff)
downloadlibquotient-66e116b7b1e848e80577a0229c8995db0a54932e.tar.gz
libquotient-66e116b7b1e848e80577a0229c8995db0a54932e.zip
Merge pull request #295 from marcdeop/140_impose_coding_standard
140 impose coding standard
Diffstat (limited to 'lib/csapi/definitions')
-rw-r--r--lib/csapi/definitions/auth_data.cpp8
-rw-r--r--lib/csapi/definitions/auth_data.h41
-rw-r--r--lib/csapi/definitions/client_device.cpp7
-rw-r--r--lib/csapi/definitions/client_device.h48
-rw-r--r--lib/csapi/definitions/device_keys.cpp9
-rw-r--r--lib/csapi/definitions/device_keys.h59
-rw-r--r--lib/csapi/definitions/event_filter.cpp9
-rw-r--r--lib/csapi/definitions/event_filter.h51
-rw-r--r--lib/csapi/definitions/public_rooms_response.cpp20
-rw-r--r--lib/csapi/definitions/public_rooms_response.h106
-rw-r--r--lib/csapi/definitions/push_condition.cpp9
-rw-r--r--lib/csapi/definitions/push_condition.h52
-rw-r--r--lib/csapi/definitions/push_rule.cpp8
-rw-r--r--lib/csapi/definitions/push_rule.h57
-rw-r--r--lib/csapi/definitions/push_ruleset.cpp9
-rw-r--r--lib/csapi/definitions/push_ruleset.h42
-rw-r--r--lib/csapi/definitions/room_event_filter.cpp9
-rw-r--r--lib/csapi/definitions/room_event_filter.h41
-rw-r--r--lib/csapi/definitions/sync_filter.cpp32
-rw-r--r--lib/csapi/definitions/sync_filter.h160
-rw-r--r--lib/csapi/definitions/user_identifier.cpp10
-rw-r--r--lib/csapi/definitions/user_identifier.h31
-rw-r--r--lib/csapi/definitions/wellknown/full.cpp7
-rw-r--r--lib/csapi/definitions/wellknown/full.h48
-rw-r--r--lib/csapi/definitions/wellknown/homeserver.cpp3
-rw-r--r--lib/csapi/definitions/wellknown/homeserver.h28
-rw-r--r--lib/csapi/definitions/wellknown/identity_server.cpp3
-rw-r--r--lib/csapi/definitions/wellknown/identity_server.h28
28 files changed, 493 insertions, 442 deletions
diff --git a/lib/csapi/definitions/auth_data.cpp b/lib/csapi/definitions/auth_data.cpp
index 006b8c7e..3bb51626 100644
--- a/lib/csapi/definitions/auth_data.cpp
+++ b/lib/csapi/definitions/auth_data.cpp
@@ -7,19 +7,17 @@
using namespace QMatrixClient;
void JsonObjectConverter<AuthenticationData>::dumpTo(
- QJsonObject& jo, const AuthenticationData& pod)
+ QJsonObject& jo, const AuthenticationData& pod)
{
fillJson(jo, pod.authInfo);
addParam<>(jo, QStringLiteral("type"), pod.type);
addParam<IfNotEmpty>(jo, QStringLiteral("session"), pod.session);
}
-void JsonObjectConverter<AuthenticationData>::fillFrom(
- QJsonObject jo, AuthenticationData& result)
+void JsonObjectConverter<AuthenticationData>::fillFrom(QJsonObject jo,
+ AuthenticationData& result)
{
fromJson(jo.take("type"_ls), result.type);
fromJson(jo.take("session"_ls), result.session);
-
fromJson(jo, result.authInfo);
}
-
diff --git a/lib/csapi/definitions/auth_data.h b/lib/csapi/definitions/auth_data.h
index 26eb205c..9e46812c 100644
--- a/lib/csapi/definitions/auth_data.h
+++ b/lib/csapi/definitions/auth_data.h
@@ -6,27 +6,32 @@
#include "converters.h"
-#include <QtCore/QJsonObject>
#include <QtCore/QHash>
+#include <QtCore/QJsonObject>
namespace QMatrixClient
{
- // Data structures
-
- /// Used by clients to submit authentication information to the interactive-authentication API
- struct AuthenticationData
- {
- /// The login type that the client is attempting to complete.
- QString type;
- /// The value of the session key given by the homeserver.
- QString session;
- /// Keys dependent on the login type
- QHash<QString, QJsonObject> authInfo;
- };
- template <> struct JsonObjectConverter<AuthenticationData>
- {
- static void dumpTo(QJsonObject& jo, const AuthenticationData& pod);
- static void fillFrom(QJsonObject jo, AuthenticationData& pod);
- };
+
+// Data structures
+
+/// Used by clients to submit authentication information to the
+/// interactive-authentication API
+struct AuthenticationData
+{
+ /// The login type that the client is attempting to complete.
+ QString type;
+ /// The value of the session key given by the homeserver.
+ QString session;
+
+ /// Keys dependent on the login type
+ QHash<QString, QJsonObject> authInfo;
+};
+
+template <>
+struct JsonObjectConverter<AuthenticationData>
+{
+ static void dumpTo(QJsonObject& jo, const AuthenticationData& pod);
+ static void fillFrom(QJsonObject jo, AuthenticationData& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/client_device.cpp b/lib/csapi/definitions/client_device.cpp
index 752b806a..c9e6a223 100644
--- a/lib/csapi/definitions/client_device.cpp
+++ b/lib/csapi/definitions/client_device.cpp
@@ -6,8 +6,7 @@
using namespace QMatrixClient;
-void JsonObjectConverter<Device>::dumpTo(
- QJsonObject& jo, const Device& pod)
+void JsonObjectConverter<Device>::dumpTo(QJsonObject& jo, const Device& pod)
{
addParam<>(jo, QStringLiteral("device_id"), pod.deviceId);
addParam<IfNotEmpty>(jo, QStringLiteral("display_name"), pod.displayName);
@@ -15,12 +14,10 @@ void JsonObjectConverter<Device>::dumpTo(
addParam<IfNotEmpty>(jo, QStringLiteral("last_seen_ts"), pod.lastSeenTs);
}
-void JsonObjectConverter<Device>::fillFrom(
- const QJsonObject& jo, Device& result)
+void JsonObjectConverter<Device>::fillFrom(const QJsonObject& jo, Device& result)
{
fromJson(jo.value("device_id"_ls), result.deviceId);
fromJson(jo.value("display_name"_ls), result.displayName);
fromJson(jo.value("last_seen_ip"_ls), result.lastSeenIp);
fromJson(jo.value("last_seen_ts"_ls), result.lastSeenTs);
}
-
diff --git a/lib/csapi/definitions/client_device.h b/lib/csapi/definitions/client_device.h
index a6224f71..e4accc35 100644
--- a/lib/csapi/definitions/client_device.h
+++ b/lib/csapi/definitions/client_device.h
@@ -6,32 +6,32 @@
#include "converters.h"
-#include "converters.h"
-
namespace QMatrixClient
{
- // Data structures
- /// A client device
- struct Device
- {
- /// Identifier of this device.
- QString deviceId;
- /// Display name set by the user for this device. Absent if no name has been
- /// set.
- QString displayName;
- /// The IP address where this device was last seen. (May be a few minutes out
- /// of date, for efficiency reasons).
- QString lastSeenIp;
- /// The timestamp (in milliseconds since the unix epoch) when this devices
- /// was last seen. (May be a few minutes out of date, for efficiency
- /// reasons).
- Omittable<qint64> lastSeenTs;
- };
- template <> struct JsonObjectConverter<Device>
- {
- static void dumpTo(QJsonObject& jo, const Device& pod);
- static void fillFrom(const QJsonObject& jo, Device& pod);
- };
+// Data structures
+
+/// A client device
+struct Device
+{
+ /// Identifier of this device.
+ QString deviceId;
+ /// Display name set by the user for this device. Absent if no name has
+ /// beenset.
+ QString displayName;
+ /// The IP address where this device was last seen. (May be a few minutes
+ /// outof date, for efficiency reasons).
+ QString lastSeenIp;
+ /// The timestamp (in milliseconds since the unix epoch) when this deviceswas
+ /// last seen. (May be a few minutes out of date, for efficiencyreasons).
+ Omittable<qint64> lastSeenTs;
+};
+
+template <>
+struct JsonObjectConverter<Device>
+{
+ static void dumpTo(QJsonObject& jo, const Device& pod);
+ static void fillFrom(const QJsonObject& jo, Device& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/device_keys.cpp b/lib/csapi/definitions/device_keys.cpp
index 1e79499f..cc5262b7 100644
--- a/lib/csapi/definitions/device_keys.cpp
+++ b/lib/csapi/definitions/device_keys.cpp
@@ -6,8 +6,8 @@
using namespace QMatrixClient;
-void JsonObjectConverter<DeviceKeys>::dumpTo(
- QJsonObject& jo, const DeviceKeys& pod)
+void JsonObjectConverter<DeviceKeys>::dumpTo(QJsonObject& jo,
+ const DeviceKeys& pod)
{
addParam<>(jo, QStringLiteral("user_id"), pod.userId);
addParam<>(jo, QStringLiteral("device_id"), pod.deviceId);
@@ -16,8 +16,8 @@ void JsonObjectConverter<DeviceKeys>::dumpTo(
addParam<>(jo, QStringLiteral("signatures"), pod.signatures);
}
-void JsonObjectConverter<DeviceKeys>::fillFrom(
- const QJsonObject& jo, DeviceKeys& result)
+void JsonObjectConverter<DeviceKeys>::fillFrom(const QJsonObject& jo,
+ DeviceKeys& result)
{
fromJson(jo.value("user_id"_ls), result.userId);
fromJson(jo.value("device_id"_ls), result.deviceId);
@@ -25,4 +25,3 @@ void JsonObjectConverter<DeviceKeys>::fillFrom(
fromJson(jo.value("keys"_ls), result.keys);
fromJson(jo.value("signatures"_ls), result.signatures);
}
-
diff --git a/lib/csapi/definitions/device_keys.h b/lib/csapi/definitions/device_keys.h
index 8ebe1125..6bd96584 100644
--- a/lib/csapi/definitions/device_keys.h
+++ b/lib/csapi/definitions/device_keys.h
@@ -10,34 +10,35 @@
namespace QMatrixClient
{
- // Data structures
-
- /// Device identity keys
- struct DeviceKeys
- {
- /// The ID of the user the device belongs to. Must match the user ID used
- /// when logging in.
- QString userId;
- /// The ID of the device these keys belong to. Must match the device ID used
- /// when logging in.
- QString deviceId;
- /// The encryption algorithms supported by this device.
- QStringList algorithms;
- /// Public identity keys. The names of the properties should be in the
- /// format ``<algorithm>:<device_id>``. The keys themselves should be
- /// encoded as specified by the key algorithm.
- QHash<QString, QString> keys;
- /// Signatures for the device key object. A map from user ID, to a map from
- /// ``<algorithm>:<device_id>`` to the signature.
- ///
- /// The signature is calculated using the process described at `Signing
- /// JSON`_.
- QHash<QString, QHash<QString, QString>> signatures;
- };
- template <> struct JsonObjectConverter<DeviceKeys>
- {
- static void dumpTo(QJsonObject& jo, const DeviceKeys& pod);
- static void fillFrom(const QJsonObject& jo, DeviceKeys& pod);
- };
+
+// Data structures
+
+/// Device identity keys
+struct DeviceKeys
+{
+ /// The ID of the user the device belongs to. Must match the user ID
+ /// usedwhen logging in.
+ QString userId;
+ /// The ID of the device these keys belong to. Must match the device ID
+ /// usedwhen logging in.
+ QString deviceId;
+ /// The encryption algorithms supported by this device.
+ QStringList algorithms;
+ /// Public identity keys. The names of the properties should be in theformat
+ /// ``<algorithm>:<device_id>``. The keys themselves should beencoded as
+ /// specified by the key algorithm.
+ QHash<QString, QString> keys;
+ /// Signatures for the device key object. A map from user ID, to a map
+ /// from``<algorithm>:<device_id>`` to the signature.The signature is
+ /// calculated using the process described at `SigningJSON`_.
+ QHash<QString, QHash<QString, QString>> signatures;
+};
+
+template <>
+struct JsonObjectConverter<DeviceKeys>
+{
+ static void dumpTo(QJsonObject& jo, const DeviceKeys& pod);
+ static void fillFrom(const QJsonObject& jo, DeviceKeys& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/event_filter.cpp b/lib/csapi/definitions/event_filter.cpp
index b20d7807..9b2c7a33 100644
--- a/lib/csapi/definitions/event_filter.cpp
+++ b/lib/csapi/definitions/event_filter.cpp
@@ -6,8 +6,8 @@
using namespace QMatrixClient;
-void JsonObjectConverter<EventFilter>::dumpTo(
- QJsonObject& jo, const EventFilter& pod)
+void JsonObjectConverter<EventFilter>::dumpTo(QJsonObject& jo,
+ const EventFilter& pod)
{
addParam<IfNotEmpty>(jo, QStringLiteral("limit"), pod.limit);
addParam<IfNotEmpty>(jo, QStringLiteral("not_senders"), pod.notSenders);
@@ -16,8 +16,8 @@ void JsonObjectConverter<EventFilter>::dumpTo(
addParam<IfNotEmpty>(jo, QStringLiteral("types"), pod.types);
}
-void JsonObjectConverter<EventFilter>::fillFrom(
- const QJsonObject& jo, EventFilter& result)
+void JsonObjectConverter<EventFilter>::fillFrom(const QJsonObject& jo,
+ EventFilter& result)
{
fromJson(jo.value("limit"_ls), result.limit);
fromJson(jo.value("not_senders"_ls), result.notSenders);
@@ -25,4 +25,3 @@ void JsonObjectConverter<EventFilter>::fillFrom(
fromJson(jo.value("senders"_ls), result.senders);
fromJson(jo.value("types"_ls), result.types);
}
-
diff --git a/lib/csapi/definitions/event_filter.h b/lib/csapi/definitions/event_filter.h
index 6de1fe79..9b9b3fa3 100644
--- a/lib/csapi/definitions/event_filter.h
+++ b/lib/csapi/definitions/event_filter.h
@@ -6,29 +6,38 @@
#include "converters.h"
-#include "converters.h"
-
namespace QMatrixClient
{
- // Data structures
- struct EventFilter
- {
- /// The maximum number of events to return.
- Omittable<int> limit;
- /// A list of sender IDs to exclude. If this list is absent then no senders are excluded. A matching sender will be excluded even if it is listed in the ``'senders'`` filter.
- QStringList notSenders;
- /// A list of event types to exclude. If this list is absent then no event types are excluded. A matching type will be excluded even if it is listed in the ``'types'`` filter. A '*' can be used as a wildcard to match any sequence of characters.
- QStringList notTypes;
- /// A list of senders IDs to include. If this list is absent then all senders are included.
- QStringList senders;
- /// A list of event types to include. If this list is absent then all event types are included. A ``'*'`` can be used as a wildcard to match any sequence of characters.
- QStringList types;
- };
- template <> struct JsonObjectConverter<EventFilter>
- {
- static void dumpTo(QJsonObject& jo, const EventFilter& pod);
- static void fillFrom(const QJsonObject& jo, EventFilter& pod);
- };
+// Data structures
+
+struct EventFilter
+{
+ /// The maximum number of events to return.
+ Omittable<int> limit;
+ /// A list of sender IDs to exclude. If this list is absent then no senders
+ /// are excluded. A matching sender will be excluded even if it is listed in
+ /// the ``'senders'`` filter.
+ QStringList notSenders;
+ /// A list of event types to exclude. If this list is absent then no event
+ /// types are excluded. A matching type will be excluded even if it is
+ /// listed in the ``'types'`` filter. A '*' can be used as a wildcard to
+ /// match any sequence of characters.
+ QStringList notTypes;
+ /// A list of senders IDs to include. If this list is absent then all
+ /// senders are included.
+ QStringList senders;
+ /// A list of event types to include. If this list is absent then all event
+ /// types are included. A ``'*'`` can be used as a wildcard to match any
+ /// sequence of characters.
+ QStringList types;
+};
+
+template <>
+struct JsonObjectConverter<EventFilter>
+{
+ static void dumpTo(QJsonObject& jo, const EventFilter& pod);
+ static void fillFrom(const QJsonObject& jo, EventFilter& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/public_rooms_response.cpp b/lib/csapi/definitions/public_rooms_response.cpp
index 0d26662c..d07b1494 100644
--- a/lib/csapi/definitions/public_rooms_response.cpp
+++ b/lib/csapi/definitions/public_rooms_response.cpp
@@ -6,11 +6,12 @@
using namespace QMatrixClient;
-void JsonObjectConverter<PublicRoomsChunk>::dumpTo(
- QJsonObject& jo, const PublicRoomsChunk& pod)
+void JsonObjectConverter<PublicRoomsChunk>::dumpTo(QJsonObject& jo,
+ const PublicRoomsChunk& pod)
{
addParam<IfNotEmpty>(jo, QStringLiteral("aliases"), pod.aliases);
- addParam<IfNotEmpty>(jo, QStringLiteral("canonical_alias"), pod.canonicalAlias);
+ addParam<IfNotEmpty>(jo, QStringLiteral("canonical_alias"),
+ pod.canonicalAlias);
addParam<IfNotEmpty>(jo, QStringLiteral("name"), pod.name);
addParam<>(jo, QStringLiteral("num_joined_members"), pod.numJoinedMembers);
addParam<>(jo, QStringLiteral("room_id"), pod.roomId);
@@ -20,8 +21,8 @@ void JsonObjectConverter<PublicRoomsChunk>::dumpTo(
addParam<IfNotEmpty>(jo, QStringLiteral("avatar_url"), pod.avatarUrl);
}
-void JsonObjectConverter<PublicRoomsChunk>::fillFrom(
- const QJsonObject& jo, PublicRoomsChunk& result)
+void JsonObjectConverter<PublicRoomsChunk>::fillFrom(const QJsonObject& jo,
+ PublicRoomsChunk& result)
{
fromJson(jo.value("aliases"_ls), result.aliases);
fromJson(jo.value("canonical_alias"_ls), result.canonicalAlias);
@@ -35,12 +36,13 @@ void JsonObjectConverter<PublicRoomsChunk>::fillFrom(
}
void JsonObjectConverter<PublicRoomsResponse>::dumpTo(
- QJsonObject& jo, const PublicRoomsResponse& pod)
+ QJsonObject& jo, const PublicRoomsResponse& pod)
{
addParam<>(jo, QStringLiteral("chunk"), pod.chunk);
addParam<IfNotEmpty>(jo, QStringLiteral("next_batch"), pod.nextBatch);
addParam<IfNotEmpty>(jo, QStringLiteral("prev_batch"), pod.prevBatch);
- addParam<IfNotEmpty>(jo, QStringLiteral("total_room_count_estimate"), pod.totalRoomCountEstimate);
+ addParam<IfNotEmpty>(jo, QStringLiteral("total_room_count_estimate"),
+ pod.totalRoomCountEstimate);
}
void JsonObjectConverter<PublicRoomsResponse>::fillFrom(
@@ -49,6 +51,6 @@ void JsonObjectConverter<PublicRoomsResponse>::fillFrom(
fromJson(jo.value("chunk"_ls), result.chunk);
fromJson(jo.value("next_batch"_ls), result.nextBatch);
fromJson(jo.value("prev_batch"_ls), result.prevBatch);
- fromJson(jo.value("total_room_count_estimate"_ls), result.totalRoomCountEstimate);
+ fromJson(jo.value("total_room_count_estimate"_ls),
+ result.totalRoomCountEstimate);
}
-
diff --git a/lib/csapi/definitions/public_rooms_response.h b/lib/csapi/definitions/public_rooms_response.h
index 4c54ac25..e86e306f 100644
--- a/lib/csapi/definitions/public_rooms_response.h
+++ b/lib/csapi/definitions/public_rooms_response.h
@@ -7,62 +7,64 @@
#include "converters.h"
#include <QtCore/QVector>
-#include "converters.h"
namespace QMatrixClient
{
- // Data structures
- struct PublicRoomsChunk
- {
- /// Aliases of the room. May be empty.
- QStringList aliases;
- /// The canonical alias of the room, if any.
- QString canonicalAlias;
- /// The name of the room, if any.
- QString name;
- /// The number of members joined to the room.
- int numJoinedMembers;
- /// The ID of the room.
- QString roomId;
- /// The topic of the room, if any.
- QString topic;
- /// Whether the room may be viewed by guest users without joining.
- bool worldReadable;
- /// Whether guest users may join the room and participate in it.
- /// If they can, they will be subject to ordinary power level
- /// rules like any other user.
- bool guestCanJoin;
- /// The URL for the room's avatar, if one is set.
- QString avatarUrl;
- };
- template <> struct JsonObjectConverter<PublicRoomsChunk>
- {
- static void dumpTo(QJsonObject& jo, const PublicRoomsChunk& pod);
- static void fillFrom(const QJsonObject& jo, PublicRoomsChunk& pod);
- };
+// Data structures
+
+struct PublicRoomsChunk
+{
+ /// Aliases of the room. May be empty.
+ QStringList aliases;
+ /// The canonical alias of the room, if any.
+ QString canonicalAlias;
+ /// The name of the room, if any.
+ QString name;
+ /// The number of members joined to the room.
+ int numJoinedMembers;
+ /// The ID of the room.
+ QString roomId;
+ /// The topic of the room, if any.
+ QString topic;
+ /// Whether the room may be viewed by guest users without joining.
+ bool worldReadable;
+ /// Whether guest users may join the room and participate in it.If they can,
+ /// they will be subject to ordinary power levelrules like any other user.
+ bool guestCanJoin;
+ /// The URL for the room's avatar, if one is set.
+ QString avatarUrl;
+};
+
+template <>
+struct JsonObjectConverter<PublicRoomsChunk>
+{
+ static void dumpTo(QJsonObject& jo, const PublicRoomsChunk& pod);
+ static void fillFrom(const QJsonObject& jo, PublicRoomsChunk& pod);
+};
+
+/// A list of the rooms on the server.
+struct PublicRoomsResponse
+{
+ /// A paginated chunk of public rooms.
+ QVector<PublicRoomsChunk> chunk;
+ /// A pagination token for the response. The absence of this tokenmeans
+ /// there are no more results to fetch and the client shouldstop paginating.
+ QString nextBatch;
+ /// A pagination token that allows fetching previous results. Theabsence of
+ /// this token means there are no results before thisbatch, i.e. this is the
+ /// first batch.
+ QString prevBatch;
+ /// An estimate on the total number of public rooms, if theserver has an
+ /// estimate.
+ Omittable<int> totalRoomCountEstimate;
+};
- /// A list of the rooms on the server.
- struct PublicRoomsResponse
- {
- /// A paginated chunk of public rooms.
- QVector<PublicRoomsChunk> chunk;
- /// A pagination token for the response. The absence of this token
- /// means there are no more results to fetch and the client should
- /// stop paginating.
- QString nextBatch;
- /// A pagination token that allows fetching previous results. The
- /// absence of this token means there are no results before this
- /// batch, i.e. this is the first batch.
- QString prevBatch;
- /// An estimate on the total number of public rooms, if the
- /// server has an estimate.
- Omittable<int> totalRoomCountEstimate;
- };
- template <> struct JsonObjectConverter<PublicRoomsResponse>
- {
- static void dumpTo(QJsonObject& jo, const PublicRoomsResponse& pod);
- static void fillFrom(const QJsonObject& jo, PublicRoomsResponse& pod);
- };
+template <>
+struct JsonObjectConverter<PublicRoomsResponse>
+{
+ static void dumpTo(QJsonObject& jo, const PublicRoomsResponse& pod);
+ static void fillFrom(const QJsonObject& jo, PublicRoomsResponse& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/push_condition.cpp b/lib/csapi/definitions/push_condition.cpp
index ace02755..5bcb845e 100644
--- a/lib/csapi/definitions/push_condition.cpp
+++ b/lib/csapi/definitions/push_condition.cpp
@@ -6,8 +6,8 @@
using namespace QMatrixClient;
-void JsonObjectConverter<PushCondition>::dumpTo(
- QJsonObject& jo, const PushCondition& pod)
+void JsonObjectConverter<PushCondition>::dumpTo(QJsonObject& jo,
+ const PushCondition& pod)
{
addParam<>(jo, QStringLiteral("kind"), pod.kind);
addParam<IfNotEmpty>(jo, QStringLiteral("key"), pod.key);
@@ -15,12 +15,11 @@ void JsonObjectConverter<PushCondition>::dumpTo(
addParam<IfNotEmpty>(jo, QStringLiteral("is"), pod.is);
}
-void JsonObjectConverter<PushCondition>::fillFrom(
- const QJsonObject& jo, PushCondition& result)
+void JsonObjectConverter<PushCondition>::fillFrom(const QJsonObject& jo,
+ PushCondition& result)
{
fromJson(jo.value("kind"_ls), result.kind);
fromJson(jo.value("key"_ls), result.key);
fromJson(jo.value("pattern"_ls), result.pattern);
fromJson(jo.value("is"_ls), result.is);
}
-
diff --git a/lib/csapi/definitions/push_condition.h b/lib/csapi/definitions/push_condition.h
index e45526d2..2c17023e 100644
--- a/lib/csapi/definitions/push_condition.h
+++ b/lib/csapi/definitions/push_condition.h
@@ -6,32 +6,34 @@
#include "converters.h"
-
namespace QMatrixClient
{
- // Data structures
-
- struct PushCondition
- {
- QString kind;
- /// Required for ``event_match`` conditions. The dot-separated field of the
- /// event to match.
- QString key;
- /// Required for ``event_match`` conditions. The glob-style pattern to
- /// match against. Patterns with no special glob characters should be
- /// treated as having asterisks prepended and appended when testing the
- /// condition.
- QString pattern;
- /// Required for ``room_member_count`` conditions. A decimal integer
- /// optionally prefixed by one of, ==, <, >, >= or <=. A prefix of < matches
- /// rooms where the member count is strictly less than the given number and
- /// so forth. If no prefix is present, this parameter defaults to ==.
- QString is;
- };
- template <> struct JsonObjectConverter<PushCondition>
- {
- static void dumpTo(QJsonObject& jo, const PushCondition& pod);
- static void fillFrom(const QJsonObject& jo, PushCondition& pod);
- };
+
+// Data structures
+
+struct PushCondition
+{
+
+ QString kind;
+ /// Required for ``event_match`` conditions. The dot-separated field of
+ /// theevent to match.
+ QString key;
+ /// Required for ``event_match`` conditions. The glob-style pattern tomatch
+ /// against. Patterns with no special glob characters should betreated as
+ /// having asterisks prepended and appended when testing thecondition.
+ QString pattern;
+ /// Required for ``room_member_count`` conditions. A decimal integeroptionally
+ /// prefixed by one of, ==, <, >, >= or <=. A prefix of < matchesrooms where
+ /// the member count is strictly less than the given number andso forth. If
+ /// no prefix is present, this parameter defaults to ==.
+ QString is;
+};
+
+template <>
+struct JsonObjectConverter<PushCondition>
+{
+ static void dumpTo(QJsonObject& jo, const PushCondition& pod);
+ static void fillFrom(const QJsonObject& jo, PushCondition& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/push_rule.cpp b/lib/csapi/definitions/push_rule.cpp
index abbb04b5..fc2be2c7 100644
--- a/lib/csapi/definitions/push_rule.cpp
+++ b/lib/csapi/definitions/push_rule.cpp
@@ -6,8 +6,7 @@
using namespace QMatrixClient;
-void JsonObjectConverter<PushRule>::dumpTo(
- QJsonObject& jo, const PushRule& pod)
+void JsonObjectConverter<PushRule>::dumpTo(QJsonObject& jo, const PushRule& pod)
{
addParam<>(jo, QStringLiteral("actions"), pod.actions);
addParam<>(jo, QStringLiteral("default"), pod.isDefault);
@@ -17,8 +16,8 @@ void JsonObjectConverter<PushRule>::dumpTo(
addParam<IfNotEmpty>(jo, QStringLiteral("pattern"), pod.pattern);
}
-void JsonObjectConverter<PushRule>::fillFrom(
- const QJsonObject& jo, PushRule& result)
+void JsonObjectConverter<PushRule>::fillFrom(const QJsonObject& jo,
+ PushRule& result)
{
fromJson(jo.value("actions"_ls), result.actions);
fromJson(jo.value("default"_ls), result.isDefault);
@@ -27,4 +26,3 @@ void JsonObjectConverter<PushRule>::fillFrom(
fromJson(jo.value("conditions"_ls), result.conditions);
fromJson(jo.value("pattern"_ls), result.pattern);
}
-
diff --git a/lib/csapi/definitions/push_rule.h b/lib/csapi/definitions/push_rule.h
index bea13e96..fe6eb0e6 100644
--- a/lib/csapi/definitions/push_rule.h
+++ b/lib/csapi/definitions/push_rule.h
@@ -7,37 +7,40 @@
#include "converters.h"
#include "csapi/definitions/push_condition.h"
+
#include <QtCore/QJsonObject>
-#include <QtCore/QVector>
#include <QtCore/QVariant>
-#include "converters.h"
+#include <QtCore/QVector>
namespace QMatrixClient
{
- // Data structures
-
- struct PushRule
- {
- /// The actions to perform when this rule is matched.
- QVector<QVariant> actions;
- /// Whether this is a default rule, or has been set explicitly.
- bool isDefault;
- /// Whether the push rule is enabled or not.
- bool enabled;
- /// The ID of this rule.
- QString ruleId;
- /// The conditions that must hold true for an event in order for a rule to be
- /// applied to an event. A rule with no conditions always matches. Only
- /// applicable to ``underride`` and ``override`` rules.
- QVector<PushCondition> conditions;
- /// The glob-style pattern to match against. Only applicable to ``content``
- /// rules.
- QString pattern;
- };
- template <> struct JsonObjectConverter<PushRule>
- {
- static void dumpTo(QJsonObject& jo, const PushRule& pod);
- static void fillFrom(const QJsonObject& jo, PushRule& pod);
- };
+
+// Data structures
+
+struct PushRule
+{
+ /// The actions to perform when this rule is matched.
+ QVector<QVariant> actions;
+ /// Whether this is a default rule, or has been set explicitly.
+ bool isDefault;
+ /// Whether the push rule is enabled or not.
+ bool enabled;
+ /// The ID of this rule.
+ QString ruleId;
+ /// The conditions that must hold true for an event in order for a rule to
+ /// beapplied to an event. A rule with no conditions always matches.
+ /// Onlyapplicable to ``underride`` and ``override`` rules.
+ QVector<PushCondition> conditions;
+ /// The glob-style pattern to match against. Only applicable to
+ /// ``content``rules.
+ QString pattern;
+};
+
+template <>
+struct JsonObjectConverter<PushRule>
+{
+ static void dumpTo(QJsonObject& jo, const PushRule& pod);
+ static void fillFrom(const QJsonObject& jo, PushRule& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/push_ruleset.cpp b/lib/csapi/definitions/push_ruleset.cpp
index f1bad882..6f48d27b 100644
--- a/lib/csapi/definitions/push_ruleset.cpp
+++ b/lib/csapi/definitions/push_ruleset.cpp
@@ -6,8 +6,8 @@
using namespace QMatrixClient;
-void JsonObjectConverter<PushRuleset>::dumpTo(
- QJsonObject& jo, const PushRuleset& pod)
+void JsonObjectConverter<PushRuleset>::dumpTo(QJsonObject& jo,
+ const PushRuleset& pod)
{
addParam<IfNotEmpty>(jo, QStringLiteral("content"), pod.content);
addParam<IfNotEmpty>(jo, QStringLiteral("override"), pod.override);
@@ -16,8 +16,8 @@ void JsonObjectConverter<PushRuleset>::dumpTo(
addParam<IfNotEmpty>(jo, QStringLiteral("underride"), pod.underride);
}
-void JsonObjectConverter<PushRuleset>::fillFrom(
- const QJsonObject& jo, PushRuleset& result)
+void JsonObjectConverter<PushRuleset>::fillFrom(const QJsonObject& jo,
+ PushRuleset& result)
{
fromJson(jo.value("content"_ls), result.content);
fromJson(jo.value("override"_ls), result.override);
@@ -25,4 +25,3 @@ void JsonObjectConverter<PushRuleset>::fillFrom(
fromJson(jo.value("sender"_ls), result.sender);
fromJson(jo.value("underride"_ls), result.underride);
}
-
diff --git a/lib/csapi/definitions/push_ruleset.h b/lib/csapi/definitions/push_ruleset.h
index f2d937c0..f9aedad8 100644
--- a/lib/csapi/definitions/push_ruleset.h
+++ b/lib/csapi/definitions/push_ruleset.h
@@ -6,26 +6,34 @@
#include "converters.h"
-#include <QtCore/QVector>
-#include "converters.h"
#include "csapi/definitions/push_rule.h"
+#include <QtCore/QVector>
+
namespace QMatrixClient
{
- // Data structures
-
- struct PushRuleset
- {
- QVector<PushRule> content;
- QVector<PushRule> override;
- QVector<PushRule> room;
- QVector<PushRule> sender;
- QVector<PushRule> underride;
- };
- template <> struct JsonObjectConverter<PushRuleset>
- {
- static void dumpTo(QJsonObject& jo, const PushRuleset& pod);
- static void fillFrom(const QJsonObject& jo, PushRuleset& pod);
- };
+
+// Data structures
+
+struct PushRuleset
+{
+
+ QVector<PushRule> content;
+
+ QVector<PushRule> override;
+
+ QVector<PushRule> room;
+
+ QVector<PushRule> sender;
+
+ QVector<PushRule> underride;
+};
+
+template <>
+struct JsonObjectConverter<PushRuleset>
+{
+ static void dumpTo(QJsonObject& jo, const PushRuleset& pod);
+ static void fillFrom(const QJsonObject& jo, PushRuleset& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/room_event_filter.cpp b/lib/csapi/definitions/room_event_filter.cpp
index df92e684..bd38ebc7 100644
--- a/lib/csapi/definitions/room_event_filter.cpp
+++ b/lib/csapi/definitions/room_event_filter.cpp
@@ -6,8 +6,8 @@
using namespace QMatrixClient;
-void JsonObjectConverter<RoomEventFilter>::dumpTo(
- QJsonObject& jo, const RoomEventFilter& pod)
+void JsonObjectConverter<RoomEventFilter>::dumpTo(QJsonObject& jo,
+ const RoomEventFilter& pod)
{
fillJson<EventFilter>(jo, pod);
addParam<IfNotEmpty>(jo, QStringLiteral("not_rooms"), pod.notRooms);
@@ -15,12 +15,11 @@ void JsonObjectConverter<RoomEventFilter>::dumpTo(
addParam<IfNotEmpty>(jo, QStringLiteral("contains_url"), pod.containsUrl);
}
-void JsonObjectConverter<RoomEventFilter>::fillFrom(
- const QJsonObject& jo, RoomEventFilter& result)
+void JsonObjectConverter<RoomEventFilter>::fillFrom(const QJsonObject& jo,
+ RoomEventFilter& result)
{
fillFromJson<EventFilter>(jo, result);
fromJson(jo.value("not_rooms"_ls), result.notRooms);
fromJson(jo.value("rooms"_ls), result.rooms);
fromJson(jo.value("contains_url"_ls), result.containsUrl);
}
-
diff --git a/lib/csapi/definitions/room_event_filter.h b/lib/csapi/definitions/room_event_filter.h
index 6eb9a390..72bf34d3 100644
--- a/lib/csapi/definitions/room_event_filter.h
+++ b/lib/csapi/definitions/room_event_filter.h
@@ -7,25 +7,32 @@
#include "converters.h"
#include "csapi/definitions/event_filter.h"
-#include "converters.h"
namespace QMatrixClient
{
- // Data structures
-
- struct RoomEventFilter : EventFilter
- {
- /// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the ``'rooms'`` filter.
- QStringList notRooms;
- /// A list of room IDs to include. If this list is absent then all rooms are included.
- QStringList rooms;
- /// If ``true``, includes only events with a ``url`` key in their content. If ``false``, excludes those events. If omitted, ``url`` key is not considered for filtering.
- Omittable<bool> containsUrl;
- };
- template <> struct JsonObjectConverter<RoomEventFilter>
- {
- static void dumpTo(QJsonObject& jo, const RoomEventFilter& pod);
- static void fillFrom(const QJsonObject& jo, RoomEventFilter& pod);
- };
+
+// Data structures
+
+struct RoomEventFilter : EventFilter
+{
+ /// A list of room IDs to exclude. If this list is absent then no rooms are
+ /// excluded. A matching room will be excluded even if it is listed in the
+ /// ``'rooms'`` filter.
+ QStringList notRooms;
+ /// A list of room IDs to include. If this list is absent then all rooms are
+ /// included.
+ QStringList rooms;
+ /// If ``true``, includes only events with a ``url`` key in their content.
+ /// If ``false``, excludes those events. If omitted, ``url`` key is not
+ /// considered for filtering.
+ Omittable<bool> containsUrl;
+};
+
+template <>
+struct JsonObjectConverter<RoomEventFilter>
+{
+ static void dumpTo(QJsonObject& jo, const RoomEventFilter& pod);
+ static void fillFrom(const QJsonObject& jo, RoomEventFilter& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/sync_filter.cpp b/lib/csapi/definitions/sync_filter.cpp
index 32752d1f..87274a06 100644
--- a/lib/csapi/definitions/sync_filter.cpp
+++ b/lib/csapi/definitions/sync_filter.cpp
@@ -6,24 +6,27 @@
using namespace QMatrixClient;
-void JsonObjectConverter<StateFilter>::dumpTo(
- QJsonObject& jo, const StateFilter& pod)
+void JsonObjectConverter<StateFilter>::dumpTo(QJsonObject& jo,
+ const StateFilter& pod)
{
fillJson<RoomEventFilter>(jo, pod);
- addParam<IfNotEmpty>(jo, QStringLiteral("lazy_load_members"), pod.lazyLoadMembers);
- addParam<IfNotEmpty>(jo, QStringLiteral("include_redundant_members"), pod.includeRedundantMembers);
+ addParam<IfNotEmpty>(jo, QStringLiteral("lazy_load_members"),
+ pod.lazyLoadMembers);
+ addParam<IfNotEmpty>(jo, QStringLiteral("include_redundant_members"),
+ pod.includeRedundantMembers);
}
-void JsonObjectConverter<StateFilter>::fillFrom(
- const QJsonObject& jo, StateFilter& result)
+void JsonObjectConverter<StateFilter>::fillFrom(const QJsonObject& jo,
+ StateFilter& result)
{
fillFromJson<RoomEventFilter>(jo, result);
fromJson(jo.value("lazy_load_members"_ls), result.lazyLoadMembers);
- fromJson(jo.value("include_redundant_members"_ls), result.includeRedundantMembers);
+ fromJson(jo.value("include_redundant_members"_ls),
+ result.includeRedundantMembers);
}
-void JsonObjectConverter<RoomFilter>::dumpTo(
- QJsonObject& jo, const RoomFilter& pod)
+void JsonObjectConverter<RoomFilter>::dumpTo(QJsonObject& jo,
+ const RoomFilter& pod)
{
addParam<IfNotEmpty>(jo, QStringLiteral("not_rooms"), pod.notRooms);
addParam<IfNotEmpty>(jo, QStringLiteral("rooms"), pod.rooms);
@@ -34,8 +37,8 @@ void JsonObjectConverter<RoomFilter>::dumpTo(
addParam<IfNotEmpty>(jo, QStringLiteral("account_data"), pod.accountData);
}
-void JsonObjectConverter<RoomFilter>::fillFrom(
- const QJsonObject& jo, RoomFilter& result)
+void JsonObjectConverter<RoomFilter>::fillFrom(const QJsonObject& jo,
+ RoomFilter& result)
{
fromJson(jo.value("not_rooms"_ls), result.notRooms);
fromJson(jo.value("rooms"_ls), result.rooms);
@@ -46,8 +49,7 @@ void JsonObjectConverter<RoomFilter>::fillFrom(
fromJson(jo.value("account_data"_ls), result.accountData);
}
-void JsonObjectConverter<Filter>::dumpTo(
- QJsonObject& jo, const Filter& pod)
+void JsonObjectConverter<Filter>::dumpTo(QJsonObject& jo, const Filter& pod)
{
addParam<IfNotEmpty>(jo, QStringLiteral("event_fields"), pod.eventFields);
addParam<IfNotEmpty>(jo, QStringLiteral("event_format"), pod.eventFormat);
@@ -56,8 +58,7 @@ void JsonObjectConverter<Filter>::dumpTo(
addParam<IfNotEmpty>(jo, QStringLiteral("room"), pod.room);
}
-void JsonObjectConverter<Filter>::fillFrom(
- const QJsonObject& jo, Filter& result)
+void JsonObjectConverter<Filter>::fillFrom(const QJsonObject& jo, Filter& result)
{
fromJson(jo.value("event_fields"_ls), result.eventFields);
fromJson(jo.value("event_format"_ls), result.eventFormat);
@@ -65,4 +66,3 @@ void JsonObjectConverter<Filter>::fillFrom(
fromJson(jo.value("account_data"_ls), result.accountData);
fromJson(jo.value("room"_ls), result.room);
}
-
diff --git a/lib/csapi/definitions/sync_filter.h b/lib/csapi/definitions/sync_filter.h
index d94c74d7..1d6a845c 100644
--- a/lib/csapi/definitions/sync_filter.h
+++ b/lib/csapi/definitions/sync_filter.h
@@ -6,86 +6,102 @@
#include "converters.h"
-#include "csapi/definitions/room_event_filter.h"
-#include "converters.h"
#include "csapi/definitions/event_filter.h"
+#include "csapi/definitions/room_event_filter.h"
namespace QMatrixClient
{
- // Data structures
+// Data structures
+
+/// The state events to include for rooms.
+struct StateFilter : RoomEventFilter
+{
+ /// If ``true``, the only ``m.room.member`` events returned inthe ``state``
+ /// section of the ``/sync`` response are thosewhich are definitely necessary
+ /// for a client to displaythe ``sender`` of the timeline events in that
+ /// response.If ``false``, ``m.room.member`` events are not filtered.By
+ /// default, servers should suppress duplicate redundantlazy-loaded
+ /// ``m.room.member`` events from being sent to a givenclient across multiple
+ /// calls to ``/sync``, given that most clientscache membership events (see
+ /// ``include_redundant_members``to change this behaviour).
+ Omittable<bool> lazyLoadMembers;
+ /// If ``true``, the ``state`` section of the ``/sync`` response willalways
+ /// contain the ``m.room.member`` events required to displaythe ``sender``
+ /// of the timeline events in that response, assuming``lazy_load_members``
+ /// is enabled. This means that redundantduplicate member events may be
+ /// returned across multiple calls to``/sync``. This is useful for naive
+ /// clients who never trackmembership data. If ``false``, duplicate
+ /// ``m.room.member`` eventsmay be suppressed by the server across multiple
+ /// calls to ``/sync``.If ``lazy_load_members`` is ``false`` this field is
+ /// ignored.
+ Omittable<bool> includeRedundantMembers;
+};
+
+template <>
+struct JsonObjectConverter<StateFilter>
+{
+ static void dumpTo(QJsonObject& jo, const StateFilter& pod);
+ static void fillFrom(const QJsonObject& jo, StateFilter& pod);
+};
+
+/// Filters to be applied to room data.
+struct RoomFilter
+{
+ /// A list of room IDs to exclude. If this list is absent then no rooms are
+ /// excluded. A matching room will be excluded even if it is listed in the
+ /// ``'rooms'`` filter. This filter is applied before the filters in
+ /// ``ephemeral``, ``state``, ``timeline`` or ``account_data``
+ QStringList notRooms;
+ /// A list of room IDs to include. If this list is absent then all rooms are
+ /// included. This filter is applied before the filters in ``ephemeral``,
+ /// ``state``, ``timeline`` or ``account_data``
+ QStringList rooms;
+ /// The events that aren't recorded in the room history, e.g. typing and
+ /// receipts, to include for rooms.
+ Omittable<RoomEventFilter> ephemeral;
+ /// Include rooms that the user has left in the sync, default false
+ Omittable<bool> includeLeave;
/// The state events to include for rooms.
- struct StateFilter : RoomEventFilter
- {
- /// If ``true``, the only ``m.room.member`` events returned in
- /// the ``state`` section of the ``/sync`` response are those
- /// which are definitely necessary for a client to display
- /// the ``sender`` of the timeline events in that response.
- /// If ``false``, ``m.room.member`` events are not filtered.
- /// By default, servers should suppress duplicate redundant
- /// lazy-loaded ``m.room.member`` events from being sent to a given
- /// client across multiple calls to ``/sync``, given that most clients
- /// cache membership events (see ``include_redundant_members``
- /// to change this behaviour).
- Omittable<bool> lazyLoadMembers;
- /// If ``true``, the ``state`` section of the ``/sync`` response will
- /// always contain the ``m.room.member`` events required to display
- /// the ``sender`` of the timeline events in that response, assuming
- /// ``lazy_load_members`` is enabled. This means that redundant
- /// duplicate member events may be returned across multiple calls to
- /// ``/sync``. This is useful for naive clients who never track
- /// membership data. If ``false``, duplicate ``m.room.member`` events
- /// may be suppressed by the server across multiple calls to ``/sync``.
- /// If ``lazy_load_members`` is ``false`` this field is ignored.
- Omittable<bool> includeRedundantMembers;
- };
- template <> struct JsonObjectConverter<StateFilter>
- {
- static void dumpTo(QJsonObject& jo, const StateFilter& pod);
- static void fillFrom(const QJsonObject& jo, StateFilter& pod);
- };
+ Omittable<StateFilter> state;
+ /// The message and state update events to include for rooms.
+ Omittable<RoomEventFilter> timeline;
+ /// The per user account data to include for rooms.
+ Omittable<RoomEventFilter> accountData;
+};
+
+template <>
+struct JsonObjectConverter<RoomFilter>
+{
+ static void dumpTo(QJsonObject& jo, const RoomFilter& pod);
+ static void fillFrom(const QJsonObject& jo, RoomFilter& pod);
+};
+struct Filter
+{
+ /// List of event fields to include. If this list is absent then all fields
+ /// are included. The entries may include '.' charaters to indicate
+ /// sub-fields. So ['content.body'] will include the 'body' field of the
+ /// 'content' object. A literal '.' character in a field name may be escaped
+ /// using a '\\'. A server may include more fields than were requested.
+ QStringList eventFields;
+ /// The format to use for events. 'client' will return the events in a
+ /// format suitable for clients. 'federation' will return the raw event as
+ /// receieved over federation. The default is 'client'.
+ QString eventFormat;
+ /// The presence updates to include.
+ Omittable<EventFilter> presence;
+ /// The user account data that isn't associated with rooms to include.
+ Omittable<EventFilter> accountData;
/// Filters to be applied to room data.
- struct RoomFilter
- {
- /// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the ``'rooms'`` filter. This filter is applied before the filters in ``ephemeral``, ``state``, ``timeline`` or ``account_data``
- QStringList notRooms;
- /// A list of room IDs to include. If this list is absent then all rooms are included. This filter is applied before the filters in ``ephemeral``, ``state``, ``timeline`` or ``account_data``
- QStringList rooms;
- /// The events that aren't recorded in the room history, e.g. typing and receipts, to include for rooms.
- Omittable<RoomEventFilter> ephemeral;
- /// Include rooms that the user has left in the sync, default false
- Omittable<bool> includeLeave;
- /// The state events to include for rooms.
- Omittable<StateFilter> state;
- /// The message and state update events to include for rooms.
- Omittable<RoomEventFilter> timeline;
- /// The per user account data to include for rooms.
- Omittable<RoomEventFilter> accountData;
- };
- template <> struct JsonObjectConverter<RoomFilter>
- {
- static void dumpTo(QJsonObject& jo, const RoomFilter& pod);
- static void fillFrom(const QJsonObject& jo, RoomFilter& pod);
- };
+ Omittable<RoomFilter> room;
+};
- struct Filter
- {
- /// List of event fields to include. If this list is absent then all fields are included. The entries may include '.' charaters to indicate sub-fields. So ['content.body'] will include the 'body' field of the 'content' object. A literal '.' character in a field name may be escaped using a '\\'. A server may include more fields than were requested.
- QStringList eventFields;
- /// The format to use for events. 'client' will return the events in a format suitable for clients. 'federation' will return the raw event as receieved over federation. The default is 'client'.
- QString eventFormat;
- /// The presence updates to include.
- Omittable<EventFilter> presence;
- /// The user account data that isn't associated with rooms to include.
- Omittable<EventFilter> accountData;
- /// Filters to be applied to room data.
- Omittable<RoomFilter> room;
- };
- template <> struct JsonObjectConverter<Filter>
- {
- static void dumpTo(QJsonObject& jo, const Filter& pod);
- static void fillFrom(const QJsonObject& jo, Filter& pod);
- };
+template <>
+struct JsonObjectConverter<Filter>
+{
+ static void dumpTo(QJsonObject& jo, const Filter& pod);
+ static void fillFrom(const QJsonObject& jo, Filter& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/user_identifier.cpp b/lib/csapi/definitions/user_identifier.cpp
index 05a27c1c..52bb1ae6 100644
--- a/lib/csapi/definitions/user_identifier.cpp
+++ b/lib/csapi/definitions/user_identifier.cpp
@@ -6,18 +6,16 @@
using namespace QMatrixClient;
-void JsonObjectConverter<UserIdentifier>::dumpTo(
- QJsonObject& jo, const UserIdentifier& pod)
+void JsonObjectConverter<UserIdentifier>::dumpTo(QJsonObject& jo,
+ const UserIdentifier& pod)
{
fillJson(jo, pod.additionalProperties);
addParam<>(jo, QStringLiteral("type"), pod.type);
}
-void JsonObjectConverter<UserIdentifier>::fillFrom(
- QJsonObject jo, UserIdentifier& result)
+void JsonObjectConverter<UserIdentifier>::fillFrom(QJsonObject jo,
+ UserIdentifier& result)
{
fromJson(jo.take("type"_ls), result.type);
-
fromJson(jo, result.additionalProperties);
}
-
diff --git a/lib/csapi/definitions/user_identifier.h b/lib/csapi/definitions/user_identifier.h
index cbb1550f..51c47cca 100644
--- a/lib/csapi/definitions/user_identifier.h
+++ b/lib/csapi/definitions/user_identifier.h
@@ -10,20 +10,25 @@
namespace QMatrixClient
{
- // Data structures
+
+// Data structures
+
+/// Identification information for a user
+struct UserIdentifier
+{
+ /// The type of identification. See `Identifier types`_ for supported
+ /// values and additional property descriptions.
+ QString type;
/// Identification information for a user
- struct UserIdentifier
- {
- /// The type of identification. See `Identifier types`_ for supported values and additional property descriptions.
- QString type;
- /// Identification information for a user
- QVariantHash additionalProperties;
- };
- template <> struct JsonObjectConverter<UserIdentifier>
- {
- static void dumpTo(QJsonObject& jo, const UserIdentifier& pod);
- static void fillFrom(QJsonObject jo, UserIdentifier& pod);
- };
+ QVariantHash additionalProperties;
+};
+
+template <>
+struct JsonObjectConverter<UserIdentifier>
+{
+ static void dumpTo(QJsonObject& jo, const UserIdentifier& pod);
+ static void fillFrom(QJsonObject jo, UserIdentifier& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/wellknown/full.cpp b/lib/csapi/definitions/wellknown/full.cpp
index 5ecef34f..34d3bfbe 100644
--- a/lib/csapi/definitions/wellknown/full.cpp
+++ b/lib/csapi/definitions/wellknown/full.cpp
@@ -7,11 +7,12 @@
using namespace QMatrixClient;
void JsonObjectConverter<DiscoveryInformation>::dumpTo(
- QJsonObject& jo, const DiscoveryInformation& pod)
+ QJsonObject& jo, const DiscoveryInformation& pod)
{
fillJson(jo, pod.additionalProperties);
addParam<>(jo, QStringLiteral("m.homeserver"), pod.homeserver);
- addParam<IfNotEmpty>(jo, QStringLiteral("m.identity_server"), pod.identityServer);
+ addParam<IfNotEmpty>(jo, QStringLiteral("m.identity_server"),
+ pod.identityServer);
}
void JsonObjectConverter<DiscoveryInformation>::fillFrom(
@@ -19,7 +20,5 @@ void JsonObjectConverter<DiscoveryInformation>::fillFrom(
{
fromJson(jo.take("m.homeserver"_ls), result.homeserver);
fromJson(jo.take("m.identity_server"_ls), result.identityServer);
-
fromJson(jo, result.additionalProperties);
}
-
diff --git a/lib/csapi/definitions/wellknown/full.h b/lib/csapi/definitions/wellknown/full.h
index d9346acb..ddc06653 100644
--- a/lib/csapi/definitions/wellknown/full.h
+++ b/lib/csapi/definitions/wellknown/full.h
@@ -6,33 +6,37 @@
#include "converters.h"
-#include <QtCore/QJsonObject>
-#include "converters.h"
#include "csapi/definitions/wellknown/homeserver.h"
#include "csapi/definitions/wellknown/identity_server.h"
+
#include <QtCore/QHash>
+#include <QtCore/QJsonObject>
namespace QMatrixClient
{
- // Data structures
-
- /// Used by clients to determine the homeserver, identity server, and other
- /// optional components they should be interacting with.
- struct DiscoveryInformation
- {
- /// Used by clients to determine the homeserver, identity server, and other
- /// optional components they should be interacting with.
- HomeserverInformation homeserver;
- /// Used by clients to determine the homeserver, identity server, and other
- /// optional components they should be interacting with.
- Omittable<IdentityServerInformation> identityServer;
- /// Application-dependent keys using Java package naming convention.
- QHash<QString, QJsonObject> additionalProperties;
- };
- template <> struct JsonObjectConverter<DiscoveryInformation>
- {
- static void dumpTo(QJsonObject& jo, const DiscoveryInformation& pod);
- static void fillFrom(QJsonObject jo, DiscoveryInformation& pod);
- };
+
+// Data structures
+
+/// Used by clients to determine the homeserver, identity server, and other///
+/// optional components they should be interacting with.
+struct DiscoveryInformation
+{
+ /// Used by clients to determine the homeserver, identity server, and
+ /// otheroptional components they should be interacting with.
+ HomeserverInformation homeserver;
+ /// Used by clients to determine the homeserver, identity server, and
+ /// otheroptional components they should be interacting with.
+ Omittable<IdentityServerInformation> identityServer;
+
+ /// Application-dependent keys using Java package naming convention.
+ QHash<QString, QJsonObject> additionalProperties;
+};
+
+template <>
+struct JsonObjectConverter<DiscoveryInformation>
+{
+ static void dumpTo(QJsonObject& jo, const DiscoveryInformation& pod);
+ static void fillFrom(QJsonObject jo, DiscoveryInformation& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/wellknown/homeserver.cpp b/lib/csapi/definitions/wellknown/homeserver.cpp
index 0783f11b..f5746ede 100644
--- a/lib/csapi/definitions/wellknown/homeserver.cpp
+++ b/lib/csapi/definitions/wellknown/homeserver.cpp
@@ -7,7 +7,7 @@
using namespace QMatrixClient;
void JsonObjectConverter<HomeserverInformation>::dumpTo(
- QJsonObject& jo, const HomeserverInformation& pod)
+ QJsonObject& jo, const HomeserverInformation& pod)
{
addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl);
}
@@ -17,4 +17,3 @@ void JsonObjectConverter<HomeserverInformation>::fillFrom(
{
fromJson(jo.value("base_url"_ls), result.baseUrl);
}
-
diff --git a/lib/csapi/definitions/wellknown/homeserver.h b/lib/csapi/definitions/wellknown/homeserver.h
index f6761c30..b73cee17 100644
--- a/lib/csapi/definitions/wellknown/homeserver.h
+++ b/lib/csapi/definitions/wellknown/homeserver.h
@@ -6,21 +6,23 @@
#include "converters.h"
-
namespace QMatrixClient
{
- // Data structures
- /// Used by clients to discover homeserver information.
- struct HomeserverInformation
- {
- /// The base URL for the homeserver for client-server connections.
- QString baseUrl;
- };
- template <> struct JsonObjectConverter<HomeserverInformation>
- {
- static void dumpTo(QJsonObject& jo, const HomeserverInformation& pod);
- static void fillFrom(const QJsonObject& jo, HomeserverInformation& pod);
- };
+// Data structures
+
+/// Used by clients to discover homeserver information.
+struct HomeserverInformation
+{
+ /// The base URL for the homeserver for client-server connections.
+ QString baseUrl;
+};
+
+template <>
+struct JsonObjectConverter<HomeserverInformation>
+{
+ static void dumpTo(QJsonObject& jo, const HomeserverInformation& pod);
+ static void fillFrom(const QJsonObject& jo, HomeserverInformation& pod);
+};
} // namespace QMatrixClient
diff --git a/lib/csapi/definitions/wellknown/identity_server.cpp b/lib/csapi/definitions/wellknown/identity_server.cpp
index 99f36641..922d4665 100644
--- a/lib/csapi/definitions/wellknown/identity_server.cpp
+++ b/lib/csapi/definitions/wellknown/identity_server.cpp
@@ -7,7 +7,7 @@
using namespace QMatrixClient;
void JsonObjectConverter<IdentityServerInformation>::dumpTo(
- QJsonObject& jo, const IdentityServerInformation& pod)
+ QJsonObject& jo, const IdentityServerInformation& pod)
{
addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl);
}
@@ -17,4 +17,3 @@ void JsonObjectConverter<IdentityServerInformation>::fillFrom(
{
fromJson(jo.value("base_url"_ls), result.baseUrl);
}
-
diff --git a/lib/csapi/definitions/wellknown/identity_server.h b/lib/csapi/definitions/wellknown/identity_server.h
index 67d8b08d..a35644fc 100644
--- a/lib/csapi/definitions/wellknown/identity_server.h
+++ b/lib/csapi/definitions/wellknown/identity_server.h
@@ -6,21 +6,23 @@
#include "converters.h"
-
namespace QMatrixClient
{
- // Data structures
- /// Used by clients to discover identity server information.
- struct IdentityServerInformation
- {
- /// The base URL for the identity server for client-server connections.
- QString baseUrl;
- };
- template <> struct JsonObjectConverter<IdentityServerInformation>
- {
- static void dumpTo(QJsonObject& jo, const IdentityServerInformation& pod);
- static void fillFrom(const QJsonObject& jo, IdentityServerInformation& pod);
- };
+// Data structures
+
+/// Used by clients to discover identity server information.
+struct IdentityServerInformation
+{
+ /// The base URL for the identity server for client-server connections.
+ QString baseUrl;
+};
+
+template <>
+struct JsonObjectConverter<IdentityServerInformation>
+{
+ static void dumpTo(QJsonObject& jo, const IdentityServerInformation& pod);
+ static void fillFrom(const QJsonObject& jo, IdentityServerInformation& pod);
+};
} // namespace QMatrixClient