aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connection.cpp6
-rw-r--r--connection.h6
2 files changed, 12 insertions, 0 deletions
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