diff options
author | Black Hat <bhat@encom.eu.org> | 2019-09-26 22:22:36 -0700 |
---|---|---|
committer | Black Hat <bhat@encom.eu.org> | 2019-09-26 22:22:36 -0700 |
commit | 363cf452bcdbaf6ff1cf94a83ca66cbb31122346 (patch) | |
tree | c64c8fda885e4e1785130e8ee3e7c47fd18cbf67 /lib/csapi/users.h | |
parent | 412e2cf19449e73aa7da729e9c5de6502687aade (diff) | |
parent | 944653463fe4134c82d85e2d01e2bc0fa43fd727 (diff) | |
download | libquotient-363cf452bcdbaf6ff1cf94a83ca66cbb31122346.tar.gz libquotient-363cf452bcdbaf6ff1cf94a83ca66cbb31122346.zip |
Merge branch 'master' of https://github.com/quotient-im/libQuotient into
bhat-libqtolm-update
Diffstat (limited to 'lib/csapi/users.h')
-rw-r--r-- | lib/csapi/users.h | 135 |
1 files changed, 70 insertions, 65 deletions
diff --git a/lib/csapi/users.h b/lib/csapi/users.h index 1e355b8f..d9a16a9d 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -4,75 +4,80 @@ #pragma once +#include "converters.h" + #include "jobs/basejob.h" #include <QtCore/QVector> -#include "converters.h" -namespace QMatrixClient +namespace Quotient +{ + +// Operations + +/// 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 + * 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. + */ +class SearchUserDirectoryJob : public BaseJob { - // Operations - - /// 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 - /// 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. - 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 { - public: - // 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; - }; - - // 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<int> limit = none); - ~SearchUserDirectoryJob() override; - - // Result properties - - /// Ordered by rank and then whether or not profile info is available. - const QVector<User>& results() const; - /// Indicates if the result list has been truncated by the limit. - bool limited() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; + /// 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; }; -} // namespace QMatrixClient + + // 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<int> limit = none); + + ~SearchUserDirectoryJob() override; + + // Result properties + + /// Ordered by rank and then whether or not profile info is available. + const QVector<User>& results() const; + /// Indicates if the result list has been truncated by the limit. + bool limited() const; + +protected: + Status parseJson(const QJsonDocument& data) override; + +private: + class Private; + QScopedPointer<Private> d; +}; + +} // namespace Quotient |