diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-03-26 12:35:49 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-03-25 21:38:03 -0700 |
commit | 381ab25563cce26be8e3983b3fb3b8090385a766 (patch) | |
tree | bf8c4fed0c8b8d49af23676762d549f7bdd37cb6 /connection.h | |
parent | b385baadc8e73ff3c499a0111e2a553d35dd29b6 (diff) | |
download | libquotient-381ab25563cce26be8e3983b3fb3b8090385a766.tar.gz libquotient-381ab25563cce26be8e3983b3fb3b8090385a766.zip |
Connection::doInDirectChat() and refactored direct chat requesting logic
Basically, the whole requestDirectChat() body has been moved and generalised to doInDirectChat(), and requestDirectChat() delegates to doInDirectChat(). The logic has been updated to cope with formerly left/forgotten rooms present in the list of direct chats (cleaning up the list along the way).
Diffstat (limited to 'connection.h')
-rw-r--r-- | connection.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/connection.h b/connection.h index 6a5285f9..7c11c32d 100644 --- a/connection.h +++ b/connection.h @@ -261,6 +261,15 @@ namespace QMatrixClient */ Q_INVOKABLE void requestDirectChat(const QString& userId); + /** 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. + */ + Q_INVOKABLE void doInDirectChat(const QString& userId, + std::function<void(Room*)> operation); + /** Create a direct chat with a single user, optional name and topic * A room will always be created, unlike in requestDirectChat. * It is advised to use requestDirectChat as a default way of getting |