aboutsummaryrefslogtreecommitdiff
path: root/connection.h
diff options
context:
space:
mode:
Diffstat (limited to 'connection.h')
-rw-r--r--connection.h31
1 files changed, 26 insertions, 5 deletions
diff --git a/connection.h b/connection.h
index 4497e200..7c11c32d 100644
--- a/connection.h
+++ b/connection.h
@@ -89,18 +89,30 @@ namespace QMatrixClient
/** Get the list of rooms with the specified tag */
QVector<Room*> roomsWithTag(const QString& tagName) const;
- /** Mark the room as a direct chat with the user */
+ /** Mark the room as a direct chat with the user
+ * This function marks \p room as a direct chat with \p user.
+ * Emits the signal synchronously, without waiting to complete
+ * synchronisation with the server.
+ *
+ * \sa directChatsListChanged
+ */
void addToDirectChats(const Room* room, const User* user);
/** Unmark the room from direct chats
- * This function removes the room from direct chats either for
+ * This function removes the room id from direct chats either for
* a specific \p user or for all users if \p user in nullptr.
+ * The room id is used to allow removal of, e.g., ids of forgotten
+ * rooms; a Room object need not exist. Emits the signal
+ * immediately, without waiting to complete synchronisation with
+ * the server.
+ *
+ * \sa directChatsListChanged
*/
- void removeFromDirectChats(const Room* room,
+ void removeFromDirectChats(const QString& roomId,
const User* user = nullptr);
- /** Check whether the room is a direct chat */
- bool isDirectChat(const Room* room) const;
+ /** Check whether the room id corresponds to a direct chat */
+ bool isDirectChat(const QString& roomId) const;
QMap<QString, User*> users() const;
@@ -249,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