From aacc4bcb4a487871daae6717f77605aaba444341 Mon Sep 17 00:00:00 2001 From: Marc Deop Date: Sat, 2 Mar 2019 12:26:57 +0100 Subject: style: apply .clang-format to all .cpp and .h files --- lib/csapi/users.h | 89 +++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 45 deletions(-) (limited to 'lib/csapi/users.h') diff --git a/lib/csapi/users.h b/lib/csapi/users.h index 1e355b8f..7754b82a 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -6,11 +6,10 @@ #include "jobs/basejob.h" -#include #include "converters.h" +#include -namespace QMatrixClient -{ +namespace QMatrixClient { // Operations /// Searches the user directory. @@ -18,61 +17,61 @@ namespace QMatrixClient /// Performs a search for users on the homeserver. The homeserver may /// determine which subset of users are searched, however the homeserver /// MUST at a minimum consider the users the requesting user shares a - /// room with and those who reside in public rooms (known to the homeserver). - /// The search MUST consider local users to the homeserver, and SHOULD - /// query remote users as part of the search. - /// + /// room with and those who reside in public rooms (known to the + /// homeserver). The search MUST consider local users to the homeserver, and + /// SHOULD query remote users as part of the search. + /// /// The search is performed case-insensitively on user IDs and display - /// names preferably using a collation determined based upon the + /// names preferably using a collation determined based upon the /// ``Accept-Language`` header provided in the request, if present. class SearchUserDirectoryJob : public BaseJob { public: - // Inner data structures + // Inner data structures - /// Performs a search for users on the homeserver. The homeserver may - /// determine which subset of users are searched, however the homeserver - /// MUST at a minimum consider the users the requesting user shares a - /// room with and those who reside in public rooms (known to the homeserver). - /// The search MUST consider local users to the homeserver, and SHOULD - /// query remote users as part of the search. - /// - /// The search is performed case-insensitively on user IDs and display - /// names preferably using a collation determined based upon the - /// ``Accept-Language`` header provided in the request, if present. - struct User - { - /// The user's matrix user ID. - QString userId; - /// The display name of the user, if one exists. - QString displayName; - /// The avatar url, as an MXC, if one exists. - QString avatarUrl; - }; + /// Performs a search for users on the homeserver. The homeserver may + /// determine which subset of users are searched, however the homeserver + /// MUST at a minimum consider the users the requesting user shares a + /// room with and those who reside in public rooms (known to the + /// homeserver). The search MUST consider local users to the homeserver, + /// and SHOULD query remote users as part of the search. + /// + /// The search is performed case-insensitively on user IDs and display + /// names preferably using a collation determined based upon the + /// ``Accept-Language`` header provided in the request, if present. + struct User { + /// The user's matrix user ID. + QString userId; + /// The display name of the user, if one exists. + QString displayName; + /// The avatar url, as an MXC, if one exists. + QString avatarUrl; + }; - // Construction/destruction + // Construction/destruction - /*! Searches the user directory. - * \param searchTerm - * The term to search for - * \param limit - * The maximum number of results to return. Defaults to 10. - */ - explicit SearchUserDirectoryJob(const QString& searchTerm, Omittable limit = none); - ~SearchUserDirectoryJob() override; + /*! Searches the user directory. + * \param searchTerm + * The term to search for + * \param limit + * The maximum number of results to return. Defaults to 10. + */ + explicit SearchUserDirectoryJob(const QString& searchTerm, + Omittable limit = none); + ~SearchUserDirectoryJob() override; - // Result properties + // Result properties - /// Ordered by rank and then whether or not profile info is available. - const QVector& results() const; - /// Indicates if the result list has been truncated by the limit. - bool limited() const; + /// Ordered by rank and then whether or not profile info is available. + const QVector& results() const; + /// Indicates if the result list has been truncated by the limit. + bool limited() const; protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer d; + class Private; + QScopedPointer d; }; } // namespace QMatrixClient -- cgit v1.2.3 From 27ca32a1e5a56e09b9cc1d94224d2831004dcf3d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 19:32:34 +0900 Subject: Namespace: QMatrixClient -> Quotient (with back comp alias) --- lib/csapi/users.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/csapi/users.h') diff --git a/lib/csapi/users.h b/lib/csapi/users.h index 2e86c009..d9a16a9d 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -10,7 +10,7 @@ #include -namespace QMatrixClient +namespace Quotient { // Operations @@ -80,4 +80,4 @@ private: QScopedPointer d; }; -} // namespace QMatrixClient +} // namespace Quotient -- cgit v1.2.3 From 7036ed0dcb137cb5cbb6b426dd338c5e2e4c6424 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 17 Apr 2020 07:42:13 +0200 Subject: Regenerate API files using new GTAD and refreshed templates No functional changes. --- lib/csapi/users.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'lib/csapi/users.h') diff --git a/lib/csapi/users.h b/lib/csapi/users.h index d9a16a9d..de4eb529 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -10,13 +10,12 @@ #include -namespace Quotient -{ +namespace Quotient { // Operations -/// Searches the user directory. -/*! +/*! \brief Searches the user directory. + * * Performs a search for users on the homeserver. The homeserver may * determine which subset of users are searched, however the homeserver * MUST at a minimum consider the users the requesting user shares a @@ -28,22 +27,21 @@ namespace Quotient * names preferably using a collation determined based upon the * ``Accept-Language`` header provided in the request, if present. */ -class SearchUserDirectoryJob : public BaseJob -{ +class SearchUserDirectoryJob : public BaseJob { public: // Inner data structures - /// Performs a search for users on the homeserver. The homeserver - /// maydetermine which subset of users are searched, however the - /// homeserverMUST at a minimum consider the users the requesting user - /// shares aroom with and those who reside in public rooms (known to the - /// homeserver).The search MUST consider local users to the homeserver, and - /// SHOULDquery remote users as part of the search.The search is performed - /// case-insensitively on user IDs and displaynames preferably using a - /// collation determined based upon the ``Accept-Language`` header provided - /// in the request, if present. - struct User - { + /// Performs a search for users on the homeserver. The homeserver may + /// determine which subset of users are searched, however the homeserver + /// MUST at a minimum consider the users the requesting user shares a + /// room with and those who reside in public rooms (known to the + /// homeserver). The search MUST consider local users to the homeserver, and + /// SHOULD query remote users as part of the search. + /// + /// The search is performed case-insensitively on user IDs and display + /// names preferably using a collation determined based upon the + /// ``Accept-Language`` header provided in the request, if present. + struct User { /// The user's matrix user ID. QString userId; /// The display name of the user, if one exists. @@ -54,7 +52,8 @@ public: // Construction/destruction - /*! Searches the user directory. + /*! \brief Searches the user directory. + * * \param searchTerm * The term to search for * \param limit @@ -69,6 +68,7 @@ public: /// Ordered by rank and then whether or not profile info is available. const QVector& results() const; + /// Indicates if the result list has been truncated by the limit. bool limited() const; -- cgit v1.2.3 From 32729d9a7519cd2c4cddb0174b8329c6fd4a4a83 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jun 2020 19:46:40 +0200 Subject: Update generated files according to gtad/* changes --- lib/csapi/users.h | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'lib/csapi/users.h') diff --git a/lib/csapi/users.h b/lib/csapi/users.h index de4eb529..adb2a33d 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -4,19 +4,13 @@ #pragma once -#include "converters.h" - #include "jobs/basejob.h" -#include - namespace Quotient { -// Operations - /*! \brief Searches the user directory. * - * Performs a search for users on the homeserver. The homeserver may + * Performs a search for users. The homeserver may * determine which subset of users are searched, however the homeserver * MUST at a minimum consider the users the requesting user shares a * room with and those who reside in public rooms (known to the homeserver). @@ -31,7 +25,7 @@ class SearchUserDirectoryJob : public BaseJob { public: // Inner data structures - /// Performs a search for users on the homeserver. The homeserver may + /// Performs a search for users. The homeserver may /// determine which subset of users are searched, however the homeserver /// MUST at a minimum consider the users the requesting user shares a /// room with and those who reside in public rooms (known to the @@ -41,7 +35,7 @@ public: /// The search is performed case-insensitively on user IDs and display /// names preferably using a collation determined based upon the /// ``Accept-Language`` header provided in the request, if present. - struct User { + struct SearchUserDirectory200ThirdPartyUser { /// The user's matrix user ID. QString userId; /// The display name of the user, if one exists. @@ -53,31 +47,41 @@ public: // Construction/destruction /*! \brief Searches the user directory. + * * * \param searchTerm * The term to search for + * * \param limit * The maximum number of results to return. Defaults to 10. */ explicit SearchUserDirectoryJob(const QString& searchTerm, Omittable limit = none); - ~SearchUserDirectoryJob() override; - // Result properties /// Ordered by rank and then whether or not profile info is available. - const QVector& results() const; + QVector results() const + { + return loadFromJson>( + "results"_ls); + } /// Indicates if the result list has been truncated by the limit. - bool limited() const; - -protected: - Status parseJson(const QJsonDocument& data) override; + bool limited() const { return loadFromJson("limited"_ls); } +}; -private: - class Private; - QScopedPointer d; +template <> +struct JsonObjectConverter< + SearchUserDirectoryJob::SearchUserDirectory200ThirdPartyUser> { + static void + fillFrom(const QJsonObject& jo, + SearchUserDirectoryJob::SearchUserDirectory200ThirdPartyUser& result) + { + fromJson(jo.value("user_id"_ls), result.userId); + fromJson(jo.value("display_name"_ls), result.displayName); + fromJson(jo.value("avatar_url"_ls), result.avatarUrl); + } }; } // namespace Quotient -- cgit v1.2.3 From e17764a1ae81393968dfb747c7b67353c109bc71 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 19 Jun 2020 15:01:33 +0200 Subject: csapi/: generated using the latest GTAD and matrix-doc For matrix-doc, specifically, it is master (5cb4b086) merged with https://github.com/matrix-org/matrix-doc/pull/2518. --- lib/csapi/users.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'lib/csapi/users.h') diff --git a/lib/csapi/users.h b/lib/csapi/users.h index adb2a33d..6fc26f57 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -35,7 +35,7 @@ public: /// The search is performed case-insensitively on user IDs and display /// names preferably using a collation determined based upon the /// ``Accept-Language`` header provided in the request, if present. - struct SearchUserDirectory200ThirdPartyUser { + struct User { /// The user's matrix user ID. QString userId; /// The display name of the user, if one exists. @@ -47,7 +47,6 @@ public: // Construction/destruction /*! \brief Searches the user directory. - * * * \param searchTerm * The term to search for @@ -61,10 +60,9 @@ public: // Result properties /// Ordered by rank and then whether or not profile info is available. - QVector results() const + QVector results() const { - return loadFromJson>( - "results"_ls); + return loadFromJson>("results"_ls); } /// Indicates if the result list has been truncated by the limit. @@ -72,11 +70,9 @@ public: }; template <> -struct JsonObjectConverter< - SearchUserDirectoryJob::SearchUserDirectory200ThirdPartyUser> { - static void - fillFrom(const QJsonObject& jo, - SearchUserDirectoryJob::SearchUserDirectory200ThirdPartyUser& result) +struct JsonObjectConverter { + static void fillFrom(const QJsonObject& jo, + SearchUserDirectoryJob::User& result) { fromJson(jo.value("user_id"_ls), result.userId); fromJson(jo.value("display_name"_ls), result.displayName); -- cgit v1.2.3 From 0d4315008374d9a4dfb11f934875b1a16670ec74 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 23 Jun 2021 19:12:38 +0200 Subject: Re-generate API files --- lib/csapi/users.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/csapi/users.h') diff --git a/lib/csapi/users.h b/lib/csapi/users.h index 6fc26f57..772a6365 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -19,7 +19,7 @@ namespace Quotient { * * The search is performed case-insensitively on user IDs and display * names preferably using a collation determined based upon the - * ``Accept-Language`` header provided in the request, if present. + * `Accept-Language` header provided in the request, if present. */ class SearchUserDirectoryJob : public BaseJob { public: @@ -34,7 +34,7 @@ public: /// /// The search is performed case-insensitively on user IDs and display /// names preferably using a collation determined based upon the - /// ``Accept-Language`` header provided in the request, if present. + /// `Accept-Language` header provided in the request, if present. struct User { /// The user's matrix user ID. QString userId; @@ -66,7 +66,10 @@ public: } /// Indicates if the result list has been truncated by the limit. - bool limited() const { return loadFromJson("limited"_ls); } + bool limited() const + { + return loadFromJson("limited"_ls); + } }; template <> -- cgit v1.2.3 From f7cbefe5ad626ae1798a5d7bb7546e89ad336acd Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 7 Aug 2021 16:55:06 +0200 Subject: API files: reformat after .clang-format change See 000b5730. --- lib/csapi/users.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/csapi/users.h') diff --git a/lib/csapi/users.h b/lib/csapi/users.h index 772a6365..eab18f6c 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -66,10 +66,7 @@ public: } /// Indicates if the result list has been truncated by the limit. - bool limited() const - { - return loadFromJson("limited"_ls); - } + bool limited() const { return loadFromJson("limited"_ls); } }; template <> -- cgit v1.2.3 From bd649c591fa020fde0bd56a63c13025097b831ae Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 7 Aug 2021 22:12:46 +0200 Subject: Update generated files This uses API definition files from https://github.com/matrix-org/matrix-doc/pull/3236, and additionally makes uploadFile>content_uri to have 'format: uri' (as suggested in the PR review). Only use this commit with the next one; alone it breaks the build. --- lib/csapi/users.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/csapi/users.h') diff --git a/lib/csapi/users.h b/lib/csapi/users.h index eab18f6c..ec186592 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -41,7 +41,7 @@ public: /// The display name of the user, if one exists. QString displayName; /// The avatar url, as an MXC, if one exists. - QString avatarUrl; + QUrl avatarUrl; }; // Construction/destruction -- cgit v1.2.3 From 952f8aa8ad19348b50a3b3545d98f7889bfdae76 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 29 Dec 2021 15:57:33 +0100 Subject: Regenerate CS API files --- lib/csapi/users.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/csapi/users.h') diff --git a/lib/csapi/users.h b/lib/csapi/users.h index ec186592..3c99758b 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -21,7 +21,7 @@ namespace Quotient { * names preferably using a collation determined based upon the * `Accept-Language` header provided in the request, if present. */ -class SearchUserDirectoryJob : public BaseJob { +class QUOTIENT_API SearchUserDirectoryJob : public BaseJob { public: // Inner data structures -- cgit v1.2.3