diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-01-30 15:35:06 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-01-30 16:07:54 +0900 |
commit | 038471e340c51f36f612fbb19d8a2b60a9923973 (patch) | |
tree | 64fd4526106f80b6a0091f6c5ad10127e73aec30 | |
parent | fcb0342410beaacc84c59813a1a7b6195c6abf7f (diff) | |
download | libquotient-038471e340c51f36f612fbb19d8a2b60a9923973.tar.gz libquotient-038471e340c51f36f612fbb19d8a2b60a9923973.zip |
Connection: expose the list of users; use an ordered map
It's still an open question whether it's better to store a separate
sorted index of users, next to an unsorted one; but a sorted list of
users is of much more use in GUI than an unsorted one.
-rw-r--r-- | connection.cpp | 7 | ||||
-rw-r--r-- | connection.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/connection.cpp b/connection.cpp index 01d7461d..e06baef7 100644 --- a/connection.cpp +++ b/connection.cpp @@ -62,7 +62,7 @@ class Connection::Private // Leave state of the same room. QHash<QPair<QString, bool>, Room*> roomMap; QVector<QString> roomIdsToForget; - QHash<QString, User*> userMap; + QMap<QString, User*> userMap; QString userId; SyncJob* syncJob = nullptr; @@ -516,6 +516,11 @@ QHash< QPair<QString, bool>, Room* > Connection::roomMap() const return roomMap; } +QMap<QString, User*> Connection::users() const +{ + return d->userMap; +} + const ConnectionData* Connection::connectionData() const { return d->data.get(); diff --git a/connection.h b/connection.h index 792ed126..2f7c38b3 100644 --- a/connection.h +++ b/connection.h @@ -71,6 +71,7 @@ namespace QMatrixClient virtual ~Connection(); QHash<QPair<QString, bool>, Room*> roomMap() const; + QMap<QString, User*> users() const; /** Sends /forget to the server and also deletes room locally. * This method is in Connection, not in Room, since it's a |