aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-08 17:44:42 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-08 17:44:42 +0900
commit3489b77bba1b9429925dfe9539c2a9e8137fc622 (patch)
tree59a7cb3bc7b25eee12a37c43db4c069b7c240464 /lib/csapi
parent39204f0099e5556eb46bed00f3b31413af860a45 (diff)
parent5ea115d6eb0b60dfd0c2be5fbe5e69615b133238 (diff)
downloadlibquotient-3489b77bba1b9429925dfe9539c2a9e8137fc622.tar.gz
libquotient-3489b77bba1b9429925dfe9539c2a9e8137fc622.zip
Merge branch 'kitsune-tweaks-fixes'
Diffstat (limited to 'lib/csapi')
-rw-r--r--lib/csapi/definitions/room_event_filter.cpp6
-rw-r--r--lib/csapi/definitions/room_event_filter.h4
-rw-r--r--lib/csapi/kicking.h2
-rw-r--r--lib/csapi/read_markers.h2
-rw-r--r--lib/csapi/rooms.cpp40
-rw-r--r--lib/csapi/rooms.h26
6 files changed, 12 insertions, 68 deletions
diff --git a/lib/csapi/definitions/room_event_filter.cpp b/lib/csapi/definitions/room_event_filter.cpp
index f6f1e5cb..8cd2ded7 100644
--- a/lib/csapi/definitions/room_event_filter.cpp
+++ b/lib/csapi/definitions/room_event_filter.cpp
@@ -12,6 +12,8 @@ QJsonObject QMatrixClient::toJson(const RoomEventFilter& pod)
addParam<IfNotEmpty>(jo, QStringLiteral("not_rooms"), pod.notRooms);
addParam<IfNotEmpty>(jo, QStringLiteral("rooms"), pod.rooms);
addParam<IfNotEmpty>(jo, QStringLiteral("contains_url"), pod.containsUrl);
+ addParam<IfNotEmpty>(jo, QStringLiteral("lazy_load_members"), pod.lazyLoadMembers);
+ addParam<IfNotEmpty>(jo, QStringLiteral("include_redundant_members"), pod.includeRedundantMembers);
return jo;
}
@@ -24,6 +26,10 @@ RoomEventFilter FromJsonObject<RoomEventFilter>::operator()(const QJsonObject& j
fromJson<QStringList>(jo.value("rooms"_ls));
result.containsUrl =
fromJson<bool>(jo.value("contains_url"_ls));
+ result.lazyLoadMembers =
+ fromJson<bool>(jo.value("lazy_load_members"_ls));
+ result.includeRedundantMembers =
+ fromJson<bool>(jo.value("include_redundant_members"_ls));
return result;
}
diff --git a/lib/csapi/definitions/room_event_filter.h b/lib/csapi/definitions/room_event_filter.h
index 697fe661..87f01189 100644
--- a/lib/csapi/definitions/room_event_filter.h
+++ b/lib/csapi/definitions/room_event_filter.h
@@ -21,6 +21,10 @@ namespace QMatrixClient
QStringList rooms;
/// If ``true``, includes only events with a ``url`` key in their content. If ``false``, excludes those events. Defaults to ``false``.
bool containsUrl;
+ /// 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).
+ 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.
+ bool includeRedundantMembers;
};
QJsonObject toJson(const RoomEventFilter& pod);
diff --git a/lib/csapi/kicking.h b/lib/csapi/kicking.h
index 5968187e..714079cf 100644
--- a/lib/csapi/kicking.h
+++ b/lib/csapi/kicking.h
@@ -29,7 +29,7 @@ namespace QMatrixClient
* \param userId
* The fully qualified user ID of the user being kicked.
* \param reason
- * The reason the user has been kicked. This will be supplied as the
+ * The reason the user has been kicked. This will be supplied as the
* ``reason`` on the target's updated `m.room.member`_ event.
*/
explicit KickJob(const QString& roomId, const QString& userId, const QString& reason = {});
diff --git a/lib/csapi/read_markers.h b/lib/csapi/read_markers.h
index f19f46b0..d982b477 100644
--- a/lib/csapi/read_markers.h
+++ b/lib/csapi/read_markers.h
@@ -26,7 +26,7 @@ namespace QMatrixClient
* event MUST belong to the room.
* \param mRead
* The event ID to set the read receipt location at. This is
- * equivalent to calling ``/receipt/m.read/$elsewhere:domain.com``
+ * equivalent to calling ``/receipt/m.read/$elsewhere:example.org``
* and is provided here to save that extra call.
*/
explicit SetReadMarkerJob(const QString& roomId, const QString& mFullyRead, const QString& mRead = {});
diff --git a/lib/csapi/rooms.cpp b/lib/csapi/rooms.cpp
index 3befeee5..cebb295a 100644
--- a/lib/csapi/rooms.cpp
+++ b/lib/csapi/rooms.cpp
@@ -46,12 +46,6 @@ BaseJob::Status GetOneRoomEventJob::parseJson(const QJsonDocument& data)
return Success;
}
-class GetRoomStateWithKeyJob::Private
-{
- public:
- StateEventPtr data;
-};
-
QUrl GetRoomStateWithKeyJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventType, const QString& stateKey)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
@@ -63,29 +57,9 @@ static const auto GetRoomStateWithKeyJobName = QStringLiteral("GetRoomStateWithK
GetRoomStateWithKeyJob::GetRoomStateWithKeyJob(const QString& roomId, const QString& eventType, const QString& stateKey)
: BaseJob(HttpVerb::Get, GetRoomStateWithKeyJobName,
basePath % "/rooms/" % roomId % "/state/" % eventType % "/" % stateKey)
- , d(new Private)
-{
-}
-
-GetRoomStateWithKeyJob::~GetRoomStateWithKeyJob() = default;
-
-StateEventPtr&& GetRoomStateWithKeyJob::data()
{
- return std::move(d->data);
-}
-
-BaseJob::Status GetRoomStateWithKeyJob::parseJson(const QJsonDocument& data)
-{
- d->data = fromJson<StateEventPtr>(data);
- return Success;
}
-class GetRoomStateByTypeJob::Private
-{
- public:
- StateEventPtr data;
-};
-
QUrl GetRoomStateByTypeJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventType)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
@@ -97,21 +71,7 @@ static const auto GetRoomStateByTypeJobName = QStringLiteral("GetRoomStateByType
GetRoomStateByTypeJob::GetRoomStateByTypeJob(const QString& roomId, const QString& eventType)
: BaseJob(HttpVerb::Get, GetRoomStateByTypeJobName,
basePath % "/rooms/" % roomId % "/state/" % eventType)
- , d(new Private)
-{
-}
-
-GetRoomStateByTypeJob::~GetRoomStateByTypeJob() = default;
-
-StateEventPtr&& GetRoomStateByTypeJob::data()
{
- return std::move(d->data);
-}
-
-BaseJob::Status GetRoomStateByTypeJob::parseJson(const QJsonDocument& data)
-{
- d->data = fromJson<StateEventPtr>(data);
- return Success;
}
class GetRoomStateJob::Private
diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h
index 2366918b..80895b4e 100644
--- a/lib/csapi/rooms.h
+++ b/lib/csapi/rooms.h
@@ -80,19 +80,6 @@ namespace QMatrixClient
*/
static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventType, const QString& stateKey);
- ~GetRoomStateWithKeyJob() override;
-
- // Result properties
-
- /// The content of the state event.
- StateEventPtr&& data();
-
- protected:
- Status parseJson(const QJsonDocument& data) override;
-
- private:
- class Private;
- QScopedPointer<Private> d;
};
/// Get the state identified by the type, with the empty state key.
@@ -122,19 +109,6 @@ namespace QMatrixClient
*/
static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventType);
- ~GetRoomStateByTypeJob() override;
-
- // Result properties
-
- /// The content of the state event.
- StateEventPtr&& data();
-
- protected:
- Status parseJson(const QJsonDocument& data) override;
-
- private:
- class Private;
- QScopedPointer<Private> d;
};
/// Get all state events in the current state of a room.