diff --git a/src/neochatroom.cpp b/src/neochatroom.cpp index eaa6c3dab..3d88c6df3 100644 --- a/src/neochatroom.cpp +++ b/src/neochatroom.cpp @@ -418,30 +418,6 @@ QDateTime NeoChatRoom::lastActiveTime() return messageEvents().rbegin()->get()->originTimestamp(); } -QVariantList NeoChatRoom::getUsers(const QString &keyword, int limit) const -{ - const auto userList = users(); - QVariantList matchedList; - int count = 0; - for (const auto u : userList) { - if (u->displayname(this).contains(keyword, Qt::CaseInsensitive)) { - Quotient::User user(u->id(), u->connection()); - QVariantMap userVariant{{QStringLiteral("id"), user.id()}, - {QStringLiteral("displayName"), user.displayname(this)}, - {QStringLiteral("avatarMediaId"), user.avatarMediaId(this)}, - {QStringLiteral("color"), Utils::getUserColor(user.hueF())}}; - - matchedList.append(QVariant::fromValue(userVariant)); - count++; - if (count == limit) { // -1 is infinite - break; - } - } - } - - return matchedList; -} - // An empty user is useful for returning as a model value to avoid properties being undefined. static const QVariantMap emptyUser = { {"isLocalUser"_ls, false}, diff --git a/src/neochatroom.h b/src/neochatroom.h index 4abb43e2b..9ae470c76 100644 --- a/src/neochatroom.h +++ b/src/neochatroom.h @@ -324,28 +324,6 @@ public: explicit NeoChatRoom(Quotient::Connection *connection, QString roomId, Quotient::JoinState joinState = {}); - /** - * @brief Get a list of users in the context of this room. - * - * This is different to getting a list of Quotient::User objects - * as neither of those can provide details like the displayName or avatarMediaId - * without the room context as these can vary from room to room. This function - * provides the room context and returns the result as a list of QVariantMap objects. - * - * @param keyword filters the users based on the displayname containing keyword. - * @param limit max number of user returned, -1 is infinite. - * - * @return a QVariantList containing a QVariantMap for each user with the following - * properties: - * - id - User ID. - * - displayName - Display name in the context of this room. - * - avatarMediaId - Avatar id in the context of this room. - * - color - Color for the user. - * - * @sa Quotient::User - */ - Q_INVOKABLE [[nodiscard]] QVariantList getUsers(const QString &keyword, int limit = -1) const; - /** * @brief Get a user in the context of this room. *