From b028dff6bf6074fdeea5d6f50e97df074f53b45b Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 11 Aug 2018 15:24:41 +0900 Subject: Connection::*DirectChat(): add overloads accepting User* --- lib/connection.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'lib/connection.h') diff --git a/lib/connection.h b/lib/connection.h index 5d817d69..e761acfd 100644 --- a/lib/connection.h +++ b/lib/connection.h @@ -385,6 +385,15 @@ namespace QMatrixClient */ void requestDirectChat(const QString& userId); + /** Get a direct chat with a single user + * This method may return synchronously or asynchoronously depending + * on whether a direct chat room with the respective person exists + * already. + * + * \sa directChatAvailable + */ + void requestDirectChat(const User* u); + /** Run an operation in a direct chat with the user * This method may return synchronously or asynchoronously depending * on whether a direct chat room with the respective person exists @@ -392,7 +401,16 @@ namespace QMatrixClient * function object with the direct chat room as its parameter. */ void doInDirectChat(const QString& userId, - std::function operation); + const std::function& operation); + + /** Run an operation in a direct chat with the user + * This method may return synchronously or asynchoronously depending + * on whether a direct chat room with the respective person exists + * already. Instead of emitting a signal it executes the passed + * function object with the direct chat room as its parameter. + */ + void doInDirectChat(const User* u, + const std::function& operation); /** Create a direct chat with a single user, optional name and topic * A room will always be created, unlike in requestDirectChat. -- cgit v1.2.3