aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-04-01 14:19:56 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-04-01 14:19:56 +0900
commit9b856f28f2745a6d1f0425b8e7ac9c91119f3f36 (patch)
tree45cd25d64509faa8184d717a24f2b0c4eb416d1e /lib/connection.h
parent62dc885e46838368f5bba3f3e2fd0985dda36af1 (diff)
downloadlibquotient-9b856f28f2745a6d1f0425b8e7ac9c91119f3f36.tar.gz
libquotient-9b856f28f2745a6d1f0425b8e7ac9c91119f3f36.zip
Pass actual changes with Connection::directChatsListChanged()
Also: provide Connection::directChats() to get the whole direct chats map.
Diffstat (limited to 'lib/connection.h')
-rw-r--r--lib/connection.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/connection.h b/lib/connection.h
index c6d543ec..016c7e3c 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -64,6 +64,8 @@ namespace QMatrixClient
using user_factory_t =
std::function<User*(Connection*, const QString&)>;
+ using DirectChatsMap = QMultiHash<const User*, QString>;
+
enum RoomVisibility { PublishRoom, UnpublishRoom }; // FIXME: Should go inside CreateRoomJob
explicit Connection(QObject* parent = nullptr);
@@ -114,16 +116,18 @@ namespace QMatrixClient
/** Check whether the room id corresponds to a direct chat */
bool isDirectChat(const QString& roomId) const;
+ /** Get the whole map from users to direct chat rooms */
+ DirectChatsMap directChats() 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;
+ /** Get the full list of users known to this account */
QMap<QString, User*> users() const;
- // FIXME: Convert Q_INVOKABLEs to Q_PROPERTIES
- // (breaks back-compatibility)
QUrl homeserver() const;
Q_INVOKABLE Room* room(const QString& roomId,
JoinStates states = JoinState::Invite|JoinState::Join) const;
@@ -421,7 +425,8 @@ namespace QMatrixClient
* to direct chat rooms is changed (because of either local updates
* or a different list arrived from the server).
*/
- void directChatsListChanged();
+ void directChatsListChanged(DirectChatsMap additions,
+ DirectChatsMap removals);
void cacheStateChanged();