From de05579f18a5c264fe0dbea68ea83abcff526d00 Mon Sep 17 00:00:00 2001 From: Kitsune Ral <Kitsune-Ral@users.sf.net> Date: Mon, 26 Mar 2018 08:03:16 -0400 Subject: Connection::directChatUsers() --- connection.cpp | 6 ++++++ connection.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/connection.cpp b/connection.cpp index db8bb085..e4e622a3 100644 --- a/connection.cpp +++ b/connection.cpp @@ -702,6 +702,12 @@ bool Connection::isDirectChat(const QString& roomId) const return d->directChats.key(roomId) != nullptr; } +QList<const User*> Connection::directChatUsers(const Room* room) const +{ + Q_ASSERT(room != nullptr); + return d->directChats.keys(room->id()); +} + QMap<QString, User*> Connection::users() const { return d->userMap; diff --git a/connection.h b/connection.h index 7c11c32d..c6d543ec 100644 --- a/connection.h +++ b/connection.h @@ -114,6 +114,12 @@ namespace QMatrixClient /** Check whether the room id corresponds to a direct chat */ bool isDirectChat(const QString& roomId) const; + /** Retrieve the list of users the room is a direct chat with + * @return The list of users for which this room is marked as + * a direct chat; an empty list if the room is not a direct chat + */ + QList<const User*> directChatUsers(const Room* room) const; + QMap<QString, User*> users() const; // FIXME: Convert Q_INVOKABLEs to Q_PROPERTIES -- cgit v1.2.3